Skip to content

Commit 2dc4dc8

Browse files
authored
[PC-1386] Nicla Voice Intruder Detector App Note Update (#1413)
* Structure changes 1 * gif update * Codes updated with new library
1 parent 7079c07 commit 2dc4dc8

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed
10.1 MB
Loading

content/hardware/06.nicla/boards/nicla-voice/tutorials/ei-intruder-detector/content.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ We will go through some important code sections to make this application fully o
151151
- Including `NDP.h` will enable and run the Neural Decision Processor (NDP120), it's included in the BSP of the Nicla Voice.
152152
- Including `ArduinoBLE.h` will enable the Bluetooth® Low Energy communication, install it by searching for it on the Library Manager.
153153

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.
155155

156156
```arduino
157157
#include "NDP.h"
@@ -173,7 +173,13 @@ The Nicla Voice's integrated NDP needs some files stored in the external flash o
173173
- dsp_firmware_v91.synpkg
174174
- ei_model.synpkg
175175

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.***
177183

178184
```arduino
179185
// 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
185191
Serial.println("Configure mic");
186192
NDP.turnOnMicrophone();
187193
```
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.
189195

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
191199
/**
192200
Inference Interruption Callback to be executed with every triggered inference,
193201
it controls the built-in LED's and send the alerts through BLE.
@@ -351,7 +359,7 @@ void loop() {
351359

352360
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.
353361

354-
```arduino
362+
```cpp
355363
// discover peripheral attributes
356364
Serial.println("Searching for service 1802 ...");
357365

@@ -390,7 +398,7 @@ In order to just get connected with the Nicla Voice, the Portenta searches for t
390398
```
391399
Finally, the Portenta verifies continuously if a characteristic is updated to upload it to the Cloud:
392400
393-
```arduino
401+
```cpp
394402
// while the peripheral is connected
395403
while (peripheral.connected()) {
396404
@@ -457,17 +465,16 @@ Within the Arduino Cloud's dashboard, the system variables can be monitored. We
457465

458466
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.
459467

460-
![Door opening event](assets/opened_door.png)
468+
![Door opening and intruder detection events](assets/realGif2.gif)
461469

462-
![Intruder detected event](assets/forced_door.png)
463470

464471
## Full Intruder Detector Example
465472

466473
All the necessary files to replicate this application notes can be found below:
467474

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.
471478

472479
## Conclusion
473480

0 commit comments

Comments
 (0)