IoT pill dispenser with alerts to ensure compliance

Similar projects worth following
A bench top pill (medicines) dispenser which is connected to the internet via wifi allowing for remote configuration and monitoring to ensure compliance when taking prescription drugs.
Specifically the device will allow a carer to load cartridges with pills, program a schedule for the dispensing of those pills and receive alerts if those pills are not taken on the prescribed schedule.
The unit contains a 'dump gate' which is designed to discard tablets, if those tablets have not been taken in the allowed timeslot. The dump gate is intended to avoid possible overdoses.
The unit is designed to assist the elderly or disabled to live independently whilst ensuring that they are correctly receiving their prescribed mediation.
The unit will take advantage of current smart phone technology to enable simple control and management of the unit when onsite.
The unit is designed to take a variety of cartridge configurations (with the possibility of using multiple cartridges) .

With an ageing population in the developed world, the costs of care are ever increasing. Providing solutions to elderly people so they extend the period in which can live an independent life, will increase their enjoyment of life, whilst reducing the ever increasing burden on the world's health care systems.

Over the xmas period my 14 yo son and I took a long bush walk along the south eastern coast of New South Wales and started brain storming ideas for a project we could work on together.

I have for some time, tried to seed the idea that the going to university and getting a job is not the only way through life and that starting your own business is a viable alternative.

The aim therefore of our brain storming session was to identify and develop a project that we could possible turn into a business.

This started a conversation about where the growth markets lay. The burgeoning ageing populations and associated problems soon became a topic of discussion.

I was already aware that there significant issues with medication compliance. As it turns out the issue is far more severe that I had assumed. According to Feinstein AR. 'On white-coat effects and the electronic monitoring of compliance' there are some 125,000 deaths per year and an estimated 183 million unnecessary medical visits occur per year due to non-compliance.

With the ever increasing size of our ageing population and the ongoing increase in life expectancy, this problem will only grow.

There are also specific issues in the ageing population with elderly people that suffer from Dementia, Alzheimer's disease and other disease that impair brain function. This class of people are having to entering care earlier than is otherwise necessary due to their health deteriorating due to non-compliance.

Non-compliance has a number of dimensions, from simply forgetting to take a dose, taking the wrong medication or taking the medication on the wrong schedule. All of these can have significant health consequences. [Source:].

Whilst there are a number of devices in the market that attempt to solve some parts of this problem non of the solves all of the issues and those that solve a reasonable number of the issues tend to become extremely complex to operate (they make setting the clock on your microwave look easy).

With Med Check we are looking to solve all of the core non-compliance issues leveraging some of the advances in technology such as smart phones, ubiquitous (at least in the developed world) internet connectivity and the new field of Internet of Things (IoT).

Specifically Med Check attempts to resolve the following non-compliance causes

  • Forgetting
  • Incorrect dosages
  • Overdosing
  • Reporting

MedCheck is intended to be a first class IoT device. MedCheck will have a single button on the front face of the unit which flashes and buzzes when its time to take your medication. Configuration and management of the device will be from your smart phone and a dedicated website.


MedCheck is directly connected to the Internet and MedCheck's specialised website. The MedCheck unit reports regularly on its status. If the unit goes offline a notification is sent to the appropriate person.

MedCheck is able to download its medication schedule from the MedCheck website as well as reporting on compliance and issuing alerts to appropriate parties if a dosage has been missed.


MedCheck uses NFC to connect to a registered smart phone. A smart phone is used to initiate the initial registration of the device to the MedCheck website as well as configuring the devices WiFi connection.

TODO: should this be blue tooth? Blue Tooth is probably more ubiquitous however I've always found it harder to configure than NFC. I'm also not certain of the limitations of NFC.


The MedCheck device is designed to issue a number of notifications including:

  • Simple reminders to the patient
  • Non-compliance warnings to a Carer
  • Cartridge Exchange reminders


There are obviously some serious privacy...

Read more »

  • 1 × bannay pie M2 Contains a built in WIFI connector with mini-coaxial connector so we can mount an internal antenna if required.
  • 1 × 3d printed body
  • 1 × motor
  • 1 × illuminating button
  • 1 × piezoelectric As a buzzing sound source

