Voice activated Micro:bit with Machine Learning

HI @janjongboom,

I cloned your code from Github (https://github.com/edgeimpulse/voice-activated-microbit) and I tried building it. However, it does not work for me. I’ve installed Docker and everything else that you requested, but it still does not build the dependencies (I get errors wight after this command “docker run --rm -v ${PWD}:/app microbit_ei_build”). I am not sure what it’s going on exactly. I was wondering if you can make a video about this or if you can help me out! I will attach the error that I have below!

By the way, I am doing this in Windows 10, VSC (so I can run python build.py)

1 Like

Hello i have already build the hex file using docker but the keywor donest works for me, what can i do?

@toolelucidator Can you open a serial terminal and see what the board says? Or you can use edge-impulse-run-impulse --raw if you have the Edge Impulse CLI installed.

Sorry for my dumb question how can i open a terminal for microbit?

Hi,

When I record my own audio from phone or laptop, the frequency was 16000Hz, don’t know how to change to 11k when I did the recording.
Any suggestion?

@toolelucidator The easiest is to get the Edge Impulse CLI then run edge-impulse-run-impulse --raw

@odincodeshen Only https://github.com/edgeimpulse/voice-activated-microbit#use-the-power-of-the-crowd-to-collect-keywords does actually collect at 11KHz at the moment from phones. If you’ve already collected data you can use Preparing audio (see my note about sox) to downsample. We’ll be adding this to the Studio at some point in the near future.

1 Like

In order to build from docker, do I need to collect any data or only run the commands?

@toolelucidator The github repo should have everything, so just running the commands to build with Docker are enough.

Hi I am trying to do the build with spyder python , but I get the error “‘cmake’ is not recognized as an internal or external command, operable program or batch file.”. Any help would be appreciated.

Hi @wlonsdale129,

You need to install cmake in order to build locally (https://github.com/edgeimpulse/voice-activated-microbit#how-to-build-local). You can also use the docker version instead as the toolchain is already included in the image.

Aurelien

1 Like

hi, I got an error when I build. What can I do?

This looks like it is not using the proper compiler… Do you have arm-none-eabi-gcc and arm-none-eabi-g++ in your PATH and are these version 9?

Bringing ML to micro:bit is just awesome! Well done also for this fantastic UI.
From Terminal (MacBook Pro M1): python build.py generated errors.
(I have loaded Cmake and gcc-arm-none-eabi-9-2020-q2-update and added them in the PATH)
See attached.
Your help would be very much appreciated, thank you!

Hello @AAAAA5,

I do not have an apple M1 to try the build.
As a workaround, could you try compiling with Docker see if it works please?

Regards,

Louis

@AAAAA5 Bit late (sorry!) but this does not look like it’s using the stdlib in ARM GCC. If you run arm-none-eabi-gcc does this work?

Hi,

I works great with your example but when I want to use my model with another word “left” instead of “micro:bit” I got the build error below. Do you have any idea ? Thanks, Julien

C:/Users/juphu/voice-activated-microbit/source/edge-impulse-sdk/CMSIS/NN/Source/PoolingFunctions/arm_max_pool_s8_opt.c:156:22: warning: unused variable ‘in’ [-Wunused-variable]
156 | union arm_nnword in;
| ^~
[2/89] Building CXX object CMakeFiles/MICROBIT.dir/source/edge-impulse-sdk/tensorflow/lite/micro/kernels/cast.cc.obj
[3/89] Building CXX object CMakeFiles/MICROBIT.dir/source/edge-impulse-sdk/tensorflow/lite/micro/kernels/batch_to_space_nd.cc.obj
[4/89] Building CXX object CMakeFiles/MICROBIT.dir/source/edge-impulse-sdk/tensorflow/lite/core/api/op_resolver.cc.obj
[5/89] Building CXX object CMakeFiles/MICROBIT.dir/source/edge-impulse-sdk/tensorflow/lite/micro/kernels/add.cc.obj
[6/89] Building CXX object CMakeFiles/MICROBIT.dir/source/edge-impulse-sdk/tensorflow/lite/core/api/flatbuffer_conversions.cc.obj
ninja: build stopped: subcommand failed.

juphu@DESKTOP-S65DAO8 MINGW64 ~/voice-activated-microbit (master)

Hi @Juph, did you change to your keyword here? https://github.com/edgeimpulse/voice-activated-microbit/blob/master/source/MicrophoneInferenceTest.cpp#L32

And replace the edge-impulse-sdk, tflite-model, and model-parameters directories in source with your C++ library export as well?

hello! thanks for the awesome tutorial. Am wondering why the window size is 999ms instead of 1000ms? It was mentioned that it’s got something to do with the 11kHz frequency, but what exactly?

Hello @warp-speed

Indeed, this was not 100% clear to me either, I had to ask @janjongboom too :wink:
So basically when you sample at a 11kHz frequency, you have 11000 samples in one second (or 1000 ms).
So if you do 1000/11000 = 0.090909
But back in the time, we used some rounded values in the studio so 0.090909 * 11000 ~= 999.9…

However, now we use zero padding it does not matter anymore.
I hope this is clear.

Regards,

Louis

That’s clear, thanks a bunch louis and jan