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/06.nicla/boards/nicla-voice/tutorials/ei-intruder-detector/content.md
+18-11Lines changed: 18 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,7 +151,7 @@ We will go through some important code sections to make this application fully o
151
151
- Including `NDP.h` will enable and run the Neural Decision Processor (NDP120), it's included in the BSP of the Nicla Voice.
152
152
- Including `ArduinoBLE.h` will enable the Bluetooth® Low Energy communication, install it by searching for it on the Library Manager.
153
153
154
-
The Bluetooth® Low Energy services and characteristics are standardized for the specific use of this application's features. The service is defined as "Immediate alert" which makes it ideal for the use that we will give of notifying on a door opening or forcing event. In addition to this, we defined two characteristics, one for the "Alert Level" that will advertise between both events and a "Battery Level" one to advertise the Nicla Voice battery level to the host. Notice that they have specific and standardized Bluetooth® Low Energy UUIDs.
154
+
The Bluetooth® Low Energy services and characteristics are standardized for the specific use of this application's features. The service is defined as `Immediate alert` which makes it ideal for the use that we will give of notifying on a door opening or forcing event. In addition to this, we defined two characteristics, one for the `Alert Level` that will advertise between both events and a `Battery Level` one to advertise the Nicla Voice battery level to the host. Notice that they have specific and standardized Bluetooth® Low Energy UUIDs.
155
155
156
156
```arduino
157
157
#include "NDP.h"
@@ -173,7 +173,13 @@ The Nicla Voice's integrated NDP needs some files stored in the external flash o
173
173
- dsp_firmware_v91.synpkg
174
174
- ei_model.synpkg
175
175
176
-
***The files must be named exactly as shown above. To store them in the Nicla Voice memory you must use the [Syntiant Uploader](assets/Syntiant_Uploader.zip), these files won't be overwritten after any sketch update.***
176
+
***The files must be named exactly as shown above.***
177
+
178
+
[Here](assets/Syntiant_Uploader.zip) you can download these files including the Machine Learning model already trained and the uploading tools.
179
+
180
+
After downloading the required files, to store them in the Nicla Voice memory you must follow the steps detailed on this [guide section](https://docs.arduino.cc/tutorials/nicla-voice/user-manual#ndp120-processor-firmware-update).
181
+
182
+
***These files won't be overwritten after any sketch update.***
177
183
178
184
```arduino
179
185
// Neural Decision Processor firmware and ML model files loading
@@ -185,9 +191,11 @@ The Nicla Voice's integrated NDP needs some files stored in the external flash o
185
191
Serial.println("Configure mic");
186
192
NDP.turnOnMicrophone();
187
193
```
188
-
The main responsibility of the Nicla Voice code is to listen to and identify the trained sounds. The below code section is in charge of comparing the inferred category and taking a certain action between them. In the case the Nicla detects the door opening, the label parameter will turn to "NN0:opened", this will trigger a Bluetooth® Low Energy alert sending command followed by a listening pause to avoid duplicated alerts and a green LED blinking to visually indicate the event. The same for the "NN0:forcing" label, with the difference that in this case the LED flashes red and the alert message changes.
194
+
The main responsibility of the Nicla Voice code is to listen to and identify the trained sounds. The below code section is in charge of comparing the inferred category and taking a certain action between them.
189
195
190
-
```arduino
196
+
In the case the Nicla detects the door opening, the label parameter will turn to `NN0:opened`, this will trigger a Bluetooth® Low Energy alert sending command followed by a listening pause to avoid duplicated alerts and a green LED blinking to visually indicate the event. The same for the `NN0:forcing` label, with the difference that in this case the LED flashes red and the alert message changes.
197
+
198
+
```cpp
191
199
/**
192
200
Inference Interruption Callback to be executed with every triggered inference,
193
201
it controls the built-in LED's and send the alerts through BLE.
@@ -351,7 +359,7 @@ void loop() {
351
359
352
360
In order to just get connected with the Nicla Voice, the Portenta searches for the specific "Alert Service" using its UUID `1802` and for the necessary characteristics, the "Battery Level" using the `2A19` UUID and the "Alert Level" using the `2A06` UUID.
353
361
354
-
```arduino
362
+
```cpp
355
363
// discover peripheral attributes
356
364
Serial.println("Searching for service 1802 ...");
357
365
@@ -390,7 +398,7 @@ In order to just get connected with the Nicla Voice, the Portenta searches for t
390
398
```
391
399
Finally, the Portenta verifies continuously if a characteristic is updated to upload it to the Cloud:
392
400
393
-
```arduino
401
+
```cpp
394
402
// while the peripheral is connected
395
403
while (peripheral.connected()) {
396
404
@@ -457,17 +465,16 @@ Within the Arduino Cloud's dashboard, the system variables can be monitored. We
457
465
458
466
We can easily access this dashboard from a PC, mobile phone or tablet from anywhere, receiving an instantaneous update wherever we are. In addition, we can set different integrations to complement our project, for example, setting up an IFTTT automation to receive an email, a cellphone notification, or even triggering some automation like turning on all the lights at home whenever an alert is fired.
459
467
460
-

468
+

All the necessary files to replicate this application notes can be found below:
467
474
468
-
* The complete code can be downloaded [here](assets/Nicla_Portenta_Codes.zip)
469
-
* The enclosure 3D printed models can be downloaded [here](assets/Intruder_Detector_3D_Files.zip).
470
-
* The Machine Learning Tools project is public [here](https://mltools.arduino.cc/public/204744/latest) so you can clone it and modify it to adapt it to your needs by improving the dataset or model architecture for a custom deployment.
475
+
* The complete code can be downloaded [**here**](assets/Nicla_Portenta_Codes.zip)
476
+
* The enclosure 3D printed models can be downloaded [**here**](assets/Intruder_Detector_3D_Files.zip).
477
+
* The Machine Learning Tools project is public [**here**](https://mltools.arduino.cc/public/204744/latest) so you can clone it and modify it to adapt it to your needs by improving the dataset or model architecture for a custom deployment.
0 commit comments