ei_printf
function which sends data through a serial connection to your computer, which then forwards it to Edge Impulse. Depending on which class you want to collect data for, you’ll have to uncomment the corresponding line of code from the code snippet below. Since collecting enough real weather data for training the model would take a lot of time and is weather-dependent, for the purpose of this tutorial we will simulate the Rise and Drop classes using the barometerValueHigh()
and the barometerValueLow()
functions which generate arbitrary data based on an initial reading of the real measured pressure. To collect data for the Normal class, uncomment the barometer.value()
function.
edge-impulse-data-forwarder
This will launch a wizard that will prompt you to log in and select an Edge Impulse project. You will also have to name the device and the axes of your sensor (in this case our only axis is barometer). You should now see Nicla Sense in the Devices menu on Edge Impulse.
edge-impulse-data-forwarder --clean
This will launch a wizard that will prompt you to log in and select the Edge Impulse project. The --clean
tag is used when you want to switch to a new project in case you’ve previously connected a project to the Data Forwarder. You will also have to name the device and the axes of your sensor (in this case the axes are in the following order: accel.x, accel.y, accel.z, gyro.x, gyro.y, gyro.z, ori.heading, ori.pitch, ori.roll, rotation.x, rotation.y, rotation.z, rotation.w). You should now see Nicla Sense in the Devices menu on Edge Impulse.
We will collect data for three classes, as described in the previous section:
go run bhy.go webserver
A webpage will pop up and you’ll have to select Sensors. Turn on Bluetooth on your computer, then click Connect and select your Nicla board. After the devices are paired, enable the sensors you want to monitor and the webpage will start making requests to post data to Arduino IoT Cloud.
You can also configure a Dashboard to visualize your sensor data: