From a BusyâIndicator to a BLEâEnabled Home Automation Device: A Case Study in OverâEngineering
The author describes how a simple annoyanceâfamily members interrupting work timeâled to the design of a custom device that reports camera status, remaining meeting time, and more. Using an ESP32, an OLED display, mDNS, and a bespoke binary protocol, the project evolved from a quick hack to a professionally packaged solution. The narrative highlights the tradeâoffs between software and hardware, the learning curve of 3âD modeling, and the temptation of overâengineering.
The impetus for this project was an everyday inconvenience: a parent repeatedly entered a homeâoffice space during a video call. The author needed a reliable way to signal the presence of an active webcam and the remaining duration of a meeting. Conventional approachesâshared calendars or phone callsâproved inadequate because the parent often lacked a phone, and not all interactions were scheduled.
### The Initial Hack
An abandoned ESP32 module and a personal computer were the starting points. The goal was to surface the webcam status on a small screen nearby. The author built a minimal server in Bun that monitored macOS system logs for the notification strings âAVCaptureSessionDidStartRunningNotificationâ and âAVCaptureSessionDidStopRunningNotificationâ via the `log stream` command. When the ESP32 polled the server every halfâsecond, the OLED display would blink green or red to indicate whether the camera was running. This simple prototype succeeded, demonstrating that the hardware was capable of exposing the desired state.
### Escalating Complexity
#### Dynamic IPs and mDNS
The hardware design was limited to a local address that changed whenever the router assigned a new IP. The author leveraged mDNS to expose a persistent hostnameâe.g., âApoorvsâMacBookâPro.local:1337ââthus decoupling the device from the networkâs DHCP churn.
#### Eliminating Polling: BLE
Polling was bandwidthâinefficient and introduced latency. Rewriting the communication stack to use Bluetooth Low Energy allowed the Mac to push updates to the ESP32 asynchronously. BLEâs connectionâbased model also added the potential for proximity sensing via RSSI values.
#### Custom Binary Protocol
JSON packets are convenient but verbose. The author designed a minimalistic, singleâbyte protocol called DoorFrame. A twoâbyte handshake (âDFâ as a magic byte and a version number) initiated communication. Subsequent packets carried status codes such as 0xC0 (camera off) and 0xC1 (camera on), and encoded time in a compact form: an hour byte (offset from midnight) and a minute byte (5âminute increments). The protocol was documented in a short RFC, and edgeâcase handling was developed with the help of an LLM.
### Hardware Design
Having a floating ESP32 and display was unsightly. The author returned to 3âD printing after months of avoiding mechanical work. Using Fusion 360, sketches, extrusions, and chamfers were learned through video tutorials, and digital calipers ensured millimetreâlevel tolerances. The first iteration produced a snapâfit enclosure that held the board securely; minor gaps were patched with transparent tape, proving that iterative design was more valuable than perfection at this stage.
### OverâEngineering as a Mindset
The author intentionally pursues extra features: custom macOS menuâbar icons inspired by SF Symbols, animated wave effects for connection status, and a future roadmap that might include facial recognition or audio alerts. While these additions appear excessive for a singleâuser solution, they serve as an educational exercise in bridging software and hardware, and in cultivating a âprofessionalâ mindset that values polish and thorough documentation.
### Lessons Learned
* **Hardware constraints demand disciplined design**: Physical tolerances, power supply stability, and signal integrity are not as forgiving as software abstractions.
* **Protocol design balances readability and efficiency**: A 2âbyte header plus singleâbyte commands can dramatically reduce bandwidth and simplify parity checks.
* **Continuous learning is essential**: The author reâengaged with CAD, network protocols, and BLE programming after a long hiatus, demonstrating that multidisciplinary fluency is a valuable asset.
### Conclusion
The current device, now integrated into the homeâoffice doorway, reliably indicates webcam status and meeting time, and can be powered through the laptopâs USB port for instant shutdown upon leaving the room. Future enhancements are open to discussion, but the core architecture already showcases a fully functional, selfâcontained system that marries embedded hardware with desktop software. The project stands as a testament to turning a simple annoyance into a showcase of engineering curiosity, disciplined problemâsolving, and a taste for overâengineering.