15. System Integration

This week's assignment is to document how the final project works as a complete system. For this version, the project became a simpler and more realistic pill dispenser: one rotating carousel, one stepper motor, a real-time clock, an OLED screen, a passive buzzer, two tactile buttons, and a removable magnetic acrylic cover.

The project: Pill Dispenser

The Pill Dispenser is an assistive device for my grandfather. It reminds the user when it is time to take medication, but it does not drop the pills automatically. The alarm sounds first, and only after the user presses the blue confirmation button does the carousel rotate and dispense one dose. This makes the interaction safer because pills are not left exposed if the user did not hear the alarm.

Scope change: from 31 days to 16 days

The initial idea was a 31-day dispenser, and I explored versions for two daily doses. However, a 31-day dual-dose system became too large and mechanically complex for the final build time. The final prototype is a 16-day single-ring dispenser. This keeps the project functional, testable, and easier to refill. In the future, the same logic could scale into two 16-slot rings for a 32-day single-dose cycle, or four 16-slot rings for two daily doses across a full month.

System architecture overview

The system is built around my custom XIAO ESP32-C6 hub board. The board controls the stepper motor, reads the RTC time over I²C, updates the SH1106 OLED screen, drives the passive buzzer, and reads the physical buttons.

Motion

28BYJ-48 + ULN2003

Rotates the 16-day carousel one compartment at a time

Mechanism

Gravity opening

No servo trapdoor; pills fall when the selected slot reaches the fixed opening

Optional sensing

Line / IR sensor

Can be added to detect if pills fell into the tray

Controller

XIAO ESP32-C6

Custom PCB
I²C bus · GPIO
USB-C power

Display

OLED SH1106

Shows current time, date, alarm screen, and dispense status

Time

RTC DS3231

Keeps accurate time with CR2032 backup battery

Interaction

2 tactile buttons + buzzer

Blue confirms and dispenses; red is for snooze, skip, or settings

Mechanical concept

The carousel has 16 compartments. A transparent acrylic cover closes the front and has a fixed dispensing opening. The cover is held with magnets, so it can be removed for refilling without tools. The base is made from CNC-cut plywood and supports the mechanism and electronics.

I originally explored a servo-driven sliding door and a two-dose 31-day mechanism, but I discarded that route because it required more pins, more space, and more moving parts. The final mechanism uses gravity instead: the stepper rotates the carousel until the next compartment reaches the opening.

Gear concept

The carousel is driven by an internal gear system: a 32-tooth ring gear and an 8-tooth pinion, both module 2. This gives a 4:1 gear ratio. With the 28BYJ-48 and AccelStepper, one compartment is treated as 512 steps, which makes the movement simple to control in firmware.