Unified AIoT-Based Smart Building Management and Safety System is an integrated platform designed to combine biometric access control, electrical energy monitoring, automated irrigation, and emergency gas-leak protection within a single hardware-software architecture. Built around the Arduino UNO Q, the system addresses the limitations of isolated building subsystems by integrating real-time sensing, intelligent decision-making, physical actuation, and cloud-based monitoring. The platform is intended for residential, commercial, and industrial environments where coordinated security, energy management, and environmental safety are essential.
The biometric access subsystem uses an in-browser neural-network pipeline based on SSD MobileNet V1 for face detection and a 128-dimensional FaceNet descriptor for identity verification. A positive Euclidean-distance verification result triggers an electromechanical solenoid door lock. The energy-monitoring subsystem samples analogue current signals and calculates true RMS current over five complete 50 Hz line cycles to estimate real power consumption at a nominal 230 V supply. For environmental protection, an MQ-2 gas sensor monitors combustible-gas levels and triggers a local acoustic alarm and an H-bridge-controlled gas valve when readings exceed a configured threshold. A manual digital mute option is provided for the alarm. In parallel, an automated irrigation subsystem controls a DC motor-driven watering mechanism based on real-time soil-resistivity measurements.
A companion dashboard provides centralised access to device states, irrigation schedules, power-monitoring records, and sensor telemetry. Bidirectional synchronisation with Google Firebase through a lightweight REST client enables remote monitoring and control, while voice-recognition macros and cyclic auto-restart scheduling extend the platform’s operational flexibility. By bringing security, energy awareness, irrigation, and gas-leak response together, the system demonstrates how an integrated AIoT architecture can improve building oversight and coordinate responses across multiple operational domains. Its effectiveness depends on appropriate sensor calibration, secure access policies, reliable network connectivity, and validation of the gas-shutoff mechanism. The system is designed to supplement—not replace—certified fire protection, gas-safety equipment, and compliant electrical installations.
1. Executive Summary
Commercial building security, domestic energy tracking, and emergency environmental protection typically operate as three isolated subsystems. Security depends on manual keys or unverified smart cards; irrigation and appliance control rely on fixed analogue timers that disregard environmental dynamics; and hazardous conditions like combustible LPG gas leaks depend on standalone chirping buzzers that cannot autonomously isolate the physical supply pipe. When a resident or factory operator is away, an incident in any of these three domains can escalate into catastrophic loss.
We engineered a unified, field-deployed AIoT platform that resolves these deficiencies on a single hardware-software stack. At the physical edge, an Arduino UNO Q coordinates real-time digital and analogue sensing alongside heavy actuator control. Biometric access uses a local client-side neural network running SSD MobileNet V1 with a 128-dimensional FaceNet descriptor in the browser runtime, triggering an electromechanical solenoid strike when positive Euclidean verification occurs. Concurrently, analogue current sampling executes True AC RMS calculations over five complete 50Hz line cycles, computing real power draw at 230V mains. Autonomous sub-routines manage an H-bridge driven gas valve that shuts physically when MQ-2 sensor readings cross threshold, sounding a local acoustic alarm while retaining a manual digital mute option. A companion DC motor drives irrigation based on real-time soil resistivity. All device states, schedules, power logs, and telemetry synchronize bi-directionally with Google Firebase over a lightweight REST client, accessible through an interactive dashboard supporting voice recognition macros and cyclic auto-restart scheduling.

