You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/03.nano/boards/nano-33-ble-sense/tutorials/edge-impulse/edge-impulse.md
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
-
title: 'Edge Impulse with the Nano 33 BLE Sense'
2
+
title: 'Edge Impulse® with the Nano 33 BLE Sense'
3
3
difficulty: advanced
4
4
compatible-products: [nano-33-ble-sense]
5
-
description: 'Learn how to train your board to recognize keywords in speech, using Edge Impulse.'
5
+
description: 'Learn how to train your board to recognize keywords in speech, using Edge Impulse®.'
6
6
tags:
7
7
- Machine Learning
8
-
- Edge Impulse
8
+
- Edge Impulse®
9
9
- Microphone
10
10
author: 'José Bagur'
11
11
libraries:
@@ -16,26 +16,26 @@ software:
16
16
- ide-v1
17
17
- ide-v2
18
18
- Arduino-CLI
19
-
- EdgeImpulse
19
+
- Edge-Impulse
20
20
featuredImage: 'chip'
21
21
---
22
22
23
23
## Introduction
24
24
25
-
In this tutorial we will use Edge Impulse with an Arduino Nano 33 BLE Sense to run a simple Artificial Neural Network that can recognize keywords in speech. We will use the embedded digital microphone on the Nano 33 BLE Sense, the MP34DT05, to listen to our surroundings and we will light the built-in RGB LED of the board when a keyword is detected.
25
+
In this tutorial we will use Edge Impulse® with an Arduino Nano 33 BLE Sense to run a simple Artificial Neural Network that can recognize keywords in speech. We will use the embedded digital microphone on the Nano 33 BLE Sense, the MP34DT05, to listen to our surroundings and we will light the built-in RGB LED of the board when a keyword is detected.
26
26
27
27
## Goals
28
28
29
29
The goals of this tutorial are:
30
30
31
31
- Learn Machine Learning fundamentals.
32
-
- Use Edge Impulse with an Arduino Nano 33 BLE Sense board.
32
+
- Use Edge Impulse® with an Arduino Nano 33 BLE Sense board.
33
33
- Run a simple Artificial Neural Network that can recognize keywords in speech.
34
34
35
35
## Hardware and Software Needed
36
36
37
37
-[Nano 33 BLE Sense](https://store.arduino.cc/arduino-nano-33-ble-sense).
38
-
- Edge Impulse to train simple Artificial Neural Network.
38
+
- Edge Impulse® to train simple Artificial Neural Network.
39
39
- Arduino IDE
40
40
41
41
## Machine Learning Fundamentals
@@ -89,24 +89,24 @@ This kind of output is used to **discover the composition and structure of data*
89
89
-**Sequence prediction**:
90
90
This kind of output is used to **predict the next symbol based on the previously observed sequence of symbols** of something. For example, a sequence of products bought by a customer.
91
91
92
-
Now that we learned the basics of ML, let's use the Arduino Nano 33 BLE Sense board to run a simple ANN that can recognize keywords in speech. For this, we are going to use **Edge Impulse**.
92
+
Now that we learned the basics of ML, let's use the Arduino Nano 33 BLE Sense board to run a simple ANN that can recognize keywords in speech. For this, we are going to use **Edge Impulse®**.
93
93
94
-
## Setting up Edge Impulse
94
+
## Setting up Edge Impulse®
95
95
96
-
An **edge device** is any kind of hardware that controls data flow at the boundary between two networks. Edge devices work, essentially, as entry or exit points in networks. **Edge Impulse** is one of the leading development platforms for ML on edge devices, their mission is to enable developers and device makers from all over the world to solve real world problems using ML models on edge devices. Let's use Edge Impulse to create a ML system or model and deploy it on your Nano 33 BLE Sense board.
96
+
An **edge device** is any kind of hardware that controls data flow at the boundary between two networks. Edge devices work, essentially, as entry or exit points in networks. **Edge Impulse®** is one of the leading development platforms for ML on edge devices, their mission is to enable developers and device makers from all over the world to solve real world problems using ML models on edge devices. Let's use Edge Impulse® to create a ML system or model and deploy it on your Nano 33 BLE Sense board.
97
97
98
-
First, create an [Edge Impulse account](https://mltools.arduino.cc/studio/144605) through the Arduino platform, and create a new project called **speech_recognition**.
98
+
First, create an [Edge Impulse® account](https://mltools.arduino.cc/studio/144605) through the Arduino platform, and create a new project called **speech_recognition**.
99
99
100
100

101
101
102
-
Now, you have to setup up your Nano 33 BLE Sense board in your Edge Impulse account, that we will use for acquiring the data required to train the ML model for speech detection. You need to install the following software in your computer:
102
+
Now, you have to setup up your Nano 33 BLE Sense board in your Edge Impulse® account, that we will use for acquiring the data required to train the ML model for speech detection. You need to install the following software in your computer:
With this software installed and running correctly in your computer, it's time to connect your Nano 33 BLE Sense board in Edge Impulse. Your board does not come with the right firmware that enables that connection. In order to connect your board with Edge Impulse, a firmware update is required:
107
+
With this software installed and running correctly in your computer, it's time to connect your Nano 33 BLE Sense board in Edge Impulse®. Your board does not come with the right firmware that enables that connection. In order to connect your board with Edge Impulse®, a firmware update is required:
108
108
109
-
**1.** Download the latest [Nano 33 BLE Sense board Edge Impulse firmware](https://cdn.edgeimpulse.com/firmware/arduino-nano-33-ble-sense.zip). Unzip the file in a known location in your computer.
109
+
**1.** Download the latest [Nano 33 BLE Sense board Edge Impulse® firmware](https://cdn.edgeimpulse.com/firmware/arduino-nano-33-ble-sense.zip). Unzip the file in a known location in your computer.
110
110
111
111
**2.** Open the Flash script for your computer's operating system (`flash_windows.bat`, `flash_mac.command` or `flash_linux.sh`).
112
112
@@ -120,9 +120,9 @@ Now, open a command prompt or terminal and run:
120
120
$ edge-impulse-daemon
121
121
```
122
122
123
-
This will start a wizard that will ask you to log in into your Edge Impulse account and choose a project.
123
+
This will start a wizard that will ask you to log in into your Edge Impulse® account and choose a project.
124
124
125
-
>**Note:** If you created your Edge Impulse account by logging in with another service such as Google, this step may give you an error as your account technically does not have a password. To fix this, reset the password of your account by clicking "Forgot your password?" and following the instructions.
125
+
>**Note:** If you created your Edge Impulse® account by logging in with another service such as Google, this step may give you an error as your account technically does not have a password. To fix this, reset the password of your account by clicking "Forgot your password?" and following the instructions.
126
126
127
127
If you have several projects in your account, and you want to switch between them, run:
If you didn't already create a project, a new project will be automatically created for you in another platform, and you may not be able to find it. So make sure that you did create the speech_recognition project.
134
134
135
-

135
+

136
136
137
-
Now, in your Edge Impulse account, navigate to **Devices** on the left menu. You should see now your Nano 33 BLE Sense board name with its ID. A green dot should also appear if the board is connected to Edge Impulse correctly.
137
+
Now, in your Edge Impulse® account, navigate to **Devices** on the left menu. You should see now your Nano 33 BLE Sense board name with its ID. A green dot should also appear if the board is connected to Edge Impulse® correctly.
138
138
139
-
>**Note:** Be mindful, if the command prompt or terminal is closed, the connection between the board and your Edge Impulse account would be lost.
139
+
>**Note:** Be mindful, if the command prompt or terminal is closed, the connection between the board and your Edge Impulse® account would be lost.
We are ready to start acquiring data for our model! Let's train a ML model that would let you identify keywords in speech, with the keywords: **red**, **green** and **yellow**.
147
147
148
-
The first step is to create a representative dataset of the selected keywords that the ML model is supposed to identify. On Edge Impulse, navigate to **Data acquisition** on the left menu and then go to **Record new data**. On the **Device** option select the device you just have set up, on the **Sensor** option select the **built-in microphone**. Set the **sample length** (in milliseconds) to 2,500 and leave the **Frequency** (in Hz) as 16,000.
148
+
The first step is to create a representative dataset of the selected keywords that the ML model is supposed to identify. On Edge Impulse®, navigate to **Data acquisition** on the left menu and then go to **Record new data**. On the **Device** option select the device you just have set up, on the **Sensor** option select the **built-in microphone**. Set the **sample length** (in milliseconds) to 2,500 and leave the **Frequency** (in Hz) as 16,000.
149
149
150
150

151
151
152
-
Now, in the **Label** write **red** and click on the **Start sampling** button. This will start sampling your Nano 33 BLE Sense board built-in microphone for 2500 milliseconds. In this period of time say the keyword **red**, but remember to have the microphone close to you. Record at least 50 samples and repeat this also for the other keywords, **green** and **yellow**. You should now start seeing the collected data (each recorded sample) and a graph of each recorded sample on Edge Impulse.
152
+
Now, in the **Label** write **red** and click on the **Start sampling** button. This will start sampling your Nano 33 BLE Sense board built-in microphone for 2500 milliseconds. In this period of time say the keyword **red**, but remember to have the microphone close to you. Record at least 50 samples and repeat this also for the other keywords, **green** and **yellow**. You should now start seeing the collected data (each recorded sample) and a graph of each recorded sample on Edge Impulse®.
153
153
154
154
After recording your first sample you can listen back to it to make sure the recording is clear and there is no disturbing background noise.
155
155
156
156

157
157
158
158
Also, in complete silence and without saying anything, record 50 more samples with the label **noise**. This samples are going to help the ML model identify when no keywords are being spoken. In total, you should get around 8 minutes of collected data with 4 different labels.
159
159
160
-
This is a very basic example of data collection with Edge Impulse. If you want to train a more robust model follow the recommendations below:
160
+
This is a very basic example of data collection with Edge Impulse®. If you want to train a more robust model follow the recommendations below:
161
161
162
162
**1.** Recorded samples should be one to three seconds long.
163
163
@@ -199,15 +199,15 @@ Now that you have your ML model, its time to test it with an edge device. The ML
199
199
200
200

201
201
202
-
In the **Create library** section, click on **Arduino library** and then, on the bottom, click on the **Build** button. This will start a process where Edge Impulse creates a library for your Arduino board that has the ML model you have trained. When the building process is done, your browser should start downloading the generated library.
202
+
In the **Create library** section, click on **Arduino library** and then, on the bottom, click on the **Build** button. This will start a process where Edge Impulse® creates a library for your Arduino board that has the ML model you have trained. When the building process is done, your browser should start downloading the generated library.
Now, open the Arduino library you just created with Edge Impulse. Remember to disconnect your board from Edge Impulse by closing the command prompt or terminal. Open your Arduino IDE and navigate to **Sketch**, select **Include library** and click on **Add .ZIP Library...**. Go to your Downloads folder and select the .ZIP file generated by Edge Impulse. Click on **Open**. The library should be installed and ready to be used and tested.
206
+
Now, open the Arduino library you just created with Edge Impulse®. Remember to disconnect your board from Edge Impulse® by closing the command prompt or terminal. Open your Arduino IDE and navigate to **Sketch**, select **Include library** and click on **Add .ZIP Library...**. Go to your Downloads folder and select the .ZIP file generated by Edge Impulse®. Click on **Open**. The library should be installed and ready to be used and tested.
207
207
208
208

209
209
210
-
Navigate to **File**, select **Examples** and navigate to **Examples from Custom Libraries**. Here you should see an example named **"speech_detection Inferencing"**. Select the **nano_ble_33_sense_microphone_continuous**. This should open a sketch with the code that will let you test the ML model you trained before with Edge Impulse. Compile it and upload it to your Nano 33 BLE Sense board. Remember to select the **Arduino Nano 33 BLE Sense** as your board and associated serial port.
210
+
Navigate to **File**, select **Examples** and navigate to **Examples from Custom Libraries**. Here you should see an example named **"speech_detection Inferencing"**. Select the **nano_ble_33_sense_microphone_continuous**. This should open a sketch with the code that will let you test the ML model you trained before with Edge Impulse®. Compile it and upload it to your Nano 33 BLE Sense board. Remember to select the **Arduino Nano 33 BLE Sense** as your board and associated serial port.
211
211
212
212
Open the **Serial Monitor**, you should now see the ML model working. In order to make sure its working properly, after the keyword labels (green, noise, red and yellow) you should see the predictions being printed to the screen. When the ML model detects the keywords green, red or yellow on speech, one of the predictions output, or probability, should go up and get closer to one.
213
213
@@ -219,7 +219,7 @@ How can you flash the built-in RGB LED of your Nano 33 BLE Sense board if a keyw
219
219
220
220

221
221
222
-
Congratulations! You just have implemented a simple ANN that can recognize speech keywords in your Arduino Nano 33 BLE Sense using Edge Impulse.
222
+
Congratulations! You just have implemented a simple ANN that can recognize speech keywords in your Arduino Nano 33 BLE Sense using Edge Impulse®.
223
223
224
224
### Troubleshoot
225
225
@@ -232,18 +232,18 @@ This error is related with the nested libraries that may create paths that are t
232
232
233
233
## Conclusion
234
234
235
-
You have learned about the basics of Machine Learning. You also learned how to create a simple ANN that can recognize keywords in speech using Edge Impulse and deploy it on a Arduino Nano 33 BLE Sense board. This simple ANN allows you to detect the keywords red, green and yellow on speech and light the built-in LED of the Arduino Nano 33 BLE Sense board when this happens.
235
+
You have learned about the basics of Machine Learning. You also learned how to create a simple ANN that can recognize keywords in speech using Edge Impulse® and deploy it on a Arduino Nano 33 BLE Sense board. This simple ANN allows you to detect the keywords red, green and yellow on speech and light the built-in LED of the Arduino Nano 33 BLE Sense board when this happens.
236
236
237
237
Nowadays, ML is all around us in the world. From social media to maps for navigation, ML finds its application in almost every aspect of our lives. If you wish to read more about it, check out the links below:
238
238
239
239
-[TinyML: Machine Learning with TensorFlow on Arduino and Ultra-Low Power Microcontrollers](https://www.amazon.com/-/es/Pete-Warden/dp/1492052043) - A book written by Pete Warden and Daniel Situnayake that gives you a comprehensive background on TinyML and a lot of example applications.
240
240
241
241
-[TensorFlow Lite for Microcontrollers](https://www.tensorflow.org/lite/microcontrollers) - Documentation site of TensorFlow Lite for Microcontrollers where you'll find user guides, tutorials and API documentation.
242
242
243
-
-[Edge Impulse](https://docs.edgeimpulse.com/docs/getting-started) - Documentation site of Edge Impulse where you'll find user guides, tutorials and API documentation.
243
+
-[Edge Impulse®](https://docs.edgeimpulse.com/docs/getting-started) - Documentation site of Edge Impulse® where you'll find user guides, tutorials and API documentation.
244
244
245
-
-[Introduction to Embedded Machine Learning](https://www.coursera.org/learn/introduction-to-embedded-machine-learning) - Online course from Coursera where Shawn Hymel and Alexander Fred-Ojala teaches you about the basics of a ML system, how to use ML to take decisions and predictions in a embedded system and how to deploy a ML model into a microcontroller. This tutorial was based on Shawn's work with Edge Impulse and Arduino.
245
+
-[Introduction to Embedded Machine Learning](https://www.coursera.org/learn/introduction-to-embedded-machine-learning) - Online course from Coursera where Shawn Hymel and Alexander Fred-Ojala teaches you about the basics of a ML system, how to use ML to take decisions and predictions in a embedded system and how to deploy a ML model into a microcontroller. This tutorial was based on Shawn's work with Edge Impulse® and Arduino.
246
246
247
247
-[The Future of ML is Tiny and Bright](https://www.edx.org/professional-certificate/harvardx-tiny-machine-learning) - In this exciting Professional Certificate program offered by Harvard University and Google TensorFlow, you will learn about the emerging field of Tiny Machine Learning (TinyML), its real-world applications, and the future possibilities of this transformative technology.
248
248
249
-
-[Training a Custom Machine Learning Model for Portenta H7](https://www.arduino.cc/pro/tutorials/portenta-vision-shield/custom-machine-learning-model) - Sebastian Romero teaches you how to train a custom machine learning model with Edge Impulse and to run it using the Portenta Vision Shield. This tutorial was based on Sebastian's work with Edge Impulse and the Portenta H7.
249
+
-[Training a Custom Machine Learning Model for Portenta H7](https://www.arduino.cc/pro/tutorials/portenta-vision-shield/custom-machine-learning-model) - Sebastian Romero teaches you how to train a custom machine learning model with Edge Impulse® and to run it using the Portenta Vision Shield. This tutorial was based on Sebastian's work with Edge Impulse® and the Portenta H7.
Get started with machine learning with TinyML, TensorFlow Lite or Edge Impulse thanks to the high performance energy efficient microprocessor clocked at 133 MHz.
25
+
Get started with machine learning with TinyML, TensorFlow Lite or Edge Impulse® thanks to the high performance energy efficient microprocessor clocked at 133 MHz.
0 commit comments