Inspiration
In the United States, about 75% of Americans over the age of 65 take medication and about 50% are nonadherent to the process of taking medication on time (National Library of Medication). This is a huge problem and can be the cause of a lot of hospitalizations from not taking the right medication at the right time. Some patients even have illnesses that keep them from accurately tracking and taking their medication on time. We aim to provide an easy solution to this problem by giving a system that does the tracking for you. Americans will be able to live stress free knowing that the system will dispense the correct number of pills needed at the given time.
What it does
AutoDose is an automated pill dispensing system that takes the burden of medication management off of patients and caregivers. Users add their medications to the app by scanning or entering the NDC code, and AutoDose uses AI to automatically identify the pill, generate a patient-friendly description of the medication, and sort it into the correct physical compartment of the dispenser based on its size. From there, the system handles everything, dispensing the correct pill at the correct time, every time, without any user intervention. A companion mobile app gives caregivers and family members full visibility into the dispensing schedule, medication history, and the ability to manage medications remotely. The app supports both admin and patient accounts, so a caregiver can manage a loved one's medications from their own device while the patient sees a simple, easy-to-understand view of their next dose.
How we built it
AutoDose is built across three tightly integrated layers. The physical dispenser is powered by a Raspberry Pi running a Flask API, which controls the stepper motors that drive each pill compartment. The mobile app was built in FlutterFlow with Firebase Firestore as the backend database, allowing real-time sync between the app and the dispenser. Firebase Cloud Functions handle all of the scheduling logic, a scheduled function runs every minute to check whether any dispenses are due, and fires an HTTP request to the Pi's Flask endpoint via an ngrok tunnel when it's time to dispense. We used the Gemini API to power two AI features: generating plain-English medication descriptions from NDC codes, and automatically classifying each pill into the correct size bucket so the dispenser knows which compartment to use. The admin/patient account system was built using role-based Firestore documents, allowing caregivers to link their account to a patient's account using just an email address.
Challenges we ran into
One of our biggest challenges was networking, getting our Firebase Cloud Functions, which run on Google's servers, to reliably communicate with a Raspberry Pi sitting on a local network. We went through several approaches before landing on ngrok as a tunneling solution. We also ran into CORS issues when testing API calls through FlutterFlow's browser-based preview environment, which required adding Flask-CORS to the Pi's server and configuring ngrok headers correctly. Sorting pills by size using AI was another challenge, the size buckets we needed were extremely close together in some ranges, requiring careful prompt engineering to get Gemini to return consistent, accurate classifications.
Accomplishments that we're proud of
We're proud of building a fully end-to-end working system that spans hardware, mobile, cloud, and AI in a single cohesive product. The integration between the physical dispenser and the mobile app happens in real time, and the AI-powered pill identification and sizing makes the onboarding experience seamless for non-technical users. We're also proud of the caregiver/patient account system, which we think makes AutoDose genuinely useful for the family members and caregivers who often bear the burden of medication management.
What we learned
We learned a great deal about the challenges of building systems that bridge the physical and digital world, particularly around networking, latency, and reliability. We deepened our understanding of prompt engineering for structured AI outputs, especially for classification tasks where consistency matters more than creativity. We also learned how to architect a role-based user system in FlutterFlow and Firebase, and how to use Firebase Cloud Functions to orchestrate scheduled real-world actions reliably.
What's next for AutoDose
We see several exciting directions for AutoDose. First, we want to replace the ngrok tunnel with a more robust and permanent connectivity solution so the dispenser works reliably without manual intervention on reboot. We also want to add push notifications so patients and caregivers are alerted when a dose is dispensed or missed. Longer term, we'd like to integrate with pharmacy APIs so medications can be added directly by scanning a prescription label, and explore partnerships with healthcare providers to make AutoDose part of a broader medication adherence program.
Log in or sign up for Devpost to join the conversation.