Configuring an Edge Impulse Route
Notehub allows you to route data to Edge Impulse, an edge AI platform for building machine learning models.
By using Edge Impulse alongside the Notecard, you have the ability to gather data in the field, send that data to the cloud with the Notecard, and then route that data to Edge Impulse to build and refine ML models.
Let's look at how it works.
To route data from Notehub to Edge Impulse you need to have an Edge Impulse account and at least one Edge Impulse project.
Configuring the Route
To start creating an Edge Impulse route, open your Notehub project, head to the Routes tab, click the Create Route button, and then find the Edge Impulse option. Click Select to get started.
On the next screen you'll be asked to provide a variety of values to configure your route.
Configuration
The Route name controls the name of your route within Notehub.
For API Key you'll need to grab your API key from within your Edge Impulse project dashboard. Visit your project's Keys tab to find it.
The Filename you provide will be included in the sample name in your Edge Impulse dataset. You can rename the generated file name in Edge Impulse.
The Device Type you provide displays in the Devices section in the Edge Impulse project dashboard. It does not affect the data itself.
The Interval is the frequency of the data you’re providing in each Note, in milliseconds.
The Timeout is how long Notehub should wait for a response from Notehub before timing out the request. It's fine to leave this at the default value.
Here’s what a completed configuration section might look like. When you have this section complete, scroll to the Filters section.
Filters
- In the Filters section set the Notefiles dropdown to Selected Notefiles, and select the Notefile you want to use for sending data.
With that change done, scroll down to the Data section.
Data
In this section the Device Name you provide controls how your device appears on Edge Impulse's Devices page. Using the placholder variable
[.device]
inserts your Notecard's DeviceUID.The optional Label allows you provide a label for your data sample. You can also change this label later in your Edge Impulse dashboard.
Finally, create a sensor for every sensor in your data sample. The Sensor should contain the name of the sensor, the Unit should be the data's unit, and the JSON expression should be how to access the sensor's values in your Note's JSON
body
. For example, the screenshot below shows how to register the x-axis of an accelerometer for a Note with abody
of"x": [1, 2, 3]
.
Here's what a completed version of the Data section might look like.
Testing the Route
With the route created you're now ready to test it out. The easiest way to make sure everything is working is by sending a Note using the Notecard's in-browser terminal.
Use the in-browser terminal to connect to your Notecard via USB. (If you're unsure how to do this check out the Notecard quickstart.)
Once connected, associate your Notecard with a Notehub project (if it isn't already).
{ "req": "hub.set", "product": "com.example.yourname:yourproject" }
Next, run the command below to queue a Note onto the
data.qo
Notefile. You may need to change thefile
andbody
of your command, depending on how you configured your Edge Impulse route.{ "req": "note.add", "file": "data.qo", "body": { "x": [1, 2, 3], "y": [3, 2, 1], "z": [0, 2, 1] } }
Finally, run the
hub.sync
request to send this data to your Notehub project.{ "req": "hub.sync" }
When the data reaches your Notehub project, Notehub will automatically route your sensor data to Edge Impulse. If you open your Edge Impulse's project dashboard, you should see a new entry on the Data acquisition tab.