Skip to the content
2 layers61.3 × 89.6 mmQuakeGuard PCB, the printed circuit board in 3D

QuakeGuard PCB

GiZano/QuakeGuard24

Distributed Earthquake Early Warning (EEW) system built on low-cost ESP32-C3 IoT sensors with Zero-Trust security, multi-node epicenter triangulation, and on-premise AI emergency reports. Includes custom PCB, FastAPI/Redis/TimescaleDB backend, and a React Native mobile app.

Size
61.3 × 89.6 mm
Copper layers
2
Thickness
1.6 mm
Parts
17
Nets
21
Pads
51
Tracks, vias
111, 32
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
11 Nov 2025
Updated
2 Nov 2026

Overview

QuakeGuard PCB is an open-source printed circuit board by GiZano, from the GiZano/QuakeGuard repository on GitHub, published under the AGPL-3.0 licence. It is a 2-layer board of 61.3 × 89.6 mm with 17 parts on 21 nets, routed with 111 tracks and 32 vias.

It is built around the ESP32-C3-LYRA, NEO-6M and ADXL345-EP. Its parts include 4 connectors, 3 capacitors, 3 resistors and 3 diodes. It belongs with the home automation and IoT and sensors and measurement boards and the ESP32 and RISC-V boards of this library.

Main components

3

README

README.md

🌋 QuakeGuard

Distributed Earthquake Early Warning System

Full-Stack IoT Architecture for Real-Time Earthquake Detection

Version License C++ Python React Native PostgreSQL Redis Docker Local AI Mosquitto Cloudflare

CI Backend CI Frontend CI IoT

DOI

Security Rating Reliability Rating Maintainability Rating Quality Gate Status

Bugs Code Smells Duplicated Lines (%)

PRs Welcome

📚 Technical Specification: A comprehensive architecture whitepaper is available in the docs/ directory, compiled via Typst. For a browsable, topic-by-topic reference, check out the project Wiki.

QuakeGuard Logo


Landing Page Wiki Whitepaper ROADMAP

📖 Overview

QuakeGuard is a full-stack IoT architecture for real-time detection, analysis, and reporting of seismic events. The system transforms everyday household appliances — washing machines, TVs, refrigerators — into a distributed seismic sensor network, each node capable of detecting and reporting earthquake activity autonomously.

Intelligent edge sensors (ESP32-C3 + ADXL345) analyze vibrations locally using professional-grade algorithms and transmit cryptographically signed data to an asynchronous cloud backend. The backend is engineesred to handle the massive traffic spikes — the Thundering Herd effect — typical during widespread seismic events, ensuring reliable alarm delivery without bottlenecking. A React Native mobile app receives real-time haptic and visual alerts via WebSocket.

QuakeGuard Proprietary Hardware

QuakeGuard v2.0 Assembled PCB

The QuakeGuard v2.0 fully assembled PCB, featuring the ESP32-C3 SuperMini, the ADXL345 accelerometer, and the u-blox GNSS module. For a complete list of required components, refer to the Bill of Materials (BOM) in the Wiki.


🏗️ System Architecture

text
ESP32-C3 + ADXL345
       │
       │  MQTT (signed payload)
       ▼
MQTT Bridge ──► POST /readings/ ──► ECDSA Verification
                                              │
                                              ▼
                                        Redis Queue
                                              │
                                              ▼
                                     Background Worker ────►┌───────────┐
                                      │           │ (Queue)  │ AI Worker │
                                      ▼           ▼          │ (Ollama)  │
                               PostgreSQL    Redis Pub/Sub ◄─└─────┬─────┘
                               + PostGIS               │
                                                   ▼
                                            WebSocket Broadcast
                                                  │
                                                  ▼
                                        React Native Mobile App
                                        (Haptic + Visual Alert)

The project follows Microservices and Event-Driven Design principles across three fully independent layers.


📡 IoT Edge (firmware/)

FeatureDetail
HardwareESP32-C3 SuperMini + ADXL345 Accelerometer
Sampling Rate100 Hz
Detection AlgorithmSTA/LTA (Short Term / Long Term Average)
Signal ProcessingDigital High-Pass Filter (HPF) to remove gravity
Data StructureStatically allocated Ring Buffers (RingBuffer<100> STA, RingBuffer<1000> LTA)
SecurityECDSA NIST256p cryptographic signing on every payload
TransmissionMQTT publish to quakeguard/telemetry
ProvisioningAutomated device handshake on first boot via POST /devices/register
Secret InjectionCompile-time ENROLLMENT_TOKEN via PlatformIO pre-script + #error fail-fast

