Skip to content

Commit ce9fad5

Browse files
committed
App note content draft additional
1 parent 9e4b12d commit ce9fad5

File tree

1 file changed

+69
-1
lines changed
  • content/hardware/06.nicla/boards/nicla-voice/tutorials/glass-break-detector

1 file changed

+69
-1
lines changed

content/hardware/06.nicla/boards/nicla-voice/tutorials/glass-break-detector/content.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,75 @@ You can also use the Arduino IDE's Serial Monitor to observe similar results fou
294294

295295
## Expanding Glass Breaking Detector
296296

297-
XXX
297+
You can expand the Glass Breaking Detector system described in this application note to include real-time alerts and interesting automation by integrating the Nicla Voice, Portenta H7 and the Arduino IoT Cloud.
298+
299+
This enhanced functionality will allow you to perform improved safety and monitoring capabilities specific to environments with glass structures.
300+
301+
### Expanded System Overview
302+
303+
The system starts with the Nicla Voice, which runs a trained machine learning model to detect high-accuracy glass-breaking sounds. When a glass-breaking sound is detected, the Nicla Voice sends a notification via Bluetooth® Low Energy (BLE) to the Portenta H7.
304+
305+
Working as the host, the Portenta H7 forwards the alert to the Arduino IoT Cloud, where you can monitor updates on a dashboard and actions triggered in real time.
306+
307+
This integration also includes an escalation mechanism. The system will activate a Security Alert upon detecting the initial glass-breaking event.
308+
309+
If additional glass-breaking events are detected, the system will escalate the response by activating a Lockdown Motor to secure the environment that could be connected to reinforced shutters.
310+
311+
This feature provides you with an adaptable solution for possible scenarios.
312+
313+
### Nicla Voice Integration
314+
315+
The Nicla Voice identifies glass-breaking sounds and sends alerts to the Portenta H7. The following code shows how part of the alert mechanism works:
316+
317+
```arduino
318+
void sendAlert(char* label) {
319+
if (strcmp(label, "NN0:glassbreak") == 0) {
320+
Serial.println("Glass break detected. Sending BLE alert...");
321+
glassBreakAlert.writeValue(1); // Write to BLE characteristic
322+
NDP.noInterrupts();
323+
nicla::leds.begin();
324+
nicla::leds.setColor(red);
325+
delay(3000);
326+
nicla::leds.end();
327+
NDP.interrupts();
328+
} else {
329+
Serial.println("No relevant event detected.");
330+
}
331+
}
332+
```
333+
334+
This part of the code ensures that the Nicla Voice communicates detected events to the host device, allowing you to have rapid responses.
335+
336+
### Portenta H7 Integration
337+
338+
The Portenta H7 will handle BLE notifications from the Nicla Voice and work as the bridge between the detection hardware and the Arduino IoT Cloud.
339+
340+
Using the Portenta H7, you can update the cloud with event details and manage system responses based on the alert level.
341+
342+
The following code snippet shows how the Portenta H7 processes these specific alerts:
343+
344+
```arduino
345+
if (AlertValue == 1) {
346+
alertStatus = true; // General alert status triggered
347+
if (!SecurityAlert) {
348+
SecurityAlert = true; // Turn on security alert
349+
GlassEvent = "Security Alert ON: Glass break detected";
350+
Serial.println("Security Alert activated.");
351+
} else {
352+
LockdownMotor = true; // Turn on lockdown motor
353+
GlassEvent = "Lockdown activated: Additional glass break detected";
354+
Serial.println("Lockdown motor activated.");
355+
}
356+
}
357+
```
358+
359+
This structure ensures the system determines between initial and subsequent alerts, escalating responses as needed so you can handle possible complex scenarios.
360+
361+
### IoT Cloud Integration
362+
363+
By integrating with the Arduino IoT Cloud, you can access a user-friendly dashboard to monitor the system status. You can view real-time event logs, track BLE connection status, and observe the Security Alert or Lockdown Motor activation.
364+
365+
The cloud integration also enables you to receive updates and take action from anywhere, making the system more accessible and responsive.
298366

299367
## Full Glass-Breaking Detector Resources
300368

0 commit comments

Comments
 (0)