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/glass-break-detector/content.md
+69-1Lines changed: 69 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,7 +294,75 @@ You can also use the Arduino IDE's Serial Monitor to observe similar results fou
294
294
295
295
## Expanding Glass Breaking Detector
296
296
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";
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.
0 commit comments