Skip to main content
The data forwarder is used to easily relay data from any supported device to Edge Impulse over serial. Devices write sensor values over a serial connection, and the data forwarder collects the data, signs the data and sends the data to the ingestion service. The data forwarder is useful to quickly enable data collection from a wide variety of development boards without having to port the full remote management protocol and serial protocol, but only supports collecting data at relatively low frequencies. To use the data forwarder, load an application (examples for Arduino, Mbed OS and Zephyr below) on your development board, and run:
The data forwarder will ask you for the server you want to connect to, prompt you to log in, and then configure the device. This is an example of the output of the forwarder:
Note: Your credentials are never stored. When you log in these are exchanged for a token. This token is used to further authenticate requests.

Clearing configuration

To clear the configuration, run:

Overriding the frequency

To override the frequency, use:

Overriding the baud rate

To set a different baud rate, use:

Protocol

The protocol is very simple. The device should send data on baud rate 115,200 with one line per reading, and individual sensor data should be split with either a , or a TAB. For example, this is data from a 3-axis accelerometer:
The data forwarder will automatically determine the sampling rate and the number of sensors based on the output. If you load a new application where the sampling frequency or the number of axes changes, the data forwarder will automatically be reconfigured.

Example (Arduino)

This is an example of a sketch that reads data from an accelerometer (tested on the Arduino Nano 33 BLE):

Example (Mbed OS)

This is an example of an Mbed OS application that reads data from an accelerometer (tested on the ST IoT Discovery Kit):
There’s also a complete example that samples data from both the accelerometer and the gyroscope here: edgeimpulse/example-dataforwarder-mbed.

Example (Zephyr)

This is an example of a Zephyr application that reads data from an accelerometer (tested on the Nordic Semiconductor nRF52840 DK with ST X-NUCLEO-IKS02A1 shield), based on the sensorhub example:
There’s also a complete example that samples data from the accelerometer here: edgeimpulse/example-dataforwarder-zephyr.

Sensor fusion

Using the Data Forwarder, you can relay data from multiple sensors. You can check Benjamin Cabe’s artificial nose for a complete example using NO2, CO, C2H5OH and VOC sensors on a WIO Terminal. You may also have sensors with different sampling frequencies, such as:
  • accelerometer: 3 axis sampled at 100Hz
  • RMS current sensor: 1 axis sampled at 5Hz
In this case, you should first upscale to the highest frequency to keep the finest granularity: upscale RMS sensor to 100 Hz by duplicating each value 20 times (100/5). You could also smooth values over between samples.

Classifying data

To classify data you first deploy your project by following the steps in Deployments tutorials - which contains examples for a wide variety of platforms. Then, declare a features array, fill it with sensor data, and run the classifier. Here are examples for Arduino, Mbed and Zephyr - but the same applies to any other platform.
Note: These examples collect a full frame of data, then classify this data. This might not be what you want (as classification blocks the collection thread). See Continuous audio sampling for an example on how to implement continuous classification.

Classifying data (Arduino)

Classifying data (Mbed OS)

Classifying (Zephyr)

Before adding the classifier in Zephyr:
  1. Copy the extracted C++ library into your Zephyr project, and add the following to your CMakeLists.txt file (where ./model is where you extracted the library).
  1. Enable C++ and set the stack size of the main thread to at least 4K, by adding the following to prj.conf:
  1. If you’re on a Cortex-M target, enable hardware acceleration by adding the following defines to your CMakeLists.txt file:
Then, run the following application:

Troubleshooting

”The execution of scripts is disabled on this system” (Windows)

If you are running the data forwarder on a Windows system, you need to update PowerShell’s execution policy to allow running scripts: