An AIoT security system that uses TinyML to detect break-in attempts through vibration analysis
Features • Architecture • Quick Start • Documentation • Contributing
VibraGuard AI is a cutting-edge security system that solves the chronic false alarm problem of traditional vibration sensors. Instead of simple threshold-based detection, VibraGuard uses TinyML (Tiny Machine Learning) running directly on an ESP32-C3 microcontroller to intelligently classify vibrations as:
- Attack 🚨 - Break-in attempts (drilling, smashing, prying)
- Normal ✅ - Harmless events (door knocks, wind, footsteps)
- Noise 🔇 - Environmental interference (passing vehicles, distant machinery)
By processing AI inference at the edge (1ms latency), VibraGuard achieves:
- 95.1% accuracy (Attack: 93.1%, Normal: 95.8%, Noise: 98.8%)
- <2 second end-to-end response time
- >90% reduction in false alarms vs traditional sensors
- TensorFlow Lite model trained on Edge Impulse
- 1ms inference time on ESP32-C3 (RISC-V @ 160MHz)
- 1.4KB RAM footprint, 45.1KB Flash
- Spectral Analysis (FFT) for frequency-domain feature extraction
- ESP32-C3 Super Mini with MPU-6050 (6-axis accelerometer/gyro)
- MQTT protocol (Eclipse Mosquitto broker)
- Spring Boot 3.1.5 backend (Java 17)
- PostgreSQL 14 database
- React + Vite web dashboard
- Flutter 3.9 mobile app (Android/iOS)
- Google Cloud Platform (Compute Engine e2-small)
- Docker Compose orchestration (3 services)
- 24/7 uptime with auto-restart policies
- Static IP (34.87.133.103)
- Local Buzzer - Immediate on-device alarm
- WebSocket (STOMP) - Real-time push to web/mobile
- SMS - Twilio API integration
- Voice Call - TwiML automated phone calls
- ARM/DISARM system via web or mobile app
- Event history with confidence scores
- Real-time status monitoring
Complete system architecture showing ESP32 edge device, MQTT broker, Spring Boot backend, and multi-platform clients
Data flow from sensor capture to alert delivery across all system components
Database schema showing vibration events, device management, and alert history tables
IoT hardware connections and communication protocols between ESP32, sensors, and cloud services
Sequence diagram showing the complete attack detection and alert notification flow
- Hardware: ESP32-C3 Super Mini, MPU-6050 sensor, Buzzer, NPN transistor (S8050)
- Software: Arduino IDE 1.8+ / PlatformIO, Docker, Node.js 18+, Java 17+
- Cloud: Google Cloud SDK (optional, for deployment)
# 1. Flash firmware
cd esp32/vibraguard_ai_final
# Open .ino in Arduino IDE
# Select Board: ESP32C3 Dev Module
# Upload
# 2. Configure WiFi (in code)
const char* WIFI_SSID = "YourNetwork";
const char* WIFI_PASSWORD = "YourPassword";
const char* MQTT_SERVER = "34.87.133.103"; # Or your server IP# Start infrastructure
docker-compose up -d
# Build backend
cd backend
mvn clean package
java -jar target/app.jarBackend will be available at http://localhost:8080
# Web Dashboard
cd frontend
npm install
npm run dev
# Open http://localhost:5174
# Mobile App
cd vibraguard_app
flutter pub get
flutter run# Run integration tests
cd tests/integration
pip install -r requirements.txt
python test_system_complete.py| Document | Description |
|---|---|
| 📐 Architecture | System design with 8 Mermaid diagrams |
| 🚀 Deployment | Step-by-step GCP deployment |
| 🗄️ Database | PostgreSQL setup & 19 SQL queries |
| 🧪 Testing | Test suites and validation |
| 📱 Flutter Guide | Mobile app development |
| 🌐 WebSocket | Real-time communication |
| 🫠 Assets Guide | Image and diagram management |
| 👽 Final Report | Complete academic report |
- MCU: ESP32-C3 Super Mini (RISC-V, 160MHz, WiFi)
- Sensor: MPU-6050 (6-axis, I2C, 50Hz sampling)
- AI: Edge Impulse TinyML (TensorFlow Lite for Microcontrollers)
- Framework: Spring Boot 3.1.5 (Java 17)
- Database: PostgreSQL 14-alpine
- Broker: Eclipse Mosquitto (MQTT)
- Container: Docker Compose
- Web: React 18 + Vite 4
- Mobile: Flutter 3.9.2 (Dart 3.0)
- Platform: Google Cloud Platform
- Compute: Compute Engine e2-small (2 vCPUs, 2GB RAM)
- Networking: VPC, Firewall, Static IP
- SMS/Voice: Twilio API SDK 10.6.5
- Real-time: WebSocket (STOMP)
- Local: Buzzer (PWM)
| Metric | Value | Notes |
|---|---|---|
| AI Accuracy | 95.1% | Attack: 93.1%, Normal: 95.8%, Noise: 98.8% |
| Inference Time | 1ms | Edge processing on ESP32-C3 |
| RAM Usage | 1.4KB | TensorFlow Lite model |
| Flash Usage | 45.1KB | Optimized with quantization |
| End-to-End Latency | <2s | Detection → Alert delivery |
| False Alarm Reduction | >90% | vs traditional threshold sensors |
| Uptime | 99.9% | Docker auto-restart on GCP |
vibraGuard/
├── 📄 README.md # This file
├── 📄 LICENSE # MIT License
├── 📄 CONTRIBUTING.md # Contribution guidelines
├── 📄 CODE_OF_CONDUCT.md # Community standards
├── 🐳 docker-compose.yml # Infrastructure orchestration
├── 📡 mosquitto.conf # MQTT broker config
│
├── 🖥️ backend/ # Spring Boot backend
│ ├── src/main/java/
│ ├── src/main/resources/
│ ├── pom.xml
│ └── Dockerfile
│
├── 🌐 frontend/ # React web dashboard
│ ├── src/
│ ├── public/
│ ├── package.json
│ └── vite.config.js
│
├── 📱 vibraguard_app/ # Flutter mobile app
│ ├── lib/
│ ├── android/
│ ├── ios/
│ └── pubspec.yaml
│
├── 🔌 esp32/ # ESP32-C3 firmware
│ └── vibraguard_ai_final/
│ └── vibraguard_ai_final.ino
│
├── 📚 docs/ # Documentation
│ ├── assets/ # 📸 Images and diagrams
│ │ ├── architecture/ # System architecture diagrams
│ │ ├── diagrams/ # ERD, sequence, flow diagrams
│ │ ├── hardware/ # Hardware wiring diagrams
│ │ └── screenshots/ # Screenshots and photos
│ ├── DEPLOYMENT_GUIDE.md
│ ├── SYSTEM_ARCHITECTURE.md
│ ├── DBEAVER_CONNECTION_GUIDE.md
│ ├── guides/
│ │ ├── FLUTTER_GUIDE.md
│ │ ├── QUICKSTART.md
│ │ └── GCP_DEPLOYMENT_CHECKLIST.md
│ └── reports/
│ └── Report_final.md
│
├── 🧪 tests/ # Test suites
│ ├── mqtt/
│ │ ├── test_mqtt_python.py
│ │ └── test_mqtt_websocket.sh
│ ├── backend/
│ │ ├── test_control_command.py
│ │ └── test_control_panel.html
│ ├── websocket/
│ │ ├── test_websocket.html
│ │ └── test_websocket_health.html
│ └── integration/
│ ├── test_system_complete.py
│ ├── test_db_connection.py
│ └── test_twilio_trigger.py
│
└── 🛠️ scripts/ # Utility scripts
└── setup/
# Unit tests (Backend)
cd backend
mvn test
# Integration tests
cd tests/integration
python test_system_complete.py
# MQTT connectivity
cd tests/mqtt
python test_mqtt_python.py
# WebSocket health
cd tests/websocket
# Open test_websocket_health.html in browser
# Database connection
cd tests/integration
python test_db_connection.pydocker-compose up -d
cd backend && mvn spring-boot:run
cd frontend && npm run devSee DEPLOYMENT_GUIDE.md for step-by-step instructions.
# Quick deploy
gcloud compute instances create vibraguard-server \
--machine-type=e2-small \
--zone=asia-southeast1-b
# Upload and build
scp -r . vibraguard-server:~/vibraguard
gcloud compute ssh vibraguard-server
cd vibraguard && docker-compose up --build -dWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat(esp32): add WiFi manager') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CODE_OF_CONDUCT.md for community guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
- Edge Impulse - TinyML platform for model training
- Espressif - ESP32-C3 hardware and SDK
- Spring Team - Spring Boot framework
- Twilio - SMS/Voice API
- Google Cloud - Cloud infrastructure
- GitHub Issues: Report bugs or request features
- Email: vibraguard@example.com
- Documentation: Full docs
- Report: Academic report
- Edge AI with 95.1% accuracy
- Full-stack IoT implementation
- GCP deployment
- Multi-channel alerts (Buzzer + SMS + Voice + WebSocket)
- WiFiManager integration (hardcoded WiFi currently)
- I2S audio output (MAX98357A + Speaker)
- Secondary alarm system (tamper detection)
- ESP32-CAM integration (photo capture on attack)
- Mobile app on Play Store / App Store
- Support for multiple materials (door, safe, window)
Current Version: 1.0.0
Status: ✅ Production Ready
Last Updated: November 2025
Made with ❤️ by the VibraGuard AI Team Lê Văn Hoàng Nguyễn Tuấn Việt Nguyễn Ngọc Hòa




