Skip to content

Commit 794b62c

Browse files
remake closed PR 1027 (#1233)
* Create documentation for Automated Pill Dispenser Added documentation for the Automated Pill Dispenser project, detailing its features, architecture, hardware components, software libraries, and links to resources. * add architecture and schematic * Change architecture and schematic images to SVG format Updated image formats for architecture diagram and schematic.
1 parent 5274535 commit 794b62c

3 files changed

Lines changed: 103 additions & 0 deletions

File tree

website/versioned_docs/version-acs_cc/project/2026/alexandra.dinu0302/architecture.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Automated Pill Dispenser
2+
A sensor-verified automatic medication dispenser with dual stepper motor carousel and shutter mechanism.
3+
4+
info
5+
**Author**: Dinu Alexandra \
6+
**GitHub Project Link**: [GitHub Repository](https://github.com/UPB-PMRust-Students/acs-project-2026-alexandraioana3)
7+
8+
9+
10+
## Description
11+
12+
The device dispenses pills from a 7-day rotating carousel according to a preset schedule. A stepper motor rotates the pill box to the correct day, while a second stepper motor controls a shutter disc that opens to release pills by gravity. An IR sensor confirms dispensing, a Hall sensor verifies carousel position, an ultrasonic sensor detects user proximity, and a temperature/humidity sensor monitors storage conditions. The user sets schedules via 3 buttons and an OLED display. A servo motor locks the lid to prevent unauthorized access. All dispensing events are logged to a MicroSD card.
13+
14+
## Motivation
15+
16+
Elderly people and patients with complex treatments frequently forget to take their medication on time. Commercial automated dispensers are expensive and often lack verification mechanisms. This project provides an affordable solution that verifies every step of the dispensing process through multiple sensors, monitors storage conditions, and alerts the user through audio and visual feedback — all without requiring internet connectivity.
17+
18+
## Architecture
19+
20+
![Architecture Diagram](architecture.svg)
21+
The system has three main subsystems connected to the STM32 Nucleo-U545RE-Q:
22+
23+
- **Sensor subsystem** — 4 sensors provide feedback: Hall effect (KY-035, ADC) for carousel homing, IR obstacle sensor (GPIO) for pill detection, HTU21D (I2C) for temperature and humidity, HC-SR04P (GPIO) for user proximity detection.
24+
- **Actuator subsystem** — 3 actuators control dispensing: Stepper motor 1 + ULN2003 (GPIO×4) rotates the carousel, Stepper motor 2 + ULN2003 (GPIO×4) controls the shutter disc, Servo SG90 (PWM) locks/unlocks the lid.
25+
- **Interface subsystem** — OLED SSD1306 display (I2C), DS3231 RTC (I2C) for scheduling, MicroSD card module (SPI) for event logging, active buzzer (PWM) for alarms, 3 push buttons (GPIO) for menu navigation.
26+
27+
All I2C devices (OLED, DS3231, HTU21D) share the same bus on PB6/PB7 with 4.7kΩ pull-up resistors. Communication protocols used: I2C, SPI, GPIO, PWM, ADC.
28+
29+
## Log
30+
31+
### Week 5 - 11 May
32+
33+
### Week 12 - 18 May
34+
35+
### Week 19 - 25 May
36+
37+
## Hardware
38+
39+
The mechanical assembly uses a commercially available 7-day round pill box mounted upside-down on the first stepper motor's shaft. The compartments face downward onto a fixed base plate. A second stepper motor drives a shutter disc beneath the base — when the shutter hole aligns with the active compartment, pills fall through by gravity into a collection tray. A neodymium magnet glued to the carousel triggers the Hall sensor once per revolution for position calibration. The IR sensor at the dispensing window confirms that pills actually fell through. The entire assembly sits inside a box enclosure containing the breadboard, STM32 Nucleo, battery holder, and all electronics.
40+
41+
### Schematics
42+
43+
![KiCad Schematic](schematic_kicad.svg)
44+
45+
### Bill of Materials
46+
47+
| Device | Usage | Price |
48+
|--------|--------|-------|
49+
| [STM32 Nucleo-U545RE-Q](https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html) | The microcontroller | Provided by university |
50+
| [OLED Display 0.96" SSD1306 I2C](https://sigmanortec.ro/en/oled-display-096-i2c-iic-blue) | Displays schedule, status, alerts | [16.96 RON](https://sigmanortec.ro/en/oled-display-096-i2c-iic-blue) |
51+
| [DS3231 RTC Module](https://sigmanortec.ro/en/precision-real-time-module-rtc-ds3231-with-battery-33-5v) | Real-time clock for dose scheduling | [17.98 RON](https://sigmanortec.ro/en/precision-real-time-module-rtc-ds3231-with-battery-33-5v) |
52+
| [HTU21D Temp & Humidity Sensor](https://sigmanortec.ro/en/temperature-and-humidity-sensor-htu21d-i2c-15-36v) | Monitors medication storage conditions | [17.22 RON](https://sigmanortec.ro/en/temperature-and-humidity-sensor-htu21d-i2c-15-36v) |
53+
| [Hall Sensor KY-035](https://sigmanortec.ro/en/senzor-hall-analog-magnetic-ky-035-5v) | Carousel homing and position verification | [4.15 RON](https://sigmanortec.ro/en/senzor-hall-analog-magnetic-ky-035-5v) |
54+
| [IR Obstacle Sensor](https://sigmanortec.ro/en/ir-obstacle-sensor-33-5v) | Detects pills falling through dispensing window | [3.12 RON](https://sigmanortec.ro/en/ir-obstacle-sensor-33-5v) |
55+
| [HC-SR04P Ultrasonic Sensor](https://sigmanortec.ro/en/ultrasonic-sensor-hc-sr-04p-3-55v) | Detects user proximity for display wake-up | [10.14 RON](https://sigmanortec.ro/en/ultrasonic-sensor-hc-sr-04p-3-55v) |
56+
| [28BYJ-48 Stepper Motor](https://sigmanortec.ro/en/stepper-motor-5v-28byj48-with-reducer) ×2 | Rotates carousel and shutter disc | [20.58 RON](https://sigmanortec.ro/en/stepper-motor-5v-28byj48-with-reducer) |
57+
| [ULN2003 Driver Module](https://sigmanortec.ro/en/stepper-motor-driver-module-4-phases-uln2003-5-12v) ×2 | Drives the stepper motors | [9.94 RON](https://sigmanortec.ro/en/stepper-motor-driver-module-4-phases-uln2003-5-12v) |
58+
| [SG90 Servo Motor 180°](https://sigmanortec.ro/en/servo-motor-sg90-with-limiter) | Locks/unlocks the lid | [9.49 RON](https://sigmanortec.ro/en/servo-motor-sg90-with-limiter) |
59+
| [Active Buzzer 5V](https://sigmanortec.ro/en/active-buzzer-5v) ×2 | Audible alarm for dose reminders | [2.22 RON](https://sigmanortec.ro/en/active-buzzer-5v) |
60+
| [Mini Button 6×6×5mm](https://sigmanortec.ro/en/mini-button-6x6x5-4-pins) ×4 | Menu / Up / Down navigation | [1.44 RON](https://sigmanortec.ro/en/mini-button-6x6x5-4-pins) |
61+
| [MicroSD Card Module SPI](https://www.optimusdigital.ro/ro/memorii/1516-modul-slot-card-microsd.html) | Logs dispensing events in CSV format | [~7.00 RON](https://www.optimusdigital.ro/ro/memorii/1516-modul-slot-card-microsd.html) |
62+
| [Breadboard MB102 830pts](https://sigmanortec.ro/en/breadboard-mb102-830-puncte-transparent) | Prototyping platform | [16.66 RON](https://sigmanortec.ro/en/breadboard-mb102-830-puncte-transparent) |
63+
| [Breadboard Power Supply](https://sigmanortec.ro/en/sursa-alimentare-33v-si-5v-pentru-breadboard) | Regulates power to 3.3V and 5V rails | [6.69 RON](https://sigmanortec.ro/en/sursa-alimentare-33v-si-5v-pentru-breadboard) |
64+
| [4×AA Battery Holder](https://sigmanortec.ro/en/suport-baterii-aa-4aa-cu-capac-si-intrerupator) | Power source (6V) | [6.34 RON](https://sigmanortec.ro/en/suport-baterii-aa-4aa-cu-capac-si-intrerupator) |
65+
| [Varta AA Batteries ×8](https://www.emag.ro/baterii-alcaline-varta-helps-longlife-power-aa-6-2-buc-4906121428/pd/DRFZL2MBM/) | Powers the system | [13.18 RON](https://www.emag.ro/baterii-alcaline-varta-helps-longlife-power-aa-6-2-buc-4906121428/pd/DRFZL2MBM/) |
66+
| [TP4056 Charging Module](https://sigmanortec.ro/en/lithium-battery-charging-module-tp4056-typec-5v-1a-with-protection) | Optional LiPo charging | [4.72 RON](https://sigmanortec.ro/en/lithium-battery-charging-module-tp4056-typec-5v-1a-with-protection) |
67+
| [Resistor Kit 600pcs](https://sigmanortec.ro/en/resistors-kit-30-values-600-pieces-1-4w-10r-1m) | Pull-up resistors for I2C, button pull-downs | [15.16 RON](https://sigmanortec.ro/en/resistors-kit-30-values-600-pieces-1-4w-10r-1m) |
68+
| [Dupont Wires MM 30cm ×40](https://sigmanortec.ro/en/40-fire-dupont-30cm-tata-tata) | Breadboard connections | [8.39 RON](https://sigmanortec.ro/en/40-fire-dupont-30cm-tata-tata) |
69+
| [Dupont Wires FM 10cm ×40](https://sigmanortec.ro/en/40-fire-dupont-10cm-tata-mama) | Module-to-breadboard connections | [7.73 RON](https://sigmanortec.ro/en/40-fire-dupont-10cm-tata-mama) |
70+
| [Dupont Wires FF 30cm ×40](https://sigmanortec.ro/en/40-fire-dupont-30cm-mama-mama) | Module-to-module connections | [7.59 RON](https://sigmanortec.ro/en/40-fire-dupont-30cm-mama-mama) |
71+
| [Neodymium Magnets 5×2mm ×20](https://www.emag.ro/set-magneti-rotunzi-puternici-neodim-5x2-mm-argintii-20-buc-ebn2481/pd/D2R1YT3BM/) | Position marker on carousel for Hall sensor | [24.16 RON](https://www.emag.ro/set-magneti-rotunzi-puternici-neodim-5x2-mm-argintii-20-buc-ebn2481/pd/D2R1YT3BM/) |
72+
| 7-Day Round Pill Box | Carousel body (7 wedge compartments) | 3.81 RON |
73+
74+
## Software
75+
76+
| Library | Description | Usage |
77+
|---------|-------------|-------|
78+
| [embassy-stm32](https://github.com/embassy-rs/embassy) | HAL and async runtime for STM32 | GPIO, I2C, SPI, PWM, ADC peripheral access |
79+
| [embassy-executor](https://github.com/embassy-rs/embassy) | Async task executor | Runs 6 concurrent tasks: scheduler, motor control, sensors, display, proximity, logging |
80+
| [embassy-time](https://github.com/embassy-rs/embassy) | Async timers and delays | Non-blocking delays for stepper stepping, sensor polling, alarm timeouts |
81+
| [ssd1306](https://github.com/jamwaffles/ssd1306) | OLED display driver | Renders schedule, status pages, and alerts on the 0.96" I2C display |
82+
| [ds323x](https://github.com/eldruin/ds323x-rs) | DS3231 RTC driver | Reads current time, sets alarm times for dose scheduling |
83+
| [embedded-sdmmc](https://github.com/rust-embedded-community/embedded-sdmmc-rs) | SD card FAT32 filesystem driver | Writes timestamped dispensing events to CSV files via SPI |
84+
| [embedded-hal](https://github.com/rust-embedded/embedded-hal) | Hardware abstraction layer | Standardized interfaces for GPIO, I2C, SPI, ADC peripherals |
85+
| [defmt](https://github.com/knurling-rs/defmt) + [defmt-rtt](https://github.com/knurling-rs/defmt) | Logging framework | Structured debug logging via RTT during development |
86+
| [panic-probe](https://github.com/knurling-rs/probe-run) | Panic handler | Prints panic info and backtraces via RTT probe |
87+
88+
## Links
89+
90+
1. [Embassy-rs — Async framework for embedded Rust](https://github.com/embassy-rs/embassy)
91+
2. [SSD1306 OLED driver crate](https://crates.io/crates/ssd1306)
92+
3. [DS323x RTC driver crate](https://crates.io/crates/ds323x)
93+
4. [Embedded SDMMC crate](https://crates.io/crates/embedded-sdmmc)
94+
5. [PM Rust Course — Lab 01](https://pmrust.pages.upb.ro/docs/acs_cc/lab/01)
95+
6. [PM Rust Course — Lab 02](https://pmrust.pages.upb.ro/docs/acs_cc/lab/02)
96+
7. [PM Rust Course — Lab 03](https://pmrust.pages.upb.ro/docs/acs_cc/lab/03)
97+
8. [28BYJ-48 Stepper Motor Datasheet](https://components101.com/motors/28byj-48-stepper-motor)
98+
9. [HTU21D Sensor Datasheet](https://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&DocId=Data+Sheet%7FHPC199_6%7FA6%7Fpdf%7FEnglish%7FENG_DS_HPC199_6_A6.pdf%7FCAT-HSC0004)

website/versioned_docs/version-acs_cc/project/2026/alexandra.dinu0302/schematic_kicad.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)