A demo application that makes your micro:bit V2 model respond to TikTok dance moves, built with Edge Impulse. This demo uses Machine Learning to analyse the accelerometer data coming from the micro:bit on-board sensor, showing a smiley on the display when it recognises "Floss" TikTok moves.
Detailed instructions for the project are available on the OKdo Project Hub
-
Clone this repository:
git clone https://github.com/LetsOKdo/dance-activated-microbit
-
Change to project directory:
cd dance-activated-microbit
-
Install Docker for your host Get Docker
-
Build the container:
docker build -t microbit_dance_detector .
-
Build the project:
macOS, Linux
docker run --rm -v $PWD:/data microbit_dance_detector
Windows
docker run --rm -v "%cd%":/data microbit_dance_detector
-
Install CMake, Python 2.7 and the GNU ARM Embedded Toolchain and Ninja. Make sure
arm-none-eabi-gcc
and the other components are in your PATH. -
Build the project:
python build.py
-
Plug in your micro:bit to the host with a micro USB cable (the microbit should be visble as a mass storage device in your filemanager)
-
Flash the binary to your micro:bit by dragging
MICROBIT.hex
onto theMICROBIT
disk drive or copy the one from this repo.
-
Detach your micro:bit and connect it to the battery pack
-
The center LED on the matrix will light up showing that the micro:bit is ready to detect your dance moves
-
Start dancing the "Floss dance" and if you do it right the matrix will light up with a smiley face
-
The detection will reset automatically after a few seconds
You can build new models using Edge Impulse.
- Sign up for an account and open your project.
- Install Edge Impulse tools from the command window
npm install -g edge-impulse-cli
-
Set up one micro:bit as a dance move transmitter
-
Set up another micro:bit as a dance move receiver
-
Follow the Data Forwarder instructions
-
Go back to Data acquisition and now collect your dance move data.
-
Follow these steps to train your model.
Note: use window length 999 instead of 1000!
Once you've trained a model go to Deployment, and select C++ Library. Then:
- Remove
source/edge-impulse-sdk
,source/model-parameters
andsource/tflite-model
. - Drag the content of the ZIP file into the
source
folder. - If you've picked a different keyword, change this in source/AccelerometerInferenceTest.cpp.
- Rebuild your application.
- Your micro:bit now responds to your own TikTok moves 🚀.
There's an excellent video tutorial on using Edge Impulse here: