Collecting Data in Edge Impulse with the Arduino Nano 33 BLE Sense
If you want to develop AI models using machine learning with Edge Impulse, you need one thing above all: data. Lots of data.
In this tutorial, you’ll learn how to collect motion data using the accelerometer of the Arduino Nano 33 BLE Sense and store it in Edge Impulse.
Preparations
Before you can start collecting data, you first need to know how to link your Arduino to a project in Edge Impulse.
Once the connection is established, you’ll see your microcontroller in Edge Impulse under the Devices menu item.
How to collect motion data
Now you can start collecting data with the accelerometer, which will then be used to develop an AI model through machine learning.
First, switch to the Data acquisition menu item. This is the central place where you measure (sample) and provide data with your Arduino. On the right, you’ll see the Collect data field. Here, your Arduino Nano should appear under Device with the name you gave it when connecting.
As mentioned, in this tutorial you’ll be using the accelerometer. Therefore, select the built-in accelerometer entry in the Sensor dropdown menu.
Next to it is the Frequency field – set this to 62.5 Hz. In the Sample Rate field, enter 10000 (milliseconds, i.e., 10 seconds).
The only thing missing is a name for the samples. In this tutorial, you’ll start with a non-movement, i.e., you simply leave the Arduino Nano 33 BLE Sense lying still during data collection. This way, your AI model will later know what No movement is.
A name for theses samples could be “idle”. But you can use any name you like. However, it must always be the same for this type of data.
Your settings should look something like this:
Capture your first sample
Now it’s time to start. Place your Arduino still on the table and click the Start sampling button. Edge Impulse will now measure for 10 seconds in which directions your Arduino moves along the X, Y, and Z axes. The sample will then be saved.
Since you didn’t perform any movement, the result looks accordingly calm:
In machine learning, the motto is: the more, the better. This means that one measurement of the idle state is not enough to develop an accurate AI model.
You should provide at least 3 minutes of data for each type of movement that your model should recognize later. For the idle state, you already have 10 seconds, so you still need 2 minutes and 50 seconds – or in other words, 17 more runs. 🙂
Measuring a real movement
You now have the idle state. Time for some more movement. Change the name in the Label field to “wave” – because now it’s time for waving.
Take your Arduino in your hand and click Start sampling as before. Now wave with the Arduino as soon as the measurement starts. Afterwards, you should get a measurement image that looks something like this:
Here you now see a completely different picture that clearly shows a characteristic movement. However, if you want to integrate this into your model, you’ll need to take many more samples again.
These movements always differ slightly from each other, and this is how the AI model learns to recognize and later distinguish many types of waving.
Try out many other types of movements and look at the corresponding diagrams.
What’s next?
Once you have a fairly large collection of motion data, you can start developing the AI model. In this project, you’ll learn how to recognize complex movements and gestures using artificial intelligence.
Collecting data with the microphone
With Edge Impulse, you can not only determine motion data but also record sounds using the built-in microphone of the Arduino Nano 33 BLE Sense. This way, you can distinguish a running water tap from a coffee grinder, for example. 😉
The sampling works very similarly to what was described above. Why don’t you try it out right away!