Overview
Janus is a hybrid IoT platform that takes on two coexisting roles inside a single device mounted beside the laboratory door. During the school day it acts as an automated classroom logbook: students tap an RFID card or scan a fingerprint, and every successful authentication is written as an attendance record. After hours it switches into an armed intrusion-detection system, and any unauthorized passage through the doorway triggers a local alarm and a GSM-based alert to administrators.
The project is being built for DigiCode 2026 as a flagship example of how Armath students can ship production-quality embedded systems that solve a real institutional problem.
How It Works
The core rule is a 5-second authentication window. When a student presents a card or finger, Janus opens a short window during which a beam-break across the doorway is interpreted as authorized entry. If the beam breaks without a recent successful authentication, or with an authentication that was rejected, the system raises a BREACH event.
This single rule lets one device cleanly serve two purposes: a student fumbling a card three times at the door is logged but never alarms the administrator, while an unknown person walking through the door at 02:00 is detected, recorded, and reported within seconds.
Architecture
The system is structured as four cooperating layers:
- Sensors. R503 fingerprint reader, MFRC522 RFID reader, E18-D80NK IR beam, DS3231 RTC, and a magnetic tamper switch on the enclosure.
- Firmware. An ESP32-WROOM-32 runs an authentication gate, an intrusion detector, a mode manager, a logger, and an alert manager as FreeRTOS tasks so that the sensor loop never blocks on slow operations like SMS dispatch.
- Durability. A microSD card stores every event as NDJSON before anything else happens. SPIFFS acts as a fallback if the SD card is unavailable. Once Wi-Fi returns, pending events are resynced to the cloud.
- Cloud and UI. A Node.js backend with PostgreSQL persists events through both REST and an MQTT bridge. A React and Tailwind Command Center subscribes over WebSockets and renders a live feed, the attendance ledger, and admin controls.
Operating Modes
Janus runs in one of four modes, switchable from the Command Center:
- Attendance — typical school hours. RFID and fingerprint scans log entries, and beam events outside the auth window are flagged but do not alarm.
- Silent — after-hours mode. Any unauthorized beam break is an instant BREACH. Disarming requires two-factor authentication.
- Exam — manual lockdown for assessments. Two-factor entry is mandatory and every event is flagged in the logbook.
- Maintenance — admin-only mode. Alarms are muted, but breaches continue to be logged for audit purposes.
Offline-First Durability
Connectivity is treated as a nice-to-have, never a requirement. Every authentication, rejection, and breach is appended to a local NDJSON log on microSD before any network call is attempted. The DS3231 real-time clock keeps timestamps accurate even when Wi-Fi is down. When the network returns, the logger streams pending events to the backend in order. If the SD card itself fails, SPIFFS on the ESP32 takes over as a fallback so a device-level failure still does not silently drop records.
For alarm dispatch, GSM is the primary alerting channel rather than the secondary one. Even with a clean Wi-Fi connection, breaches are reported by SMS and voice call through the SIM800L, because reaching an administrator's phone is the actual goal — not pushing a row to a database.

