What it shows
Elderly patients often forget tablets. A seven-compartment box with an RTC alarm, LEDs and lid sensors can remind the user, detect which lid opened and record missed doses for a caregiver. The project designs and tests the device with candy in place of medicine and discusses safety and reliability.
The science
The RTC keeps accurate time using a temperature-compensated crystal and holds it on a coin cell. The microcontroller compares the current time with the schedule. At dose time the LED of that day lights and the buzzer sounds until the reed switch shows that the right lid opened. If no opening occurs within a set time, the event is stored as missed. Debouncing and a state machine avoid false alerts.
Materials
Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- An Arduino Nano or ESP32
- A DS3231 RTC module
- Seven reed switches with small magnets on the lids
- Seven LEDs with 330 Ω resistors and a loud buzzer
- A microSD module or the ESP32 flash for storing logs
- A pill organiser box with seven lids
- A USB power bank
Safety
For this project: Use candy or small beads only for testing, never real medicine. This is a learning prototype, not a medical device, and must not be relied on for real medication. An adult must supervise.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
All the safety rulesStep by step
12 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Interview an elderly relative or caregiver about what a useful reminder looks like and write four requirements.
Draw a block diagram and a flow chart for the alarm, acknowledgement and missed-dose states.
Fix a magnet on each lid and a reed switch in the box so the switch changes state when the lid opens.
Connect the RTC over I2C, the seven reed switches and LEDs through pins or a shift register.
Write code to set the time on the RTC and a schedule table with day and dose times in a header file.
Implement the state machine: idle, reminding, acknowledged and missed with a 30-minute window.
Log each event with date, time and status to the SD card in CSV format.
Add a button that snoozes the buzzer for 10 minutes once, and a long press to silence.
Test with an accelerated clock for a week of doses in an hour and check for errors in the log.
Test power failure by removing the USB cable and check that the RTC keeps time.
Write a Python script that summarises the log into a weekly adherence percentage.
Write the report with the design, tests, safety limits and ethics of monitoring a patient.
What you should see
The box reminds at the right time, accepts the correct lid, records missed doses and survives power loss. The weekly summary shows adherence from the test log.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
1Why use an RTC instead of the Arduino clock?
The microcontroller clock drifts and resets on power loss, but the RTC is accurate and battery backed.
2How does a reed switch work?
Two thin metal contacts in a glass tube close when a magnet comes close.
3Why must the project not be used for real medicines?
A failure could cause a missed or double dose, and medical devices need extensive testing and approval.
4What is debouncing?
Ignoring rapid changes of a switch for a few milliseconds so that one action counts once.
Take it further
Add an ESP32 Wi-Fi message to a family member’s phone when a dose is missed twice in a row.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