☁️ Backend (backend/)

FeatureDetail
FrameworkFastAPI (Python 3.11), fully async
SecurityAPI Key auth, ECDSA signature verification, Anti-Replay (300s window)
Message BrokerRedis — decouples ingestion from processing
Rate LimitingFixed-window 50 req/s per IP via Redis
Alert EngineML-like magnitude proxy (M = log10(PGA_calib) + b), threshold M ≥ 4.5
DeduplicationRedis TTL cooldown lock per zone (60s), prevents alert storms
PersistencePostgreSQL + PostGIS with recorded_at timestamps
Zone AssignmentAutomatic via PostGIS ST_Contains spatial query, ordered by ST_Area ascending
Zone Seeding8 pre-populated global macro-regions + "Unknown Region" fallback
ObservabilityGET /health — concurrent PostgreSQL + Redis ping
SecretsFail-fast RuntimeError on missing env vars at startup
MQTT Bridgemqtt_subscriber.py — forwards MQTT payloads to the secure HTTP pipeline
Edge AIAsynchronous emergency report generation via local Ollama (Llama 3.2)

📱 Frontend (mobile/)

FeatureDetail
FrameworkReact Native (Expo) with TypeScript
NavigationExpo Router — 4-tab Bottom Navigator (Monitor, Sensors Map, My Devices, Settings)
State ManagementZustand slices (usePreferencesStore, useAlertStore)
Server StateTanStack Query + Axios — caching, background refetch, retry
Real-TimeWebSocket context with exponential backoff reconnection
Alert DeliverySOS haptic vibration pattern + OS push notification via expo-notifications
Alert HistoryIn-session feed of last 10 critical events
AI Report BannerInline AI-generated emergency report (summary + recommendations) for the latest alert, with "Report unavailable" badge on failures
Offline ModeToggle silences WebSocket, halts all TanStack Query polling
NotificationsnotificationsEnabled toggle gates haptics and push notifications
Safe Areasreact-native-safe-area-context — Dynamic Island and punch-hole compatible
OTA UpdatesCustom GitHub-based updater hook (useUpdateChecker) polls latest release and triggers native APK sideload prompt

🔐 Security Model

Data integrity is paramount in an emergency system. Every telemetry packet is cryptographically secured end-to-end.

text
ESP32 signs payload with ECDSA NIST256p (SHA256)
         ↓
Backend verifies signature against registered public key
         ↓
Timestamp validated within 300-second window (Anti-Replay)
         ↓
API Key checked on every request (X-API-Key header)
         ↓
Payload accepted → Redis Queue

Threat model coverage:

  • ✅ Man-in-the-Middle (MitM) — ECDSA signature verification
  • ✅ Spoofing — public key registration + signature check
  • ✅ Replay attacks — 300-second timestamp window
  • ✅ Brute force — rate limiting 50 req/s per IP
  • ✅ Unauthorized access — API Key + enrollment token fail-fast

🚀 Quick Start

Prerequisites

  • Docker Desktop & Docker Compose
  • PlatformIO (VS Code Extension)
  • Node.js 18+ & Expo Go (mobile)
  • A mobile hotspot or shared WiFi network for ESP32 + backend connectivity

1. Configure Environment Variables

bash
cd backend
cp .env.example .env

Edit .env and set the required secrets:

env
# --- Application Secrets ---
IOT_API_KEY=your_secret_key
MOBILE_WS_TOKEN=your_ws_token
ENROLLMENT_TOKEN=your_enrollment_token

# --- Database ---
POSTGRES_DB=quakeguard_db
POSTGRES_USER=developer
POSTGRES_PASSWORD=your_db_password
API_PORT=8000

# --- Local MQTT (Mosquitto) ---
MQTT_BROKER=localhost
MQTT_PORT=1883

# --- AI Emergency Reports (hybrid Edge AI architecture) ---
AI_REPORT_ENABLED=true
OLLAMA_HOST=http://127.0.0.1:11434
OLLAMA_MODEL=llama3.2:1b

⚠️ The backend will refuse to start if any of these are missing — this is intentional fail-fast behavior.