View all 11 components

  • off scad, onshape

    bsutton06/08/2015 at 12:12 0 comments

    I'm a big fan of open source and being a Ubuntu Gnome desktop user it generally fits my environment nicely.

    Now I'm no CAD user, but during a former life I was a programmer, so when looking for a CAD solution OpenSCAD was a logical choice.

    I've been using OpenSCAD on and off for a couple of years and generally I've been pretty happy with it.

    The problem with MedCheck is that I've really felt that I've hit the wall with complexity when using OpenSCAD.

    Even with a strong background in programmer and the accompanying understanding on how to structure a program, the reality is that when doing CAD you need to be able to easily visually align things. With a complex model OpenSCAD starts falling apart.

    So I finally decided that I need to learn a traditional CAD tool, only problem was that running a Linux desktop makes this is a little problematic.

    My first choice was to have a look at freeCAD which is actually based on OpenSCAD, so a fairly logical move and it runs on Linux. Only problem was that it was just a little too buggy, so I went looking again.

    My brother (another maker in the family) then mentioned that he had come across a CAD system that was entirely web based, no install necessarily (runs using WebGL).

    So with some skepticism I want a searching and found OnShape.

    No, OnShape isn't open source (they raised $65M in seed funding), but to be honest after using it for a few weeks I don't care.

    Its pure web based (with a beta IOS app and Android on its way) and to be honest, remembering I wouldn't know good CAD if I fell over it, it's fantastic. For a complete non-CAD user it's quite intuitive and I've managed to put a model together in a couple of weeks compared to months with OpenSCAD.

    So the good news. OnShape is effectively free for Makers. The free version gives you five private model and an unlimited no. of public models (up to 5GB) , but the reality is that this is more than enough for most Makers. There is a paid pro version which allows you to store a greater no. of 'private' models and 100GB of storage. The free version has all of the features of the pro-version apart from the above noted limitations.

    OnShape is still in beta but appears to be very stable. Oh, did I mention it has built in version control and multiple users can work on the same model simultaneously!

    My opinion is that these guys are going to blow everything else out of the market and that makers will flock to this product.

    And no I don't own any shares on OnShape, but I do know a good product when I see one.

    Go try it out and find out for yourself.


  • The force of an idea

    bsutton05/28/2015 at 13:40 0 comments

    Sometimes problems seem to swirl like a hurricane, ideas seem to build up a pressure in my head and then something happens, a singular problem can bring everything into focus and then everything seems to collapse down into a single clear solution.

    And sometimes that idea or solution simply forces you to change everything and so it is has happened just now, minutes before the witching hour.

    The problem came out of a dialogue regarding medication schedules and the realisation that often times a medication must be taken before, after or with a meal. Simply dispensing medication was no longer enough, we now need to provide instructions.

    This is one of those defining problems that test the boundaries of an idea. Just how far should our design go and what problems should we try to solve.

    I have a great weakness for taking too much on.

    The problem is that I want elegance and simplicity and I want to do everything for everyone. The truth is that simplicity and everything are opposing ideas. But still, I'm going to try for both.

    So the solution; the dispenser must have a screen.

    My original premise was that the device would have a single button, it flashes when it needs to be pushed and you push the button to dispense. These were the only two actions that a pill consumer would need to worry about. The problem is that reality keeps getting in the way.

    So now I need to inform them to take the medication with, before or after a meal and perhaps even remind them when to have a meal so that they can take the medication at the right time.

    So a screen breaks some of my original design goals but at the same time it solves a mirade of problems that I've been trying to work around.

    With a screen, we no longer need a NFC enabled phone to control the device, which means we can support iphone users again.

    With a screen, WIFI configuration suddenly gets easier.

    With a screen, we don't need to build a complex app for each phone OS in the market, instead a simple phone sized management web app will be sufficient.

    But not just any screen. I hate microwaves and alarm clocks and fridges and the like that compromise on a dicki little screen that is essentially unusable.

    We need to have a decent sized screen, which is capacitive touch and probably colour given our target audience. Fonts have to be large and clear.

    So we have probably just added $300 to the price of the product, but I just don't like to compromise and the reality is that we were never targeting the low end of the market.

    So now I feel purged. The pressure has been released in my head and I can go to bed. Perhaps I will come back to this blog in the morning and do some re-editing and re-thinking.

  • Database design

    bsutton05/19/2015 at 11:02 0 comments

    So need to nail down some design requirements so that we can finish off the db design.

    As with any project getting the db design correct at the start will save a lot of pain and suffering later on in the project. To get the db design correct we need understand what we are trying to achieve with the overall system.

    So some key questions and answers:

    Q. Is the system 'device' or 'patient' centric?

    A. Patient centric. We may even see a patient with multiple devices if they live at multiple locations or have dispensing needs beyond the capacity of a single device. Of course over a patient's life time they may have multiple devices (upgrades, failures). In either case we need to support the concept of multiple devices.

    Q. Can a device have multiple cartridges?

    A. The current design only allows for a single cartridge to be inserted at a time. A future design may allow 2 or more cartridges to be loaded into a single dispenser. Even with a single cartridge model we still expect each device to have more than 1 cartridge. Basically one in the device and the second one ready to be pre filled and then swapped into the device.

    Q. Can a device have multiple patients?

    A. At this point we don't foresee a single device dispensing to multiple patients. We have had some thoughts about a retirement home module that contains multiple cartridges with a cartridge per patient, but this is a long way away from any serious consideration.

    Q. Can a patient be their own Carer?

    A. Certainly. This is largely about the permissions model (e.g. who has permission to do what)

    Q. Can a patient be their own Practitioner?

    A. Whilst this isn't very likely (and perhaps not safe) it may be possible. But I think its fairly save to ignore this scenario.

    Q. Can multiple devices be located at the same address?

    A. This has to some extent already been answered. The reason I raise it again is that it has other possible ramifications. If you have two devices that are being used by TWO different patients, what is the risk that a patient will take a pill from the wrong dispenser.

    I've suggested elsewhere that this could be dealt with by using an rfid bracelet which is used to identify that the correct patient is access the device.

    Q. Can we share mediation descriptions between patients?

    A. I've had some thoughts about using photos of tablets to help carers identify tablets when clearing the dump draw. I'm hoping that having access to a photo of each tablet that we might reduce the errors when recovering dumped tablets. The problem is that photos may not be sufficient for reliable identification and the size, shape and colouring of tablets may change over time and from manufacturer to manufacturer.

    If the look of tablets from a given manufacturer is stable and photos are sufficient then sharing the medication descriptive data between patients may be beneficial. e.g. we load the data/photos once and then share the data between all patients.

    I don't have sufficient information to make an informed decision on this one. As such I'm going to be conservative and assume that we won't share medicine data between patients.

    Q. What type of scheduling do we need to allow for? Are there common patterns that we can provide or does the scheduler need to be fully customisable?

    A. My experience with generic schedulers is that they are hard to use and hard to understand (just look at cron). As such I'm inclined to go with a template idea. Basically we load a set of standardised schedules into the system. When setting up a schedule the carer select an appropriate template and then does some simple customisation.


    Three times a day before a meal.

    Three times a day with a meal.

    Three times a day after a meal.

    Before Bed

    So this raises some issues that I've not previously considered. How do we convey information such as 'take before eating'. It also raises questions about timing. If I eat my meals at the same time every day then the dispensing schedule is easy, but if I have more irregular eating habits then a fixed schedule...

    Read more »

  • Draft ER diagram

    bsutton05/18/2015 at 12:46 0 comments

    For your viewing pleasure, I've just uploaded a first pass attempt at an ER (entity relationship) diagram.

    You can see it in the image gallery.

  • Comms protocol

    bsutton05/17/2015 at 12:45 0 comments

    So there are a couple of questions around how we are going to communicate with the medcheck device.

    In this case I'm not talking about NFC/RFID/bluetooth etc, but rather how the central medcheck site will talk with the medcheck device.

    The reality with home routers is that the devices will all be nat'ed so we are unlikely to get direct access to a devices.

    This may make several issues difficult. Firstly, we won't have direct ssh access to the device (despite a suggestion otherwise in a previous log) so how do we manage devices.

    The obvious answer is that we need the device to call home. https is the obvious protocol for the device to send any notifications to us. We can also use a similar technique to long polling (without the long bit). The idea is to device check in on a regular basis (and may be initiated by a phone tap on the device) to see if the central system has any instructions for the device. This is often referred to 'phoning home' (no ET references please, it was a completely crappy film. Can anyone tell me why ET was able to fly to catch the ship at the end, but couldn't fly to catch the ship at the beginning. If he had only flown at the start it would have saved us all from having to sit through a complete load of rubbish).

    So using the phone home concept the medcheck will use a two phase approach.

    Every 'n' seconds the medcheck phones home by making a https request to the medcheck central server(s).

    When a medcheck admin needs access to the medcheck device he instruct the medcheck server to return an 'ssh connect' command to the device.

    On seeing the 'ssh connect' command the device issues an ssh request such as:

    sh -N -R <port>:localhost:22 <user>@cmdserver

    The 'ssh connect' command also sends a port and one time use 'user' account (actually we probably one to send an one time use certificate - need to do some research here). We don't want to give the device any real access to our systems see need to look into how we secure the ssh connection from the device.

    Once the device connects to us we can then connect to the device by:

    ssh -l piUser -p <port> localhost

    So we now have a basic method of secure communications. We still need a means of authenticating the device. We can use the device's Mac address or its RFID (will it have one of theses) or do we need a public key.

    The actual protocol over https can just be REST we don't need anything fancy.

    Some likely commands

    PUT: Error: <Error Code>, <Error Message>

    PUT: Notification <Warning Code>, <Warning Message>

    PUT: Notification <Notification Code>, <Notification Message>

    GET: Command - used for the phone home process

  • And now the software

    bsutton05/17/2015 at 10:55 0 comments

    So with the hardware design slowly...... taking shape its time to give a little thought to the software pieces.

    Essentially we are going to need a number of pieces of software:

    1. Medcheck dispenser's firmware
    2. Phone App(s)
    3. Patient/Carer website
    4. Practitioners website
    5. Management website
    6. Brochure ware

    So lets have a poke at each of these and think about what they might look like.


    At this point we are considering the Banana PI as it supports most of the hardware interfaces that we need. As such we can probably drop one of the cut down linux OS on the PI and use Java to develop the firmware (yes I'm a java developer. I can do C/C++ but it's not necessary and it's not worth the additional pain).

    So what does the firmware need to do.

    Firstly operate the basic hardware on the device which includes:

    • dispense pills when dispense button pushed
    • operate buzzer/flasher for dispense button
    • lock/unlock dump draw
    • lock/unlock dispenser lid
    • operate dump bridge
    • rotate cartridge
    • rotate cartridge into insert/remove position
    • connect to LAN via ethernet or WIFI
    • download dispensing timetables
    • send error/warning alerts
    • flash 'touch me' light when error/warning occurs
    • transmit warning/error messages to phone when phone touches dispenser
    • interact with phone to obtain WIFI connection details
    • update carer website when pills dispensed

    Phone App

    The Phone App is intended to provides some basic management functions and manage any direct interactions with the device.

    The trick here is to provide just enough functionality from the phone to make the experience feel fantastic without getting carried away trying to implement functions which are better off done via the Carer website.

    So the key Phone App functions will be:

    • configure WIFI for dispense
    • unlock dispenser
    • lock dispenser
    • receive warning/error messages from the dispenser (via NFC or WIFI or bluetooth)
    • check the status of the dispenser (what exactly this means I'm not certain).
    • * probably needs to be able to do this locally (touch the machine) and remotely
    • receive notifications of late dispense actions (although this may be better done via SMS)
    • receive reminders that a cartridge is due to be changed
    • check the status of the cartridge and the next fill date
    • pause the dispenser - no further dispensing actions until unpaused.
    • mark a specific slot to be dumped (I'm thinking of a remote change of mediation that may need to be done in a hurry).

    Carer/Patient Website

    The Carer website is where the majority of the dispenser management will occur.

    • configure medication schedule
    • print cartridge fill guide for specific date range
    • authorise third party to manage medication schedule
    • view errors/alerts from dispenser
    • unlock dispenser
    • lock dispenser
    • check status of dispenser
    • view log of dispense actions
    • view date of next cartridge change
    • set alert thresholds for notification on late dispenses
    • login/logout
    • view session history
    • log cartridge change (needs to be linked to the fill guide)
    • safely modify medication schedule part way through cartridge rotation (still requires cartridge change out).
    • assistance to empty/sort tables from dump draw (pictures of different tablets might be useful to aid in identification). This one makes me nervous as what happens if a pill is mis-identified?
    • Enter key data about patient including photo for clear identification by Practitioners. At a minimum: Name, Address, DOB, Insurer, Patient identification no.
    • View billing history
    • Make payment for access to medcheck website.

    A wild thought just popped into my mind.

    What if we have a household with multiple Medcheck dispensers? This sounds great except that we then have the added problem of ensuring that the correct patient is using the correct dispenser.

    So how do we deal with this?

    • Finger print scanner
    • Facial recognition
    • Tattoo
    • RFID bracelet

    Yes Tattoo was intended as a joke, but no wait...

    RFID bracelet seems the most practical and reliable, particularly given that many patients wear medical bracelets anyway. We could configure the dispenser to only dispense when the dispense button is pushed and the RFID...

    Read more »

  • Designing a better mouth

    bsutton04/17/2015 at 22:45 0 comments

    Medcheck is all about taking pills, so having an optimal mouth is critical to Medcheck's success.

    Now don't get me wrong, I'm an evolutionists, but sometimes you just need an Intelligent Designer's hand involved to get the best results.

    Given we don't have any Intelligent Designers here abouts, it looks like I'm going to have to get involved :D

    For sometime, I've been concerned about the mouth of the MedCheck dispenser when used by people with low hand mobility. Arthritis for instance, is likely to be a common disease amongst our demographic.

    The current design requires the user to scoop the tablets out of the dispenser, probably into a cup and then take the tablets. This requires a moderate amount of dexterity.

    So an alternate design might be to dispense directly into a cup.

    Introducing a cup creates some problems of its own and greatly increases the complexity of the design. But lets ignore those problems for a moment and explore the path.

    Missing cup

    If the cup isn't in the dispenser or isn't properly seated in the dispenser then you can't dispense tablets.

    Given that we expect our demographic to potentially have memory issues, misplacing the cup is highly likely.

    So for a cup design to work we need several things.

    1. The cup must be easy to insert/remove

    2. It should be hard to mis-align the cup

    3. MedCheck must be able to detect a missing cup

    4. If the cup goes missing we need a simple way to find the cup.

    5. Can we turn the cup into a travel pack?

    So lets go through each of these one at a time.

    Easy insertion/Alignment

    So in my experience these two things are at opposing poles. A device that ensures correct alignment often tends to make it hard to insert the device. The only way to see if we can get a nice balance is to do some design work. Where is that Intelligent Designer when you need one?

    Missing Cup Detection

    The simplest solution is some type of micro-switch, but I don't love moving parts and from experience they tend to compound the alignment problems. My wife has one of those over-priced Thermomix's (which she loves; but she would have to say that given what she paid for it) and it uses a microswitch to ensure that the lid is closed and its always a bit of a bitch to close properly (and one imagines that they have a few intelligent designers chained to a work bench somewhere in Germany).

    The other solution is some type of field device. RFID is one possibility and then we can add DRM to the cups, so you can only buy the cups from us :D . Whilst I joke about DRM, its actually not a bad idea as it would ensure that the correct cup is inserted and that no pills will be lost due to 'cup misalignment'.

    Make cup an iBeacon device

    If you haven't had a look at iBeacon or better still altBeacon its worth a gander.

    If I've understood the tech correctly, its essentially a low power Bluetooth protocol that outputs a gps style signal. The signal can be used to determine the current distance from an object with a beacon attached. Some of the implementations allow the determination of a distance and a direction via triangulation, if multiple beacons are deployed .

    iBeacon is Applies copyrighted (as that a word) name for a blue tooth low power protocol. Apparently some of these beacons can operate for two years on a small battery. AltBeacon is a more open standard that works across Android devices and it looks like there are beacons that can talk to both Apple and Android.

    So back to the cup. Given our demographic losing/misplacing a cup seems highly likely. So designing the cup as a bluetooth device which can beep and buzz when you loose it, seems like a cool idea. If you then go further and add the beacon technology to the cup you can use your smartphone to locate the cup.

    We wouldn't be able to use the triangulation technology of the beacon as we will only have two potential beacons the cup and the medcheck.

    Hmm, maybe thats not actually true. I think I read somewhere that your phone can also act as a beacon. Does that mean with cup, medcheck and the...

    Read more »

  • NFC on Apple, but not really

    bsutton04/16/2015 at 11:03 0 comments

    Just after I mentioned Apple's wall garden, I managed to hammer my head straight into it.

    So it turns out that iphone 6 (IOS 8) supports NFC, well sort of.

    With that typical Apple 'stuff you' attitude, they only allow NFC usage for Apple Pay.

    I really have to ask why people buy Apple devices, it must be the nice Apple boxes they come in.

    So in the meantime 'stuff you Apple'.

  • NFC app install

    bsutton04/16/2015 at 10:21 0 comments

    Found this somewhat useful link on installing an Android App via NFC:

    Now need to find the same for IOS.

    Should we support Windows Phone?


  • That 'Apple', out of the box experience

    bsutton04/16/2015 at 10:00 0 comments

    So we started a conversation about set-up and installation of MedCheck.

    I was focused on the technical details, but Tristan came from quite a different perspective. To use Tristan's words, he was looking for that 'Apple experience' when unpacking the box.

    Whilst I hate many things about how Apple conduct their walled garden, you have to give them credit for creating great hardware and that fantastic Apple out of the box experience.

    So how do you achieve that 'Apple experience'.

    Simplicity and in Tristan's words once more; 'no white is too white', hmmm.

    To me the simplicity must be in hardware and in the initial setup, but to be honest I'm not too keen on white :)

    So the hardware:

    The MedCheck unit will be a single barrel about 20 cm wide by 30 cm high.

    The unit will have two ports, power and ethernet, with cables supplied for both. We are hoping that we can put the power pack inside the unit (we have plenty of space at this point) as we find external power packs ugly and messy.

    When you un-box the MedCheck it will come with a single page setup guide.

    • The guide will show how to plug in the power cable.
    • Power the unit on.
    • Wait for the red light to start flashing.
    • Touch your phone to the 'Touch Phone Here' panel.

    The 'Touch Phone Here' panel is where the magic and simplicity start.

    I should note that we have some concerns about the reliance on NFC and a smartphone. While there are high rates of penetration of smartphones (in Australia its over 78%) not everyone has a smartphone and not all phones have NFC and not all NFC phones have NFC enabled. Reality is that we need to start with a target audience so smartphone with NFC enabled is where we are going to start.

    We have intentionally not put a screen on the device, as we wanted to ensure that we didn't end up with a Microwave/Video player interface. As such the smartphone screen is going to be the device's screen. What that means is that if the device wants to say something, then it needs to communicate with your smartphone screen. Once the device is setup, communications will mostly be easy. During setup and if the device looses its internet connection, life gets more difficult. This is where the 'Touch Phone Here' (TPH) panel comes into its own, along with the associated flashing red LED. Whenever the device needs attention the LED on the TPH panel will flash. Touching your phone on the TPH panel allows the device to communicate with your phone via NFC and the phone will then take the appropriate action or display a message such as an alert or an error message.

    So on powering the device up for the first time, the TPH LED will flash.

    The users touches their Phone to the TPH panel and the device instructs the phone to download the MedCheck application (is this even possible?).

    Once the MedCheck application is installed the registration wizard kicks into life.

    The registration wizard will ask for basic details which will primarily be your email address (to handle forgotten passwords).

    The wizard will then contact the MedCheck Web Application, create a user account and register your MedCheck device (during the initial NFC exchange the device will provide a unique ID such as the unit's MAC Address).

    The MedCheck Web Application will email the user a login link, that will prompt them to create a password for accessing the MedCheck Web Application.

    The MedCheck application will then begin the internet setup by asking the user if they want to use the ethernet cable or WIFI.

    Depending on the answer the system will instruct the user to plug in the ethernet cable or enter the WIFI access point name and password.

    The MedCheck app will then prompt the user to tap their phone on the device which will send the WIFI access details to the device (if WIFI was selected).

    The device will then connect to the internet and register with the MedCheck Web Application. The MedCheck phone will be waiting for the registration and will notify the user once it completes.

    If the device is unable to register, it will flash its TPH LED....

    Read more »

View all 12 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates