Bring magic to your home with the Nordic Semiconductor Wireless Wizard Wand. The wand utilizes the powerful nRF52840 chip with Edge Impulse ML motion recognition to communicate with all your smart home appliances over Zigbee.
Table of Contents
About
During my internship in the Product Marketing department at Nordic Semiconductor, I was tasked with designing and building a demo demonstrating the nRF52840's AI capabilities, and thus, the Wireless Wizard Wand was born. The wand was designed and built during my summer internship and tested during Trondheim Skaperfest (≈maker faire). The test included controlling a light bulb (IKEA Trådfri) and unlocking a treasure chest with magic spells. Although not all features werew implemented, the demo was a success.
The firmware for this project is located here: https://github.com/tordnat/wireless-wizard-wand
Two Wireless Wizard Wands and the Nordic treasure chest that they can control
Hardware & features
The wand features a 3D-printed Wood-like housing that contains the electronics. The custom PCB, which mounts underneath the Adafruit Feather, features a 6-axis MPU6050 IMU and DA7280 haptics driver. Both components are connected to the board via I2C. The housing also features a mounting hole for the ERM vibration motor underneath the board. Cost, skill, and part availability were all considered when designing the wand. The custom PCB is designed to be suitable for hand soldering, which the large SMD package sizes allow.
3D model of the Wireless Wizard Wand
Main Components
PCB
- Haptic Motor Driver DA7280-00FVC (QFN Package)
- Vybronics ERM Vibration Motor VC1030B028F
- Panasonic SMD Button EVQ-P7J01P
- 0805 Packages for passive components
Casing
- ICR18650-22F Battery
- Connection Pins from MPD BH-18650-W
- Smartfil Wood Filament
How I made it
Programming and Edge Impulse ML
The software was developed in VSCodium using nRF Connect for VS Code. The sample application is based on the Zigbee Light Switch sample in nRF Connect SDK. I approached the machine learning module with a mindset of "as simple as possible, but not simpler". Data for the ML model was captured through a simple data forwarder over serial. I decided on five simple labels that I believed would have good enough clustering in the Spectral Feature Filter and collected <15min training data. I used Edge Impulse Studio to tune a Spectral Feature filter, which showed promising clustering and minimal overlap with 39 output features. Next, I built a simple classifier with 39 input features from the spectral feature filter and two dense layers (39 features => 20 neurons => 10 neurons => 5 classes). The classifier was then trained for 100 epochs with a learning rate of 0.0005 to avoid overfitting. The result was a classifier with 99.9% accuracy on test data. During live testing, this proved to be closer to 80% due to the overlap between "Calm Circle" and "Calm Wiper", which one could expect. Using Edge Impulse Studio's optimizer, I compiled and exported the Edge Impulse module for a Cortex-M4F 64MHz (which the nRF52840 uses). Once exported, the Edge Impulse model could be imported as a C++ library (which Zephyr supports). Furthermore, I implemented mutex logic to sample and buffer accelerometer data from the MPU6050 and the Edge Impulse library safely.
PCB Design
Due to size constraints, I decided to design a custom PCB that would house both the IMU and the haptics driver. I first designed the wand to use a BMI270 low-power IMU but had to change to a different IMU due to its small package size and high price. The MPU6050 Module was chosen due to its price and availability. Using a module instead of an IC was an easy choice since the module was cheaper than all the parts individually (for consumers). I designed the PCB to be easy to assemble, with the IMU soldered with headers underneath the PCB. I used KiCAD for the design and ordered it through JLCPCB.
The Wireless Wizard Wand PCB
Hardware Design
The 3D-printed housing was designed in FreeCAD. It was designed with the aim of minimizing its size without sacrificing aesthetics. With limited time, this part of the project was given a lower priority. Hardware files, including the PCB design, are located in the hardware-files folder.
Build & deployment
There are currently two options to deploy the project:
- Use the prebuilt release
- Build the project using west and nRF Connect SDK v2.3
To flash the hex-file to the Adafruit Feather nRF52840 you can use an external debugger (Segger J-Link or nRF52 DK). The blue indication LED (which indicates Zigbee stack initialization) on the wand should indicate whether you have flashed the MCU successfully. Once the program is running, you can connect to the wand with a micro-USB cable. If the wand detects a serial connection over USB on boot, logging should automatically start. The sample application is a simple program that looks for a Zigbee light bulb and sends commands over Zigbee based on ML motion recognition. Once a light bulb is detected, the red indication LED should light up.
The application logging happens automatically when connecting the wand to USB. However, data forwarding is a separate function and needs to be manually started by calling k_forwarder()
in main, to collect more data.
Demo Spells See the project on Edge Impulse Studio for more information on the demo ML classifier.
- + : Fast Circle => Light On
- + : Calm Circle => Dimm Up
- ️ + : Fast Wiper => Light Off
- ️ + : Calm Wiper => Dimm Down
-
- : Idle => Do nothing
Conditions for a working sample:
- Correctly flashed MCU
- MPU6050 IMU detected over I2C (see Hardware)
- Joined Zigbee network (see Zigbee Light Bulb Sample)
- Light bulb detected
Demonstrating the "Light On" spell
Further development
As mentioned, not all planned features were implemented during the summer.
Some ideas for further development of the project:
- Implement haptics
- Proper IMU Configuration
- LED indication
- Zigbee pairing logic
- Power optimization
- Separate charging circuit to improve charge time
- Fix cable routing tolerance in casing
Closing
During the course of a summer, I built the Wireless Wizard Wanda demo, which demonstrates the AI capabilities of the nRF52840 SoC and easy integration with smart home appliances, such as the IKEA light bulb (IKEA Trådfri). I started out knowing little about Zephyr, but through good use of courses on the Nordic Developer Academy and available examples in the nRF Connect SDK, I was able to achieve a feasible prototype fairly quickly. The demo was used at Nordic's stand during Trondheim Skaperfest (makerfaire) and was a great success.
Wireless Wizard Wand at Trondheim Makerfaire this summer