💡 Edge AI Architecture (v2.0.0): To maximize hardware efficiency and avoid Docker's GPU passthrough overhead, QuakeGuard employs an industrial Hybrid Edge AI pattern (similar to NVIDIA Jetson or Tesla FSD architectures). The core AI inference engine (Ollama) runs bare-metal on the host Linux OS, while the application microservices run in Docker and communicate via network_mode: "host".

To enable on-premise AI reports:

  1. Install Ollama natively on your Linux host: curl -fsSL https://ollama.com/install.sh | sh
  2. Pull the model natively: ollama pull llama3.2:1b
  3. Start the Docker stack with the AI worker profile: docker compose --profile ai up --build -d

Reports are generated entirely on your machine: telemetry never leaves the host.

2. Launch the Backend Stack

bash
cd backend
docker compose up --build -d
EndpointURL
APIhttp://localhost:8000
Swagger UIhttp://localhost:8000/docs
Health Checkhttp://localhost:8000/health
Grafanahttp://localhost:3000

3. Configure and Flash the IoT Firmware

bash
cd firmware
cp esp32_config.env.example esp32_config.env
# Edit esp32_config.env with your network IP and ENROLLMENT_TOKEN

Flash via PlatformIO. On first boot the device will:

  1. Open a WiFi captive portal (QuakeGuard-Setup) — serves the mobile APK download link and displays the ECDSA Public Key for enrollment
  2. Connect to your network
  3. Automatically register with the backend and receive a sensor_id

💡 If the sensor registers with latitude=0.0, longitude=0.0 it will be assigned to "Unknown Region". Hardcode your coordinates in main.cpp for correct zone assignment until GPS integration is complete.

4. Launch the Mobile App

bash
cd mobile
npm install

Update constants/config.ts with your machine's local IP:

typescript
export const API_BASE_URL = "http://YOUR_LOCAL_IP:8000";

Create .env in the mobile root:

env
EXPO_PUBLIC_IOT_API_KEY=your_secret_key
EXPO_PUBLIC_MOBILE_WS_TOKEN=your_ws_token
bash
npx expo start

Scan the QR code with Expo Go. Ensure your phone is on the same WiFi network as the backend machine.


🧪 Stress Test

Validates the full pipeline: ingestion → Redis → worker → PostGIS → WebSocket alerts.

bash
cd backend
export API_URL="http://localhost:8000"
export NUM_SENSORS=150
export CONCURRENCY_LIMIT=50
python -m tests.stress_test

Three phases:

PhaseWhat it tests
🔥 Phase 1 — Firehose150 concurrent sensors, rate limiter validation
⚔️ Phase 2 — SecurityBad signature blocked (401), Replay attack blocked (403)
🔍 Phase 3 — E2EDB persistence verified via polling GET /sensors/{id}/statistics

A successful run ends with 🏆 SYSTEM CERTIFIED.


🎮 Demo Mode

Trigger a simulated earthquake instantly from Swagger UI without running the stress test:

text
POST /demo/trigger-earthquake

Default payload (works with empty {}):

json
{
  "zone_id": 1,
  "magnitude": 7.5,
  "message": "Simulated Critical Event"
}

This publishes directly to the Redis quake_alerts channel, bypassing the IoT pipeline entirely and triggering the mobile app alert UI within milliseconds.


🗺️ Geographic Zones

The database is pre-seeded with 8 global macro-regions. Sensors are automatically assigned to the correct zone via PostGIS spatial query at registration time.

ZoneCoverage
Italy - NorthLombardy, Veneto, Piedmont
Italy - CenterTuscany, Lazio, Umbria
Italy - South & IslandsCampania, Sicily, Sardinia
Western EuropeFrance, Spain, Germany, UK
North AmericaUSA, Canada, Mexico
South AmericaBrazil, Argentina, Chile
East AsiaChina, Japan, India
Unknown RegionFallback for unmapped coordinates

🔄 CI/CD Pipeline

