MEDICINE SORTING MACHINE
microcontroller & digital circuit
OVERVIEW
- Automated daily pill sorting to prevent missed doses across four time slots (morning, noon, evening, bedtime).
- Designed a low-cost dispenser that identifies the active slot, dispenses the set number of pills, and returns to home.
- Developed a cartridge and track system with a geared wheel for single-pill dispensing, adaptable with hole sizes for different pill types.
- Implemented drivetrain with TT motor for track movement; servos for opening/closing the cartridge lid; distance/laser sensors and photogates for position detection.
- Programmed Arduino controller with keypad interface; added logic circuit with Schmitt trigger to encode four photogate signals into digital inputs.
CIRCUIT DESIGN
ENCODER LOGIC DIAGRAM
CIRCUIT LOGIC
Four photogate signals (Y3…Y0, 1 = light, 0 = blocked) are encoded to digital outputs (A1, A2) with a validity flag (V):
| Y3 | Y2 | Y1 | Y0 | A1 | A2 | V |
|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 1 | x | x | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 0 | 0 | 1 | 1 | 1 |
CONTROL LOGIC
- Home: Return carriage to start (TT motor for a fixed duration) and confirm with sensor.
- Open: Servo opens cartridge lid.
- Select slot: Read encoded photogate state → active time slot (morning / noon / evening / bedtime).
- Dispense: For the entered dose count, rotate the geared wheel to drop pills one by one (A/B types supported).
- Advance: Drive to the next slot; repeat until all scheduled slots are served.
- Close: Servo closes lid and return to home.
DEMO VIDEO
SUMMARY
- Built a working dispenser with reliable position sensing and per‑slot dosing.
- Next: add basic machine vision for pill classification, increase supported medicines, integrate reminders, and support multiple cartridge types.