Site under construction

Automatic Pill Dispenser

This project originates from a previous version I made on high school for my grandfather, who takes the same medications every day. However sometimes he forgets to take them, and most of the time only my mother or his caregivers know exactly which pills he needs and whether he has already taken them.

Sometimes other family members and I help with refills or by bringing him his medication during breakfast/dinner, but we do not always know the routine with complete certainty. Even when the medication is the same (there might be some changes from time to time depending on the doctor's instructions), the pill presentation can change depending on the pharmacy where it was bought, which makes it harder to identify each dose only by appearance.

This is why I decided to make a motorized pill dispenser for my final project. It was thought to support people who take medication at the same times for long periods, while also making the routine clearer for the family members or caregivers who help them. The device has a carousel with 16 compartments, but since one space is used as the dispensing opening (dispensing ocures thanks to gravity when the compartment is aligned with the opening), it can hold up to 15 single doses or (7 1/2 days when AM and PM doses are needed).

The system does not dispense automatically without the user. When the RTC reaches a programmed alarm time, the buzzer keeps the reminder active until the user either confirms the dose or postpones it if there is a temporary issue. After confirmation, a 28BYJ-48 stepper motor advances the carousel to release the scheduled compartment. A XIAO ESP32 controls the mechanism, drives an OLED display, reads the buttons, and hosts its own WiFi Access Point so the schedule can be configured locally.

Use case Long-term medication routines with fixed schedules
Capacity 15 single doses, or 7.5 days with AM and PM doses
Interaction Alarm stays active until confirmation or postponement
Controller XIAO ESP32, RTC, OLED, buttons, buzzer, local WiFi Access Point
Motion 28BYJ-48 stepper motor advances the dispensing carousel
Fabrication 3D printing, laser cutting, CNC routing, PCB milling
Automatic pill dispenser final prototype

Presentation Deliverables

Project summary presentation slide

Project summary slide

One minute presentation video

Final Prototype Gallery

Project Overview

Problem

People with long-term medication routines often depend on memory, paper schedules, or caregivers to take the right dose at the right time. This can lead to missed doses, repeated checking, and uncertainty around whether a dose was already taken.

Proposal

A compact motorized dispenser stores pills in individual compartments, keeps the alarm active until the user responds, and releases a dose only after physical confirmation.

Design Goal

The device should feel understandable and safe: it should remind without being easy to ignore, allow postponement when needed, and be configurable through its own local WiFi Access Point.

Early reference prototype

The idea started with a high school prototype: a flat seven day pill organizer with three doses per day. It was mechanical and had no automation. The Fab Academy version transforms that idea into a timed electronic system with alerts, confirmation, and controlled dispensing.

Fab Academy Key Questions

1

What will it do?

It reminds the user to take medication and dispenses one programmed dose after confirmation.

2

Who has done what beforehand?

Commercial pill dispensers exist, but this prototype explores a custom fabricated vertical carousel.

3

What will I design?

The enclosure, carousel mechanism, custom PCBs, wiring strategy, firmware, and interface flow.

4

What materials and components will be used?

PLA, plywood, acrylic, XIAO ESP32C6, RTC module, OLED display, buzzer, buttons, and stepper motor.

5

Where will they come from?

Fab Lab inventory, local suppliers, online electronics stores, and reused materials when possible.

6

How much will they cost?

The estimated prototype cost is around 1,060 MXN, excluding tools already available in the lab.

7

What parts and systems will be made?

The rotating pill ring, base, cover, custom electronics, firmware, and local configuration interface.

8

What processes will be used?

Computer aided design, 3D printing, laser cutting, CNC machining, PCB milling, soldering, and programming.

9

What questions need to be answered?

How reliable the dispensing movement is, how clear the alert is, and how easy the device is to refill.

10

What is the schedule?

Design, fabricate, test electronics, integrate firmware, assemble the prototype, document, and present.

11

How will it be evaluated?

The alarm must trigger on time, the button must confirm, the motor must advance, and the dose must fall.

12

What safety issues apply?

This is an assistive prototype, not a certified medical device. A person still confirms each dose.

13

How is it licensed?

The documentation is shared under CC BY NC SA 4.0.

Design Development

Early Concepts and Sketches

The first sketches explored flat carousels, side loading trays, and vertical stacking. The selected direction was a vertical cylinder with a rotating compartment ring because it reduces footprint and keeps the mechanism compact.

Electronics and Production

The electronics are organized around a modular ESP32 based architecture. The central PCB carries the XIAO ESP32C6, the stepper driver, the buzzer, buttons, and the main connectors. A smaller I2C hub board connects the OLED and RTC to the controller with cleaner wiring.

Central PCB

Designed in KiCad and milled on the Roland MDX 20 as a single sided copper board.

I2C Hub

Groups the RTC and OLED connections into a compact removable bus board.

Motor Driver

Controls the carousel stepper motor so the dispenser advances one compartment at a time.

Firmware and Interface

The firmware integrates the RTC, OLED, buzzer, buttons, stepper motor, and an offline web interface hosted by the ESP32. The interface allows a caregiver to set the alarm time from a phone connected to the local access point.

Core behavior

The clock checks the programmed time, activates the alert, waits for the blue confirmation button, advances the carousel, and then returns to the idle display.

System Integration

Integration brought together the fabricated structure, custom PCBs, firmware, wiring, and final enclosure. The wiring is routed through the CNC milled base to keep the outside clean, and the acrylic cover can be removed for refilling.

Assembly

PLA parts were sanded, fitted, and tested with the plywood base and acrylic cover.

Cable Routing

Stepper and I2C wires run through internal channels to reduce visible wiring.

Final Test

The prototype was tested for alarm timing, button confirmation, motor movement, and dispensing.

BOM and Files

Component Purpose Qty Source Cost MXN
XIAO ESP32C6Main controller1Seeed Studio or Amazon MX$380
DS3231 RTC moduleReal time clock1Amazon MX$95
SH1106 OLED 128 x 64User display1Amazon MX$110
28BYJ 48 with ULN2003Carousel motor1Amazon MX$80
Passive buzzerAlarm sound1Lab inventory$15
Tactile push buttonsConfirm and snooze2Lab inventory$10
FR1 copper boardPCB substrate1 sheetFab Lab Puebla$60
PLA filament3D printed parts120 gFab Lab Puebla$70
3 mm acrylic sheetLaser cut cover1 pieceFab Lab Puebla$45
9 mm plywoodCNC routed base1 pieceFab Lab Puebla$50
Neodymium magnetsCover closure4Amazon MX$40
JST connectorsModular wiring1 bagAmazon MX$55
M3 screws and nutsAssembly hardware1 packHardware store$50
USB C 5 V chargerPower supply1Already owned$0
Total estimated$1,060 MXN

License

This project is documented under the Creative Commons Attribution Non Commercial Share Alike 4.0 license. Project files are available separately and can be added to this section as direct download links.

Conclusions and Learning Outcomes

Digital Fabrication

I combined 3D printing, laser cutting, and CNC routing in one integrated object.

Electronics Production

I designed, milled, soldered, and tested custom PCBs for the final system.

Embedded Programming

I integrated timekeeping, display output, sound, motor control, buttons, and networking.

System Integration

I learned how much precision is needed when separate parts become one finished prototype.

Parametric Modeling

I used adjustable dimensions to manage tolerances across printed iterations.

Networking

I created a local ESP32 interface that can be accessed from a phone without internet.

Future Improvements