WorkflowTriggerChecks
backend-ci.ymlbackend/**Bandit, Safety, stress test
frontend-ci.ymlmobile/**ESLint, npm audit
iot-ci.ymlfirmware/**PlatformIO compilation
pr-lint.ymlAll PRsSemantic PR title (type(scope): message)
devops-ci.yml.github/workflows/**Actionlint workflow validation

🗂️ Project Structure

text
QuakeGuard/
├── backend/
│   ├── src/
│   │   ├── main.py              # FastAPI gateway + REST endpoints
│   │   ├── security.py          # ECDSA, API Key, Anti-Replay
│   │   ├── worker.py            # Redis consumer + magnitude + alert engine + AI enqueue
│   │   ├── ai_report_worker.py  # Dedicated AI report consumer (Ollama + state machine)
│   │   ├── ollama_client.py     # Deterministic LLM client (anti-hallucination)
│   │   ├── mqtt_subscriber.py   # MQTT to HTTP bridge
│   │   ├── seed.py              # Geographic zone seeder
│   │   ├── models.py            # SQLAlchemy ORM models (+ EmergencyReport)
│   │   ├── schemas.py           # Pydantic request/response schemas
│   │   └── database.py          # DB engine and session factory
│   ├── tests/
│   │   ├── stress_test.py       # Critical E2E stress test suite
│   │   └── unit/                # Unit tests (worker, ollama client, AI worker, models, ...)
│   ├── init-scripts/
│   │   └── ollama-entrypoint.sh # Auto-pulls the Ollama model on startup
│   ├── build.ps1                # Automatic container publish
│   ├── docker-compose.yml
│   ├── Dockerfile
│   ├── mosquitto.conf
│   ├── grafana/                # Grafana provisioning (datasource + dashboard JSON)
│   ├── requirements.txt         # Python requirements for backend development

🔮 Roadmap

VersionFocus
v1.0✅ Released — edge seismic detection on ESP32, local alerts
v1.1✅ Released — HiveMQ Cloud MQTT (TLS), ngrok HTTPS tunnel, security hardening
v1.2✅ Released — On-Premise AI Worker (Local Ollama / Llama 3.2) for privacy-preserving emergency reports
v1.2.1✅ Released — Geo-Zoning & Cooldown Fragmentation — geohash Redis zone index (FastAPI/PostGIS source of truth), per-area cooldown, GNSS-ready data model (Sensor.last_fix_at, Reading.lat/lon), per-zone live seismograph
v1.2.2✅ Released — Zero-Trust Serial Fallback — signed telemetry over USB CDC (serial) when MQTT is unreachable
v2.0.0✅ Released — Triangulation (multi-node spatial correlation), Hybrid Network Architecture, Automated DevOps Orchestration (Ptyxis), Local Factory Provisioning, GNSS sync, NTP+PPS, ADXL calibration, and INGV FDSN SIL validation
v2.0.1✅ Released — Documentation & Zenodo Sync: PDF/Wiki architectural coherence (Cloudflare, 300s anti-replay), CERN-OHL hardware licensing, SIL vs Firmware threshold clarification, and CITATION.cff bump
v2.1.0✅ Released — System Telemetry & Grafana Observability, Captive Portal, Dynamic Demo Onboarding (QR), OTA In-App Updater, Local Mosquitto architecture, Repository Health: Dependabot, ADRs, C4/sequence diagrams, multi-stage Dockerfile, firmware versioning, pinout, flashing guide, hardware compliance
v2.1.1✅ Released — Demo Calibration & Repository Fixes
v2.2Heterogeneous Edge Intelligence — hybrid Tier A (STA/LTA) + Tier B (quantized CNN) decision fusion
FutureCloud IaC — Kubernetes + Terraform auto-scaling platform (see ROADMAP.md)

#Research — Scientific Validation (SIL)

NodeFocus
#ResearchParallel ongoing node — SIL cross-validation: replay of the exact production C++ STA/LTA core (DetectionCore.h) on the host via the same C++ source, Python-only as orchestrator, ROC metrics + AI benchmarking (latency P50/P99, hallucination rate). R1 pipeline (core isolation, host CLI, orchestrator, metrics, calibration) implemented; see ROADMAP.md

🏆 Awards & Recognition

QuakeGuard's architecture and real-world applicability have been recognized in the following academic and industrial contexts:

  • 🥇 1st Place Overall - Institute Project Day (2025): Awarded best technical project out of ~20 prototypes across four engineering disciplines (Computer Science, Automation, Mechanics, Chemistry) at I.S. Archimede. The full-stack architecture was evaluated and awarded by an industrial jury featuring technical representatives from Siemens, ABB, SORINT.lab, SAME, Ferrero, and Confindustria.
  • 🎓 Academic Origin & Consultation: The system's conceptualization originated during the 2025 CQIIA-MatNet Summer School (Università di Bergamo). The distributed network logic and spatial deployment strategy were subsequently refined following technical consultations with Prof. F. Finazzi.
  • 🥇 1st Place - GF Marilli Competition (2026 - 5th Year Category): Awarded 1st place in the 5th-year category of the Gianfranco Marilli competition at the HackersGen Event, recognizing QuakeGuard for innovation in distributed edge IoT architectures, real-time seismic sensing, and full-stack engineering.

📄 License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See the LICENSE file for details.

Hardware designs (hardware/) are licensed under the CERN Open Hardware Licence v2 — Strongly Reciprocal (CERN-OHL-S-2.0). See hardware/LICENSE for details.

⚠️ Hardware Compliance: The QuakeGuard PCB is not certified for CE/FCC/RoHS. It is intended for prototyping, educational, and research use only. Do not deploy as a commercial safety-critical device without appropriate regulatory certification.


Developed by GiZano and riccardo0731
Open Source — AGPL-3.0 License

Parts

17
QtyValueFootprintReferences
3330ΩResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1, R2, R3
210µFCapacitor_THT:CP_Radial_D5.0mm_P2.50mmC1, C3
10.1µFCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC2
1ADXL345Connector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ3
1BlueLED_THT:LED_D5.0mmD2
1ESP32-C3[L]Connector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ1
1ESP32-C3[R]Connector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ2
1GreenLED_THT:LED_D5.0mmD1
1NEO-6MConnector_PinSocket_2.54mm:PinSocket_1x05_P2.54mm_VerticalJ4
1RedLED_THT:LED_D5.0mmD3

The 13 most common of 17 parts.

Similar boards

  • 2 layers30 × 100 mmMoskill, the printed circuit board in 3D

    Moskill

    telagod/moskill

    MosKill - Smart Mosquito Swatter with BLE, Kill Counting & Statistics | ESP32-C3 + KiCad PCB + UniApp

    95 parts2
  • 2 layers482.6 × 35.6 mmPrecision clock, the printed circuit board in 3D

    Precision clock

    mitxela/PrecisionClock-Hardware

    PCB design for the Precision Clock Mk III

    49 parts41
  • 4 layers62.8 × 97.5 mmOceanAI, the printed circuit board in 3D

    OceanAI

    daniel360kim/OceanAI

    A robotic and software orientated ocean development.

    124 parts14MIT
  • 2 layersNavigatorschema, the printed circuit board in 3D

    Navigatorschema

    maddevsio/mad-navigator

    Mad navigator is simple compass-like device shows direction to predefined geo point. This repository contains firmware source code and schematics for device.

    107 parts14
  • 2 layers130.8 × 53.6 mmGPSDO LCD-2, the printed circuit board in 3D

    GPSDO LCD-2

    EA5IOT/EA5IOT_GPSDO

    GPSDO

    95 parts12GPL-3.0
  • 2 layers50 × 47.5 mmGfc, the printed circuit board in 3D

    Gfc

    atx/gps-freq-counter

    Frequency counter using a GPS receiver PPS output as its reference

    101 parts6MIT
  • 2 layers89.4 × 58 mmTelemetry ESP, the printed circuit board in 3D

    Telemetry ESP

    equipeantares/TelemetriaAuroraIII

    Repositório para desenvolvimento do sistema de telemetria do foguete Aurora III da equipe extracurricular de foguetemodelismo da UNICAMP Antares

    7 parts3
  • 2 layers32.8 × 89.2 mmCutdownMechanism v2, the printed circuit board in 3D

    CutdownMechanism v2

    crnicholson/Cutdown-Mechanism

    Cutdown mechanism for StratoSoar.

    20 parts2

Questions

How big is the QuakeGuard PCB PCB?

It measures 61.3 × 89.6 mm and has 2 copper layers, 1.6 mm thick.

What parts does the QuakeGuard PCB use?

17 parts, built around the ESP32-C3-LYRA, NEO-6M and ADXL345-EP. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the QuakeGuard PCB KiCad files?

From the GiZano/QuakeGuard repository on GitHub, at the commit this page was made from: the board is hardware/QuakeGuard_PCB/QuakeGuard_PCB.kicad_pcb and its schematic hardware/QuakeGuard_PCB.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the QuakeGuard PCB design in my own project?

Its repository publishes it under the AGPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).