Medication fails quietly in two ways: people forget doses, and the medicines themselves degrade when stored too warm, too humid, or in direct light. A genuinely useful smart medicine box has to handle both - which makes it a well-shaped embedded systems problem: scheduling and alerts on one side, environmental sensing and physical actuation on the other.
This was a solo project in the Embedded Systems module, simulating the complete device around an ESP32.
What it does
- Medication Reminders: Alerts users to take medication at configured times, via buzzer and LEDs.
- Storage Monitoring: Continuously tracks temperature and humidity so compromised conditions never go unnoticed.
- Light Protection: A servo-driven motorized curtain regulates light entering the box - light-sensitive medicine is protected physically, not just flagged.
- Live Dashboard: A Node-RED dashboard shows conditions and handles control remotely over MQTT.
Design decisions
- ESP32 as the controller: The box has to talk to a dashboard, so a microcontroller with Wi-Fi and the processing headroom built in beats pairing a simpler MCU with a separate radio module.
- MQTT + Node-RED for communication: Sensor readings and commands are small, frequent messages - a lightweight publish/subscribe protocol fits far better than HTTP polling, and Node-RED turns those topics into a live dashboard without building a web app from scratch.
- Simulation first: The system was developed in Wokwi, then transitioned locally to the Arduino framework with PlatformIO - full iteration on circuit design and code before committing to hardware.
Hardware Design
The ESP32 connects to temperature and humidity sensors and a servo motor, along with an LCD display, buzzer, push buttons, and LEDs for local interaction.
Circuit Component Diagram
Software Development
The firmware is structured around three responsibilities:
- Initialization: Setup of all hardware components and initial configurations.
- Main Loop: Continuous monitoring of conditions and managing user inputs.
- MQTT Communication: Sending and receiving data through Node-RED efficiently.
Node-RED Flow Diagram
Future Enhancements
- Mobile App Integration: Remote monitoring and control of the Medibox from a phone.
- Advanced Notifications: SMS or email notifications for reminders.
- Expanded Storage: Logging a longer history of medication intake.
You can run the simulation yourself on Wokwi, or explore the GitHub repository.