2. Detailed Problem Analysis & Industrial Relevance
In urban Indian residences and decentralised agricultural or warehouse setups, three operational hazards persist:
- Physical Security Vulnerabilities: Mechanical deadbolts and plastic RFID cards are susceptible to duplication, theft, and loss. Conventional smart locks frequently depend on proprietary third-party servers that exhibit high unlock latency or fail during internet disruptions.
- Unchecked Household & Industrial Energy Wastage: Most consumers learn about excessive electrical draw only upon receiving their monthly bill. Existing smart plugs monitor single appliances without providing contextual scheduled duty cycles (e.g., automated pause-and-restart cooling cycles), leading to prolonged appliance operation during peak tariff intervals.
- Passive Environmental Alarms Lacking Mechanical Interlocking: Typical domestic gas detectors merely sound a buzzer. If the homeowner is asleep, in another room, or away from the premises, the leak continues unabated. A truly resilient AIoT safety mechanism must close the physical cylinder valve through a motorised linkage the moment raw analog ppm levels surge.
3. Hardware Architecture & Circuit Interfacing
Our physical hardware configuration leverages the dual-execution capability of the Arduino UNO Q. The onboard high-performance STM32 microcontroller manages deterministic input/output sampling, PWM generation, and relay timing, interfacing with the onboard Linux environment through the Arduino RouterBridge RPC channel.

Microcontroller Pin Allocations & Electrical Logic
| Pin Identifier | Assigned Module | Electrical Logic & Operating Behaviour |
|---|---|---|
| D2 | 5V Electromechanical Solenoid Lock | Active-HIGH. Driven through a high-current transistor driver; defaults to LOCKED. |
| D3 | Relay 1 (Primary Lighting Load) | Active-LOW optocoupled input. Interlocked with digital IR sensor for walk-by automation. |
| D4 | Relay 2 (Inductive Fan / Appliance) | Active-LOW optocoupled input. Rated 10A @ 250V AC, snubber-protected. |
| D5 | Relay 3 (Auxiliary Appliance) | Active-LOW optocoupled input. Fully customizable label and voice keyword triggers. |
| D6 | DHT11 Temperature & Humidity Sensor | Single-wire bidirectional serial bus. Sampled at 2-second stable intervals. |
| D7 | Infrared (IR) Obstacle / Motion Sensor | Active-LOW digital output. Generates immediate edge transitions on line-of-sight interruption. |
| D8 | Submersible 5V/12V DC Water Pump | Active-HIGH relay isolation. Governed by analogue soil moisture comparison loop. |
| D9, D10 | DC Motor 1 (Gas Isolation Valve) | L298N H-Bridge IN1/IN2 direction pins. Driven for discrete millisecond intervals to close valve. |
| D11, D12 | DC Motor 2 (Water Line Valve) | L298N H-Bridge IN3/IN4 direction pins. Bidirectional positioner with programmable rotation time. |
| D13 | Active 5V Acoustic Buzzer | Active-HIGH. Emits 2.8kHz resonant alert on emergency thresholds; includes software silence flag. |
| A0 | Analogue Soil Resistivity Probe | 10-bit successive approximation ADC (0–1023 raw). Calibrated for dry-to-wet soil resistance curves. |
| A1 | MQ-2 Combustible Gas Sensor | Analogue tin-dioxide (SnO2) heater circuit. Continuous raw voltage tracking for LPG/methane levels. |
| A2 | ACS712-20A Hall-Effect Current Sensor | Isolated linear Hall element with 100mV/A scale factor. Centre-biased around VCC/2 (2.5V DC). |
Circuit Wiring Schematic & Hardware Interfacing

