Dose Guard

A weekly pillbox that checks the refill.

Dose Guard verifies a 7-day pillbox after you fill it. A camera counts the pills, load cells weigh each day, and a phone app tells you whether that compartment matches the schedule.


Inspiration

Weekly pillboxes are supposed to make medication simpler. The risk moves to Sunday night: the wrong pill, the wrong count, or an empty Thursday, sitting there until someone takes the dose.

We wanted a check that happens at refill time, not at swallow time. Not a robot that dispenses pills. A box you already use, that can tell you if Monday is actually Monday.


What it does

  1. Build the week. Add medications in the app (type them in or scan a demo barcode). Pick days, dose times, and pills per dose. Each compartment is one full day.
  2. Fill the bin. The app shows what that day should contain, including expected pill counts and expected weight.
  3. Verify. The laptop backend blinks that day’s LED, then runs the camera and the scale at the same time.
  4. See the result.
    • Verified - both checks ran and matched
    • Mismatch - a count or the weight disagreed
    • Needs review - nothing disagreed, but a sensor could not run

Passing means the configured count and weight matched. It does not guarantee medication safety.

The three pills the vision model knows today are Vitamin B12, Vitamin D3, and Ibuprofen.


How we built it

Three layers on one desk, talking over USB and the local network.

Hardware

  • Weekly pillbox, one compartment per weekday
  • Arduino Mega
  • Seven HX711 load cells (one under each day)
  • Seven indicator LEDs
  • Overhead webcam, with each day mapped to a rectangle in the frame

Laptop backend (Python / FastAPI)

  • Keeps the webcam open and talks to the Mega over serial
  • Sends frames to a local Roboflow YOLO model
  • Votes across several frames so a single glare or a passing hand does not decide the count
  • Waits for the load cell to settle, then compares grams to the expected weight (±0.06 g)
  • Returns one decision the phone only displays

Mobile app (Expo / React Native)

  • Home, medications, weekly pillbox, and per-day results
  • Computes expected contents from the schedule
  • Stores medications and verification history on the device

Why two sensors. The camera can name a pill and miss one under glare. The scale cannot name a pill, but it notices missing or extra mass. We only say verified when both checks actually ran.


Challenges we ran into

  • Tiny mass, noisy cells. A pill is a fraction of a gram. We had to calibrate each cell, tare empty bins, and refuse a reading until several samples agreed.
  • Vision in a real box. White pills, shiny plastic, and a hand in frame all fool a single snapshot. Multi-frame voting and fixed compartment regions helped; the camera still has to stay in the pose it was calibrated for.
  • Two clocks, one answer. Camera and scale fail independently. A dead webcam cannot become a pass, so unavailable checks are “needs review,” not “verified.”
  • Keeping the phone honest. The app owns the schedule. The backend owns the sensors. If the schedule changes after a check, that day’s result is marked outdated.

Accomplishments that we're proud of

  • A full path from “this is what Thursday should hold” to a plain-language result and an LED you can see across the room
  • Dual-check logic that fails closed: mismatch if anything disagrees, needs review if a sensor is down
  • Firmware, calibration sketches, region calibration, and a live camera preview — not only a demo UI
  • An app that turns a medication list into a weekly box someone can actually fill against

What we learned

  • Verification is a product decision, not just a model. The interesting work was when to say yes, when to say no, and when to refuse to decide.
  • Hardware time is mostly calibration: load-cell factors, camera regions, lighting, and a box that does not slide.
  • Two weak signals that disagree are more useful than one confident guess.

What's next for Dose Guard

  • Wire the in-app Verify screen all the way to the backend
  • Finish history and device settings (backend URL, tare, camera/scale status)
  • More pill classes, better lighting, and a fixed enclosure
  • Weigh a pill from the bottle instead of using a hard-coded grams-per-pill value
  • A caregiver view of the week

Built with

  • App: Expo, React Native, TypeScript, Expo Router, Expo Camera
  • Backend: Python, FastAPI, OpenCV, pyserial
  • Vision: Roboflow (YOLO), local inference server
  • Firmware: Arduino Mega, HX711 load cells

Built With

Share this project:

Updates

Submission history