09/20/2015 at 03:13 •
Here's my official semifinals video. Enjoy!
09/16/2015 at 01:37 •
There are a surprising list of APIs for both drug info and barcode lookups. I thought I would put a list of some of the APIs I'm looking into...mostly so I don't forget which ones I have found to be the most useful. The ones in bold seem to have the most promise so far.
Pill shape identification:
Barcode lockup database:
09/14/2015 at 01:14 •
Here I talk about the android app I am working on and the progress I have mede to the UI.
09/07/2015 at 20:03 •
With the fundamental hardware working I have moved on to improving some of the software. The lowest hanging fruit in this case was the scheduling system. You may have noticed in my earlier demo that I have a dummy schedule and the scheduling page has some GUI display problems. Over the weekend I have added a scheduling and log table to the database. A schedule can be created using the form shown below:
Every time a medicine is dispensed it is logged with the time, medicine, and user. The scheduling system checks every minute for schedules that may need to be taken. For example if the schedules needs to be taken once per day at 1PM the log table is checked to see if the medicine has been logged as taken from 1PM today and after. If there is no matching log a message is displayed automatically to the user and the machine plays a sound and spoken message:
Users are given the option to Vend, Snooze, or Cancel. Snoozing will ask again in 5 minutes. Vending will dispense a pill for the user and log it. Canceling will not vent the pill and log the pill as not taken. There may be cases where the user will have not choice to cancel depending on the prescription. This has not been implemented yet. I am, however interested in the big data aspects of this type of log. This data could give us information about what methods are more likely to get a user to take a pill, or which/when medicines are more likely to be ignored.
The new schedule view screen pools the schedules database and get a list of all schedules. It then takes the list and extrapolates the next 10 dates for each med which is displayed on the machine:
All of the complexity is done on the server side (web server in the machine vs. web browser on the machine). This allows for a smart-phone app (in development) to access this data via an easy HTTP-GET / JSON interface. I have finally added a GIT repo for all the code in this project.
08/30/2015 at 23:42 •
Here I start out talking about the two thrusts of the project: The hardware and the software, and compare them to a smart phone and it's cloud ecosystem. Next I talk about loading pills into the machine automatically and various ways I am exploring to do this. Enjoy!
08/29/2015 at 18:48 •
For the cloud integration portion of this project one of the goals is to use prescription APIs for various pharmacies (CVS, Walgreens, etc.) to lookup medicine data from a scanned barcode. This is proving more difficult that I originally expected. Here's some of the information I have gathered so far:
Walgreens Pharmacy Prescription API: Walgreens has a great API for mobile devices (Android/iOS) that allows patients to request refills by either choosing a medicine on their Walgreens account or by scanning a Walgreens barcode. I was able to create an account and get an API key but after reading the fine print: "Prescription APIs are currently only available for integrations on mobile & tablet native applications." This means that I can't do any refill magic (based on inventory in the machine) from my server on the cloud. This isn't the end of the world here because I can still make an android app that interfaces with the Medicine Organizer device as well as the Walgreens prescription API. I can't refill prescriptions from the machine itself, but I can from a smartphone. I have already started to work on a phone app for scanning barcodes and interfacing with the machine. Once I have the basic framework setup I will look into integrating this API into the app.
CVS Prescription API: In theory, CVS should have a a similar API to Walgreens. The documentation is sparse and after several attempts to create a developer account I finally saw an account created success screen. I did not receive an activation email nor can I login with the account I created. FAIL!!! CVS I guess does not have their act together and I will not be pursuing this API any further for now.
eMC: In Europe they have things figured out! There is an online database that has standardized information about every drug available in the EU (thanks for the tip IT-Wizard). The electronic Medicines Compendium (eMC) is an easily searchable database of drugs that supposedly can be searched via barcode. I have been able to search by drug name but not barcode. I also can't find an API that will allow me to access this information from my cloud server etc.
I think what this survey shows is that there is a lot of potential to improve the standardization of access to drug information. A new project goal (for 10+ years form now): create an open-access drug database with API for the world that includes information such as:
- Drug facts
- Drug interactions (with other drugs)
- Recommended dosage information (to compare with doctor's prescription)
- Every drug will have a unique ID number
I think eMC is a good place to start but the differences in American vs. EU health care systems will pose a challenge.
Near term goals:
- Integrate Walgreens API into smartphone app in interface with machine
- Dig deeper into eMC to see if there is an easy way to extract drug info. Perhaps using curl scripts.
08/07/2015 at 03:58 •
In the original design I wanted to use a custom made optical encoder. I decided to spin my own board for this and figured I might as well integrate regulators and a PWM chip to drive the servos. Below is the board layout. On the side back side in blue are the infrared photodiodes that I originally planned to use as an optical encoder through the rotating barrel. There are 8 Servo connection at the top that drive the motors. There are two regulators: one that powers the servos and one that powers the Raspberry Pi. The regulators can be enabled/disabled to shutdown the Pi and save power. They are separated to avoid brownout on the Pi's supply when multiple motors are consuming a lot of power.
Here's the parts list:
- 5 RR1206 IR photo diodes
- 2 MCP1826 5V regulators
- 1 PCA9685 PWM IC
- 2 4.7 uF caps
- 1 10uF cap
- 2 1uF caps
- 5 10k pots
- 8 220-ohm resistors
- 3 10k resistors
- Male headers
Here's the associated schematic:
08/04/2015 at 02:01 •
I'm posting a quick video here of the machine in action. To make things more obvious I am using M&Ms instead of pills because they are colored.
08/02/2015 at 02:50 •
Here's a video of me describing the motivation for the project and an overview of the machine.
07/31/2015 at 01:07 •
The most critical part of this machine is the 3D printer mechanics that actually hold and organize the individual pills. I went through several iterations of this before settling on the current version (that I already want to improve). The first version was a snake of sorts that would slide around the base of the box and could align one of the many individual storage boxes above a pill insertion port. The main challenge I had wasn't getting the pills in but getting them out efficiently.
I went through a couple iterations of the snake version but couldn't converge on anything that worked reliably and could make sure the pills never fall out of their containers by accident.
The latest version I ended up using for this project is based on a rotating barrel. As you can see below in the blown out view, a barrel (blue) with 16x4 slots rotates in a drum (orange). The drum keeps the pills in their individual slots while it rotates. There are holes in the barrel at the bottom and top. Pills can enter the barrel at the top and doors can open to allow the pill to simply fall out with gravity when selected by doors (pink). The selector at the top (green) slides back and forth to select which of the 4 holes to insert the pill into when loaded.
The biggest challenge with actually building this is the tolerances in my 3D printer. For example, when I print the circular barrel it actually ends up being more oval shaped. This makes it hard to maintain a tight tolerance from the drum to the barrel to make sure the pills don't fall out when rotating. Also, the doors at the bottom have to fit perfectly in place to make sure the pills don't get caught at the joints when the drum is rotating. After it was all printed I ended up having to manually un-warp some of the prints and shave off some of the extra material to get the doors at the bottom to fit perfectly.
If you want to explore the design in 3D you can download an STL of the blown out design here: https://www.dropbox.com/s/slu101yfu7tsvtf/full machine blown out.stl?dl=0 and a 123D design file here: https://www.dropbox.com/s/i82wmfc3rblamnl/full_system.123dx?dl=0