4. Real-Time Signal Conditioning & True RMS Energy Computation
Measuring alternating current using simple instantaneous ADC sampling yields completely inaccurate results because AC sinusoidal waveforms swing positively and negatively around a DC offset. For the Allegro ACS712-20A Hall sensor, zero current outputs approximately VCC / 2 (nominally 2.50V). Naive implementations that apply DC formulas or calculate peak voltages fail whenever non-linear loads introduce harmonic distortions.
To overcome this, we implemented a True RMS numerical integration loop directly within the firmware loop: During bootup setup, the MCU takes 1,000 consecutive readings at zero load to compute the exact quiescent baseline voltage (V_offset), compensating for rail supply voltage fluctuations. During periodic telemetry cycles, the MCU gathers 500 samples spaced 200 microseconds apart, spanning exactly 100 milliseconds—precisely five full cycles of Indian 50Hz AC mains. Each discrete sample voltage is converted to current deviation:
- Instantaneous Current: i(t) = (V_adc(t) – V_offset) / 0.100 V/A
- True RMS Current: I_rms = sqrt( (1 / N) * sum( i(t)^2 ) ) over N = 500 samples.
- Apparent Power: P = I_rms * 230V AC (Standard nominal mains voltage across India).
Energy integration runs in the Python backend at 1Hz: Energy_per_second (kWh) = P * (1 / 3,600,000). These energy units accumulate into persistent daily buckets stored under /power/history/YYYY-MM-DD. At midnight Indian Standard Time (UTC+5:30), the daily sum is stored permanently and rolls into a cumulative monthly index (/power/monthly_history/YYYY-MM), preventing memory overflow while offering historical consumption traceability.
5. Edge AI Vision Architecture & Biometric Validation
Rather than offloading raw video streams to expensive cloud APIs—which introduce privacy vulnerabilities and network latency—the visual recognition pipeline executes on-device within the browser execution context using TensorFlow.js and face-api.js:
- Stage 1 — Object Detection: An SSD MobileNet V1 single-shot multibox detector evaluates incoming webcam frames, computing candidate bounding coordinates with depthwise separable convolutions to maintain high frame rates even on modest client hardware.
- Stage 2 — Geometric Alignment: A 68-point landmark estimator pinpoints fiducial facial structures (pupils, nasal tip, oral commissures), performing affine transformation to standardise pose variations prior to feature extraction.
- Stage 3 — Deep Embedding Extraction: A quantised FaceNet architecture compresses facial geometry into a compact 128-dimensional unit hypersphere vector.
- Stage 4 — Euclidean Metric Classification: The extracted vector is compared against authorised enrollment vectors stored locally and mirrored in Firebase. If the Euclidean distance d = sqrt(sum((v1_i – v2_i)^2)) falls below the rigorous threshold of 0.48, access is validated. A hardware trigger packet SOL:1 is dispatched, opening the solenoid strike for a user-specified interval (default 5.0 seconds) before automatic re-engagement.
6. Closed-Loop Safety Automations & Actuator Mechanics
A central innovation of this design is its deterministic, multi-variable safety interlocking:
- Gas Leak Emergency Mechanical Isolation: The MQ-2 sensor outputs raw analogue values into pin A1. When ambient concentration exceeds the user-calibrated safety ceiling (e.g., > 450 raw ADC), the system activates a dual response: First, active pin D13 asserts HIGH, driving the 85dB piezo buzzer. Simultaneously, Motor 1 receives a timed directional impulse via pins D9/D10 through the L298N driver, physically rotating the ball valve 90 degrees to mechanically cut the supply. Crucially, when raw gas levels drop below the threshold, the buzzer silences, but the motor does NOT automatically reopen the valve. This intentional hysteresis prevents premature gas discharge until a human operator inspects the room and triggers an explicit reset.
- Adaptive Soil Moisture Irrigation: Analogue probe A0 reflects soil resistance. When soil desiccation causes raw readings to exceed the set trigger (higher resistance = drier substrate), Relay 4 (pin D8) activates the 5V submersible pump. Once moisture saturates the soil and brings raw levels below hysteresis, the pump turns off, eliminating over-watering and root rot.
- Non-Blocking Actuator State Machine: Traditional Arduino programs rely on delay() calls, which freeze the processor and cause dropped sensor readings or missed safety trips. In our firmware, motor runtimes are tracked using microsecond/millisecond timestamps (millis()). Motors automatically de-energise after their commanded duration (e.g., 3,000ms) without arresting telemetry transmission or sensor reads.
7. Resilient Cloud Middleware & Zero-Dependency Network Protocol
During embedded software integration on modern Linux/Python 3.13 systems, monolithic packages like firebase-admin frequently fail because their nested gRPC C++ bindings encounter memory-alignment faults (SIGBUS / exit code 135) when compiled for ARM architectures. To guarantee industrial-level reliability and instant boot times, we rejected heavy external libraries entirely. We authored a custom, pure-Python REST client using only the native Python standard library (urllib.request, json, threading, datetime).
- Asynchronous Firebase PUT / GET: Device state changes, sensor values, and logs are transmitted as lightweight JSON payloads over HTTPS without third-party wrapper overhead.
- Dual-Channel Synchronisation: Inbound dashboard commands are received through an SSE (Server-Sent Events) streaming thread (Accept: text/event-stream), supplemented by a 1Hz polling safety fallback. This hybrid method delivers sub-200ms round-trip reaction times while guaranteeing self-recovery if a transient Wi-Fi drop interrupts the persistent HTTP stream.
- Stale-Schedule Discard Filter: If the hardware is offline when an alarm scheduled time arrives, firing that event minutes or hours later upon boot could damage machinery. Our dispatcher checks: if now – scheduled_time > 60 seconds, the event is marked stale, cleared from database memory, and skipped safely.
- Automated Cyclic Restart Engine: For appliances requiring duty cycling (such as ventilation fans or refrigeration units), users can configure an OFF alarm with a “Run for” duration and toggle Auto Restart. When the device switches off at the designated hour, the backend dynamically schedules a follow-up Turn ON event after the countdown elapses, creating a self-sustaining cycle.
8. Bill of Materials (BOM) & Component Specifications
The prototype is constructed entirely from standardised, readily accessible industrial components, ensuring straightforward repeatability and field servicing:
| Item No. | Component Description | Manufacturer Part / Specification | Qty | Primary Function in System Architecture |
|---|---|---|---|---|
| 1 | Arduino UNO Q Development Board | ABX00087 (STM32U5 + Linux MPU) | 1 | Edge AIoT dual-core processing engine & bridge controller |
| 2 | Hall Effect AC/DC Current Sensor 20A | Allegro ACS712ELCTR-20A-T Module | 1 | Mains power draw & cycle-accurate True RMS integration |
| 3 | Temperature & Relative Humidity Sensor | DHT11 Digital Climate Module | 1 | Ambient room environmental climate surveillance |
| 4 | Combustible Gas Sensor (LPG/Smoke) | MQ-2 Metal Oxide Semiconductor Sensor | 1 | Volatile combustible gas concentration detection |
| 5 | Digital Infrared Motion Sensor | Infrared Obstacle/Motion Sensor Module | 1 | Line-of-sight entryway occupancy lighting automation |
| 6 | Soil Moisture Resistivity Sensor | Corrosion-Resistant Soil Probe Module | 1 | Agricultural substrate water saturation measurement |
| 7 | 5V Electromechanical Solenoid Strike | 5V DC Continuous-Duty Solenoid Bolt | 1 | Secure door access physical electromechanical lock |
| 8 | 4-Channel 5V Optocoupled Relay Board | Songle SRD-05VDC-SL-C Relay Array | 1 | Mains electrical isolation for lighting, fans & pump |
| 9 | Dual H-Bridge Motor Driver Module | STMicroelectronics L298N Dual Bridge | 2 | High-current bidirectional drive for gas & water valves |
| 10 | 12V DC High-Torque Geared Motor | 12V DC 60 RPM Metal Geared Motor | 2 | Mechanical valve rotation actuators (Gas & Water) |
| 11 | 5V Continuous Audio Piezo Buzzer | Active 5V Piezo Electric Transducer | 1 | Audible hazard alarm indicator (with mute override) |
| 12 | Mini Submersible 5V/12V DC Pump | Brushless Submersible Water Pump | 1 | Precision irrigation substrate water delivery |
| 13 | Regulated Multi-Rail Power Supply | 12V 2A DC Switching Power Adapter | 1 | Actuator, motor, and relay auxiliary power supply rail |
| 14 | Interconnect Harness & Passives | Breadboard, Terminal Blocks, Jumpers | 1 | System prototyping signal and ground interconnects |
9. Experimental Verification, Benchmark Testing & Metrics
To validate reliability under real-world conditions, each functional block underwent multi-trial physical stress testing:
| Test Category | Experimental Setup & Procedure | Observed Performance Metric | Validation Status |
|---|---|---|---|
| Facial Verification Accuracy | Tested across 4 registered identities under 100 lx to 800 lx illumination at distances from 0.3m to 1.8m. | 95.4% true positive verification; 0.0% false acceptance rate on 30 unregistered trials. | PASSED |
| Biometric Unlock Latency | Interval from facial landmark acquisition to solenoid relay pin assertion. | Average latency: 1.18 seconds; worst-case: 1.62 seconds over Wi-Fi. | PASSED |
| ACS712 True RMS Calibration | Loaded with calibrated 60W tungsten bulb (0.260A nominal) and variable resistive heater. | Measured 0.264A on 60W load; error margin within ±1.8% across full 0.1A–8.0A test curve. | PASSED |
| Gas Hazard Automatic Interlock | MQ-2 exposed to controlled butane lighter discharge with threshold set at 400 raw ADC. | Buzzer sounded in 0.82 seconds; motor isolated valve within 3.0 seconds. Valve remained shut after air cleared. | PASSED |
| Soil Moisture Auto-Watering | Dry potting soil saturated incrementally with pump state logged in database. | Pump triggered on raw reading 540; automatically disengaged when saturation reached raw reading 280. | PASSED |
| Network Disconnect Recovery | Local Wi-Fi router rebooted while background worker executed scheduled events. | SSE stream re-established automatically within 2.1 seconds of router recovery; zero state corruption. | PASSED |
| Continuous 72-Hour Burn-In | Full hardware running uninterrupted with 500ms telemetry cadence and periodic switching. | Zero MCU lockups; memory footprint remained constant at 14.2 MB Linux RAM; daily kWh logged correctly. | PASSED |
10. Key Engineering Differentiators
- Client-Side Neural Inference: Eliminates recurring cloud vision API fees and protects homeowner visual privacy by keeping all image feature vectors within local execution memory.
- Active Mechanical Safety Shut-Off: Unlike market detectors that only sound a chime, our platform physically arrests fuel lines via motorised ball valves before combustible vapour reaches dangerous explosive limits.
- Zero-C++ Lightweight REST Bridge: Replacing fragile gRPC stacks with pure-Python standard library HTTP streaming enables seamless execution on embedded Linux architectures without package version conflicts.
- Integrated Energy Auditing: Live 230V AC True RMS sampling combined with calendar-aware accumulation gives consumers appliance-level consumption clarity with automated pause-and-restart scheduling.
11. Scalability, Industrial Deployment & Future Enhancements
- On-Board TinyML Edge Anomaly Detection: Future iterations will deploy a quantised TensorFlow Lite model directly on the STM32 to recognise abnormal electrical signature waveforms (such as arcing or motor bearing failure) in real time.
- Multi-Node LoRa Mesh Topology: In agricultural farms or multi-floor industrial buildings, secondary sensor nodes will report via 868MHz LoRa to an Arduino UNO Q central gateway, covering kilometres without Wi-Fi infrastructure.
- Custom Industrial PCB: The current modular breadboard implementation will transition to a custom two-layer PCB with integrated solid-state relays, surge suppressors, and optocouplers conforming to Indian BIS safety standards.
12. Team Declaration & Compliance Statement
We hereby declare that this project design, circuit schematic, firmware, and application architecture represent original, unpublished engineering work developed for the AIOT Design Challenge 2026. All electrical schematics, pin mappings, and benchmark test results reported herein have been practically constructed, debugged, and verified on real physical hardware. The intellectual property remains with the development team, while granting EFY Group publication and exhibition permissions.
| Field | Declaration Detail |
|---|---|
| Design Challenge | AIOT Design Challenge 2026 (EFY Group) |
| Submission Date | 29/09/2026 |
| Primary Author / Team Lead | Bogala Ashok Reddy |
| Signature | Bogala Ashok Reddy (Digital Verification) |



