- One weekend at HardHack
HardHack 2026 is UCSD's hardware hackathon. Four of us (Brent, Alex, Aarnav, David) built a break-in detection system in a weekend: a model house with a sensored front door, an Arduino reading the sensors, a WiFi gateway pushing everything to MQTT, and an iOS app to arm and disarm it. The hardware went through three architectures before Sunday.
- The house
The physical build was half the work: a door on a servo bolt, an HC-SR04 ultrasonic ranger beside the frame staring across the doorway, a VCNL4040 proximity sensor, buzzer, status LEDs, and boards on the back wall. No photos of it survived the weekend, so the cutaway here is a schematic redrawing: the layout is simplified, the wiring is real. Drag the door or the intruder and the sensor cone measures every 500 ms, exactly like the firmware's SENSOR_READ_INTERVAL_MS.
- Iteration ①: Uno + ESP32-S3 gateway
The Uno owns the sensors and the whole state machine; an ESP32-S3-Mini exists only to give it WiFi. They talk JSON over UART at 9600 baud (S status, A alert, K ack, C config, E error, straight from comm_protocol.h), with a 1 kΩ/2 kΩ voltage divider dropping the Uno's 5 V TX to 3.33 V so it doesn't damage the ESP32's input. An alert crosses the wire in about 50 ms; you can watch it.
- Iteration ②: swap in the R4 WiFi
Same Uno, same protocol, but an Arduino R4 WiFi as the gateway: both boards speak 5 V logic, so the voltage divider goes away and one toolchain covers everything. The campus WPA2-Enterprise network is what fought back: the R4 firmware's comments show the retreat to a personal hotspot.
- Iteration ③: one board to rule them all
By Sunday everything lived on the ESP32-S3: sensors, servo, buzzer, LEDs, WiFi, MQTT. No UART link left to debug. The threshold got retuned from 12 cm to 11 cm, state changes publish straight to the broker, and a 30-pixel WS2812 strip went up along the roofline. Honest detail from the docs: the strip's red→green→blue cycle is deliberately decoupled from the security logic, 'purely aesthetic, runs regardless of system state.'
- WATT'S UP?: the iOS app
The phone side is SwiftUI with CocoaMQTT: an ONLINE pill, a SYSTEM ARMED / SYSTEM SECURE card with the red toggle, a live transmission log, and a Reset Network Link panic button. Flipping ARMED publishes {"type":"C","cmd":"ON"} down the chain: the firmware parses it with indexOf, and a disarmed system logs intrusions but keeps the alarm quiet. The replica here runs the same copy against the simulated broker.
- Rebuilt for this page (2026-08-31)
The simulation is a TypeScript port of the real firmware, written with AI coding tools: the Uno's moving average, the 3-consecutive-readings confirmation, the armed-state gate, and the exact packet strings, table-tested against scripted intrusion sequences. One faithful quirk: the firmware defines four states (NORMAL, ALERT, LOCKDOWN, ERROR) but nothing in the shipped code ever enters the last two. The sim doesn't either.