The problem
Missing a scheduled dose is one of the most common reasons medication fails to work, and the problem is sharpest for elderly patients who take several pills at different times of day. Phone alarms help only when someone is awake, attentive and nearby — they cannot confirm the pill was actually taken, and they tell the caregiver nothing. This project builds a physical answer: a 28-compartment rotating carousel driven by a 28BYJ-48 stepper motor, timed by a DS3231 real-time clock that keeps ±2 ppm accuracy (datasheet value, 0°C to +40°C) even when the mains supply drops. At each programmed dose time the correct compartment rotates to the chute, a buzzer and an LED remind the patient, and an IR break-beam sensor confirms collection. If the pill is not taken within 30 minutes (design value, configurable), the ESP32 sends a missed-dose alert to the caregiver. A companion web dashboard shows the weekly schedule and a full adherence log. The build exercises real embedded skills — stepper sequencing, I2C RTC interfacing, sensor debouncing, Wi-Fi eventing.
Battery-backed clock that keeps the dose timetable through power cuts; polled over I2C once per second.
Follow the working sequence
How it works
- Dose times are programmed into the ESP32 firmware and mirrored in the DS3231's battery-backed registers; the carousel is loaded with one pill set per compartment.
- The ESP32 polls the DS3231 over I2C once per second; when the clock matches a dose time, it sequences the ULN2003-driven 28BYJ-48 through the exact step count for one compartment in half-step mode (approximately 73 half-steps, design value).
- The buzzer sounds and the LED blinks to remind the patient; the OLED shows the medicine name and dose.
- When the pill drops through the chute, the IR break-beam sensor fires; the ESP32 timestamps the collection and stops the reminder.
- If 30 minutes pass without a beam event (design value), the ESP32 sends a missed-dose alert to the caregiver via the Telegram Bot API and marks the dose missed in the log.
- After each event the ESP32 pushes the timestamped record to the dashboard backend; the dashboard renders the weekly adherence chart and the event log.
Tech stack:
- ESP32-WROOM-32
- DS3231 RTC · I2C
- 28BYJ-48 stepper · ULN2003 driver
- IR break-beam pill sensor
- 5V buzzer · LED indicator
- 0.96-inch OLED status display
- Telegram Bot API (caregiver alerts)
- Web dashboard (schedule + adherence log)
| Parameter | Value |
|---|---|
| Controller | ESP32-WROOM-32, dual-core 240 MHz (datasheet value) |
| RTC | DS3231, ±2 ppm from 0°C to +40°C, ±3.5 ppm from −40°C to +85°C (datasheet values) |
| Stepper motor | 28BYJ-48, 5.625°/64 stride angle, approx. 64:1 gearbox, approx. 4,076 full steps (≈2,048 half-steps) per output revolution (design values) |
| Carousel | 28 compartments, approx. 200 mm diameter, approx. 20 mm deep (design values) |
| Dose coverage | Up to 4 doses per day for 7 days per load (design value) |
| Pill detection | IR break-beam pair across the chute, approx. 3–80 cm adjustable sensing range (typical module; design value) |
| Reminder | 5V buzzer + LED, reminder window 30 min (configurable, design value) |
| Missed-dose alert latency | Within approx. 1 min of the 30-minute window expiring (expected) |
| Connectivity | Wi-Fi 2.4 GHz to home router; alerts via Telegram Bot API (expected) |
| Dashboard | Schedule view, weekly adherence chart, timestamped event log |
| Power | 5V 2A adapter or USB supply (expected); CR2032 keeps the RTC through outages |
| Schedule retention | Battery-backed RTC registers + ESP32 flash; survives power loss (design value) |
Project features
- [RTC-held dose schedule] The DS3231 keeps the dose timetable through power cuts with ±2 ppm accuracy from 0°C to +40°C (datasheet value), so schedules never drift or reset on an outage.
- [28-compartment stepper carousel] A 28BYJ-48 stepper (5.625°/64 stride angle, approximately 64:1 gearbox — approximately 4,076 full steps, or 2,048 half-steps, per output revolution; design values) rotates the carousel exactly one compartment per dose, so a week of up to 4 daily doses is loaded in one go.
- [Buzzer + LED reminders] At dose time the buzzer sounds and the LED blinks for a configurable reminder window, stopping the moment the pill is collected.
- [IR pill-collection confirmation] A break-beam IR sensor across the chute registers the pill actually dropping through, so the log records collection, not just the reminder.
- [Missed-dose caregiver alerts] If the pill is not collected within 30 minutes of the dose time (design value), the ESP32 sends an alert to the caregiver's phone over Wi-Fi.
- [Companion adherence dashboard] A web dashboard shows today's schedule, weekly adherence bars and a timestamped event log of every dose collected, late or missed.
- [Power-loss safe schedule] The dose timetable lives in the RTC's battery-backed registers and the ESP32's flash, so neither an outage nor a reboot loses the schedule.
What is included
- Working 28-compartment carousel prototype (ESP32, DS3231, 28BYJ-48 + ULN2003, IR sensor, buzzer, LED, OLED)
- Complete ESP32 firmware with dose scheduler, stepper sequencing and alert logic
- Wiring diagram and component list with exact part numbers
- Companion web dashboard (schedule view, adherence chart, event log)
- Setup and calibration guide (dose programming, IR sensor alignment)
- Project report PDF (background, RTC timing analysis, methodology, results)
- PPT presentation for final review
- Viva Q&A preparation document (stepper control, RTC interfacing, sensor interfacing, Wi-Fi eventing)
Limitations & prerequisites
- This project is an academic prototype and is not intended to replace certified medical equipment, professional supervision of medication, or clinical decision-making.
- Pills must fit the compartment: approximately 20 mm wide and 12 mm thick tablets (design values); capsules or oddly shaped tablets may jam and are not supported.
- The missed-dose alert needs home Wi-Fi and a working internet connection; reminders still work offline, but the caregiver gets no alert without connectivity.
- Carousel rotation is open-loop stepper control — a jammed compartment is detected only by a timeout, not by position feedback; the buyer must clear jams manually.
- 30-minute missed-dose window and alert latency are design targets; actual timing depends on the Wi-Fi network and Telegram API responsiveness.
- The 28-compartment capacity covers up to 4 doses/day for 7 days; more frequent dosing needs a carousel reload mid-week.
- The 3D-printed carousel is a prototype part — tolerances vary with the printer, so the chute alignment is calibrated per build.
Frequently Asked Questions
Which controller is used and why?
An ESP32-WROOM-32: it has enough GPIOs for the stepper driver, RTC, IR sensor, buzzer, LED and OLED, plus built-in Wi-Fi for the missed-dose alerts — an Arduino Uno would need a separate Wi-Fi module.
How does the schedule survive a power cut?
The DS3231's CR2032-backed registers keep both the time and the alarm timetable; on reboot the ESP32 reads the RTC and resumes the schedule. Timing accuracy is ±2 ppm from 0°C to +40°C (datasheet value).
Does it work without internet?
Dose reminders, carousel rotation and collection logging work fully offline. Only the caregiver missed-dose alert and the live dashboard need Wi-Fi; the alert is queued and retried when connectivity returns (expected behavior).
Can the dose schedule be changed?
Yes — dose times and the missed-dose window are set in the firmware configuration (or over the serial console), and the RTC is reprogrammed automatically. A phone-based scheduling UI is an optional customization, not included in the base build.
Is this a certified medical device?
No. It is an academic prototype demonstrating embedded scheduling, actuation and IoT alerting; it must not be presented as certified medical equipment or a substitute for supervised medication management.
Is this project suitable for a final-year project?
Yes — for Electronics & Telecommunication, Electrical, IoT and Embedded Systems programs. It demonstrates stepper control, RTC interfacing, sensor interfacing, power-loss-safe scheduling and Wi-Fi eventing in one build.
Components & software requirements
- ESP32-WROOM-32
- DS3231 RTC · I2C
- 28BYJ-48 stepper · ULN2003 driver
- IR break-beam pill sensor
- 5V buzzer · LED indicator
- 0.96-inch OLED status display
- Telegram Bot API (caregiver alerts)
- Web dashboard (schedule + adherence log)
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and email — the synopsis PDF downloads immediately. We may send occasional project updates; no spam, unsubscribe anytime.