A comprehensive IoT security and monitoring system combining Arduino hardware, AI-powered vision classification, and a web-based interface for real-time alerts and monitoring.
- Devpost: https://devpost.com/software/nightknight
- YouTube Demo: https://youtu.be/GBo-jC-Bh00?si=fSEBdi13TjYtXQKx
NightKnight is an intelligent surveillance system that combines:
- Arduino UNO Q: Motion and tilt detection via accelerometer/gyroscope sensors
- Edge AI Model: Real-time video classification using Edge Impulse trained models
- Web UI: Live monitoring dashboard and system control interface
├── sketch/ # Arduino UNO firmware
│ ├── sketch.ino # Main Arduino sketch with motion detection
│ └── sketch.yaml # Arduino configuration
│
├── python/ # Backend AI & web server
│ ├── main.py # Main application with AI vision logic
│ └── requirements.txt # Python dependencies
│
├── assets/ # Web frontend
│ ├── index.html # Web UI markup
│ ├── index-*.css # Compiled stylesheets
│ ├── index-*.js # React app compiled code
│ └── bridge.js # Communication bridge for hardware
│
├── app.yaml # Application configuration
└── README.md # This file
Hardware: Arduino UNO with Modulino Movement kit (accelerometer/gyroscope)
Features:
- Real-time motion detection using 6-axis IMU
- Tilt/rotation monitoring with calibration
- RGB LED status indicators (dual LED rings)
- Motion event debouncing with 1.5s cooldown
- Thresholds:
- Motion: ±0.20G acceleration
- Rotation: ±20 DPS
- Tilt: ±25 degrees
Communication:
- Communicates with Python backend via Arduino Router Bridge
- Sends motion/tilt events and sensor data
- Receives commands and LED control signals
Framework: Arduino App Bricks with Edge Impulse
Features:
- Real-time video classification using a pre-trained Edge Impulse model
- State machine with 3 states:
clear: Normal monitoring statewaiting: Person detected in front (confidence > 75%)blackout: No-light/dark conditions (confidence > 90%)
- Sliding window history (8 samples) for state stability
- Debouncing mechanism (0.2s) to filter false positives
- Confidence-based classification with configurable thresholds
Model Path:
/home/arduino/.arduino-bricks/ei-models/gdaniels-project-1-linux-aarch64-v9.eim- Classifications:
Waiting in front,Blackout,unknown
Output:
- JSON state changes with timestamps (ISO 8601)
- Real-time WebSocket updates to frontend
- Event history tracking
Framework: React + Vite (compiled static assets)
Features:
- Real-time monitoring dashboard
- Live camera feed from video brick
- System state display (
clear/waiting/blackout) - Motion alerts and notifications
- Control panel for arm/disarm
- Event history visualization
bridge.js responsibilities:
- Establishes WebSocket connection to Python backend
- Handles bidirectional communication
- Manages camera stream and state updates
- Converts hardware events to UI updates
1. Arduino UNO (Motion Sensors)
├─> Detects movement/tilt
└─> Sends event to backend
2. Python Backend (AI Processing)
├─> Receives motion alert
├─> Processes video frame via Edge Impulse
├─> Performs state classification
└─> Updates WebSocket clients
3. Web UI (Real-time Dashboard)
├─> Receives state updates
├─> Displays camera feed
├─> Shows alert notifications
└─> Provides user control
idle/clear state
↓ (person detected + confidence > 75%)
↓
waiting state ─── (person leaves or timeout)
↓ ↗
↓ (lights out + confidence > 90%)
↓
blackout state ─── (lights restored)
↓ ↗
└─ back to clear
name: KN
description: NightKnight UI
ports:
- 7000
bricks:
- arduino:web_ui: {}
- arduino:video_image_classification:
variables:
EI_V_CLASSIFICATION_MODEL: /home/arduino/.arduino-bricks/ei-models/gdaniels-project-1-linux-aarch64-v9.eim
icon: 😛Bricks Used:
web_ui: Hosts the web frontend on port 7000video_image_classification: Runs Edge Impulse AI model for vision classification
- Arduino UNO R4 WiFi (or compatible)
- Modulino Movement Kit (accelerometer + gyroscope)
- Micro-SD card (for Edge Impulse model storage)
- Arduino IDE with required libraries
- Python 3.8+
- Modern web browser (Chrome, Firefox, Safari, Edge)
-
Arduino Setup
- Upload
sketch/sketch.inoto Arduino UNO - Configure Modulino Movement connections
- Calibrate accelerometer baseline
- Upload
-
Python Backend
cd python/ pip install -r requirements.txt -
Run Application
- Deploy to Arduino Cloud
- Application auto-starts on device boot
- Monitor via web dashboard at
http://device:7000
- Home Security: Detect unauthorized entry and motion
- Office Monitoring: Track workspace activity during off-hours
- Package Protection: Alert when delivery packages are detected
- Facility Management: Log visitor arrival patterns
- Uno Q (Arduino UNO Q): Handles hardware acceleration and sensor processing
- Web UI Brick: Provides real-time monitoring and control
- Edge AI Model: Runs on-device for privacy and low-latency inference
Last Updated: 2026-03-02