Inspiration
Prescription medication misuse is a widespread but often overlooked problem, especially with controlled substances like opioids or ADHD medication that can be taken more often than prescribed, shared, or accessed without oversight. I wanted to build something that added real accountability to medication access — without requiring a phone app, an account, or a cloud connection. A simple locked box felt like the right form factor, but I wanted the security to be smarter than just a static PIN that anyone could memorize or share.
What it does
Secure Pill Locker is a hardware lockbox that generates rotating access codes to control who can open it and when. Instead of a fixed PIN, it uses a Time-Based One-Time Password (TOTP) algorithm — the same technology behind two-factor authentication apps — so a valid code only works within a short time window before it expires. Users enter their code on a physical keypad, see feedback on an LCD display, and a servo motor unlocks the box only when the code matches.
How I built it
I used an ESP32 microcontroller as the brains of the system, since it had enough processing power to run the TOTP algorithm locally while also handling keypad input and LCD output in real time. The servo motor was mounted to a custom locking mechanism that I modeled in CAD and 3D-printed from scratch, so the box wasn't just breadboarded electronics — it was a fully enclosed, physical prototype. I wired the keypad and LCD to the ESP32, wrote the firmware to handle input validation and code generation, and iterated on the locking mechanism design until it reliably held under the servo's torque.
Challenges I ran into
Getting the TOTP algorithm to run correctly on the ESP32 was harder than expected, since time-based codes require accurate, synchronized clock timing — any drift between the generator and the device would cause valid codes to fail. I also went through several iterations of the 3D-printed locking mechanism, since my early designs didn't have enough clearance for the servo arm to fully engage or release the latch.
Accomplishments that I'm proud of
I'm proud that I built a complete, working hardware system — not just a software demo — in a single hackathon weekend, entirely on my own. Every part of the stack, from the security algorithm to the physical locking mechanism, was something I designed and implemented myself, and by the end of the event, the full prototype worked end-to-end: entering a valid code physically unlocked the box in real time.
What I learned
I learned how time-based authentication systems work under the hood, and how much small details — like clock synchronization — matter when adapting a software security concept into embedded hardware. I also got hands-on experience with the full hardware development cycle: modeling a mechanical part, 3D-printing it, and integrating it with live embedded firmware, rather than just simulating it.
What's next for Pill Locker
Next steps include adding a companion mobile app so a caregiver or pharmacist could remotely manage access schedules, adding a tamper/alert sensor that notifies a caregiver if the box is forced open, and moving to a more compact, production-ready enclosure design suitable for real household use.
Log in or sign up for Devpost to join the conversation.