ARDUINO MEDICATION BOX

 


 

 

Blog #1 - Idea & Concept

1. Introduction

     Hi! This will be my first blog for the Design For a Cause 2021 Design Challenge. As the name of the blog suggests, I will use this blog to introduce my idea and concept for this project and show some basic first tests that I've already conducted to make sure that this project would work in the end. As you will see through this blog, this is something I've already tried to tackle with a different approach but wasn't successful at the time, so, to solve this issue, I came with a new concept which I think will be far superior to the last one. Before I get into how, let's first take a look at my idea for this project and what I'm trying to accomplish with it.

 

 

2. Idea

     This project will be primarily designed for my lovely grandma. She needs to take a lot of different pills during the day on a regular basis whether that is for her heart, blood pressure or something else just like a lot of people her age. Of course, it's really important that she takes the right medication at the right time for them to have the right effect, specially because some of those pills work in combination. During 2020 a lot of people had to start taking medication regularly or add new medication to the ones they usually take. While my mom and I live in the same house as my grandma, she's usually at work, at I'm sometimes not home for weeks if I have some obligations at university, so we can't really actively control if she has taken every single pill and she would probably get annoyed by us as well in the meantime. Shortly put, my idea for this project is to make a medication box which would keep track if grandma is taking the right medication at the right time and alarm us if something is not right.

My grandma uses one of those standard pill organizers which you can see on the picture above. It has individual cells for pills for the morning, midday and evening for all of the days in the week. It does the job okay, the lid is a bit flimsy and not so secure and something I don't understand why, it's made out of white plastic, like most of other pill boxes. Pretty much all of the medication she needs to take (and that I have generally seen in my life) is either white or some bright pink/blue color, so, it would be more logical to have a dark box, to have a bigger contrast so you can see the medication easier. My idea is to make an upgraded version of the pill organizer. Here's a short bullet point list that will represent my goals with this project a bit better:

 

  • Zero hassle for grandma
    • This is the first and most important point of all, she is used to using a normal pill organizer and I want her to have the same experience without ever needing to worry about anything on this device. She doesn't need to press anything, she doesn't need to use it in a certain way, the only thing she will need to do is to keep it at the same spot (it will become apparent why later in this blog) which she already does with her old pill box.
  • Monitoring of all cell compartments in the box
    • I want to be able to monitor all of the cells at any moment, its not just taking a medication, it needs to be the right one as well
  • Monitoring when the box has been opened
    • This is a simple thing to implement, but one which gives a really nice system when it's combined with the single cell monitoring. Here is the issue, the boxes usually have 3 compartments per day and there can be more than 3 times per day when a person needs to take their medication, my grandma has way more than three, but it would be highly unpractical to make a box with 6/7 compartments per day. When you combine these two methods, you can check if the box was opened when it was supposed to be open (it will only be open when she is taking a pill) and additionally, you will have 3 safe checks a day to see if the right compartment is empty. If the box finds some medication in a compartment after the last one from that one should have been taken, we have an alarm, because that means she took a pill from some other compartment and so on, or if the system finds that a compartment which should have something inside is empty, we have a problem again.
  • Magnetic/wireless charger
    • Since this will be an electronic device, it will require power. While it will be battery powered, it still needs to recharge from time to time. While it's not that big of a hassle to plug something in, I want to take that completely out of the equation so my grandma doesn't have to think about it at all, so my idea is to either have it wirelessly charged or with a strong magnetic connector which would pull the box close and keep it charged. Either of this option is good since she usually keeps her pill organizer at one spot so she doesn't lose it.
  • Notifications
    • This whole system is useless if my mom and I don't have live notifications from the system. When we get a notification we can call her up immediately to check up on her if everything is alright. All this means that I'll need to make a small Android app which will receive notifications and warn my mom and me if anything is wrong.
  • Construction
    • As I've already mentioned, I don't get why most of the boxes are made out of white or bright colored plastic when most of medication is in bright colors too. To fix this up, I will be using some darker plastic gray/black and will also make the whole box construction a bit sturdier. I'm amazed she doesn't lose medication when she puts box in her bag from how flimsy the lid is.
  • Secondary features
    • The list above captures the primary features nicely, but there are some additional features which I would like to integrate if I have time. Some of them would be to have a small buzzer built into the box which would work as an alarm to remind grandma when she needs to take the medication, and also, make founding the box easier if she ever misplaces it. Having maybe a fall sensor sounds like a good idea too.

 

That would nicely round up the idea for my project, but there's one big question still left, how am I planning on doing this. In the next section of the blog, I will shortly go over my old idea and how that went and then go into detail how I plan on doing it now as well as present some first tests that I've conducted.

 

 

3. Concept

     Before I get to the concept for this project, I will shortly go over a concept for the project where I wanted to tackle the exact same issue but with a completely different approach compared to this one as you will soon. I'm still keen on trying the old approach some day maybe, but I'm liking the new one much better at the moment.

 

Old concept

     My first attempt for tackling this issue was back in 2019. My idea back then was to use an old desk lamp, and upgrade it with a Raspberry Pi and a Raspberry camera to have an overhead look of the box and to track and count how many pills are in each of the compartments. You can take a look at that blog here: Medication Monitor - Part 1 . I've ran into some issues back then, but the main issue was I ran out of time, there would of course still be some things needed to be addressed like the glare from the lid, but I think it's doable.

lamp1lamp2

You can see the lamp of the first picture and you can see the first results that I've had from OpenCV where I wanted to detect all of the individual compartments. While I did detect all of them, I've clearly also detected a lot of stuff which I shouldn't have in the process. Again, with more time, I am sure that this could work out in the end.

 

New concept

     The new concept is based on a really simple idea and requires some widely available and very cheap components. My idea is to use an IR LED and an IR transistor for each of the compartments and effectively, have a small laser gate which would detect if the there is a pill at the bottom or not. To explain better, here are some Mythbusters inspired, blueprint sketches.

When there is nothing in the compartment, the path between the LED and the transistor is free and we can easily detect that using an analog (or even a digital) pin on the Arduino. If however, there is a pill inside the compartment, then we have a situation that looks something like this.

Here, you can see that IR LED is still active, but, due to the small pill which is in the compartment, it's obstructing the path between the LED and the transistor, which we can again easily detect using the Arduino. Now, you may ask, how do we know that the pill break beam reliably when we are trying to get a reading? There are a 3 thing I'm planning to do which will immensely help with reliability and also help how easy it's to use the box.

 

  • I will be putting both the IR LED and the IR transistor as close to the bottom of the compartment as I can
    • This way, no matter how small the pill is, I'll be able to detect it when it's at the bottom of the compartment.
  • All of the sides of the boxes will have curved edges
    • As you can notice on the sketches above, you can see that the inner walls curve inwards. This proved to be a great thing because of 2 reasons. One, it will center the medication much better so we will have more reliable readings and second it's so much incredibly easier to take out a pill out of the compartment when we have curved edges rather than sharp 90 degree corners like is the case with most pill boxes.
  • I will be using the integrated IMU on the Arduino Nano 33 IoT board
    • This system is designed to look for the pills which are the bottom of the compartment, if the box is upside down or at some weird angle, there really isn't a point of trying to get any readings. So, to have reliable readings, I will only do the readings when I can check with the IMU if the box is at some normal angle where the pills would actually be at the bottom of the compartments. Another safety feature which can be implemented would be if we detect and open box while it's upside down, something is clearly wrong...

 

With those 3 design methods in mind, we will be able to get very reliable and consistent readings for all of the compartments. I've touched upon on how I plan on integrating all of the features that I've talked about, but this is something that I will develop more as the project is moving forward. The idea for the whole layout of the box would be something like this.

By placing the LED and transistor alternatingly horizontally and vertically, I can achieve a layout where there is a maximum of one IR LED/transistor on each of the side of compartments making everything uniform and as compact as possible. Besides that, in the back we will have the Arduino, the other necessary electronics and a 18650 LION cell for powering the whole thing. I have a few ideas for some alternative battery options, but this is the one I will focus on the most for sure. I've worked out the details on how I plan on integrating so many sensors with not so many pins for the next blog, but I think one word will explain a lot and that is multiplexer. This is my current plan for the project as a whole.

A lot of the stuff from the picture I've already covered in great detail, the things I haven't covered that much are on the left side of the picture. Since the Nano33 IoT has WiFi capabilities, the idea is to of course have it connected to the home WiFi where it can store all of the data online which I can then fetch with an Android app. The only thing I'm trying to work out still is how to go through the initial setup of connecting the board to WiFi without having to hardcode it into the device. Some first idea for me was to use the Bluetooth capabilities of the board for the initial setup, but, if you have any better ideas for that, please let me know.

 

First test

     I of course wouldn't put so much time into planning without at least conducting a small test to see if the idea is feasible at the first place. To do this, I designed and printed a small single cell compartment with 3.2mm holes on either side just enough for a snug fit for the IR LED and IR transistor.

I wired up the IR LED with a current limiting resistor, and wires up the IR transistor in a voltage divider with a resistor and then attached that to a pin of the Arduino. Happily, the experiment worked great and really reliably, I didn't get a single error when it comes to the pill detection. Here is a short video demonstrating my test.

 

 

4. Plan

     The test that you've seen will summarize my idea and concept pretty well. Now that I've explained my idea, why I want to do this project and how I plan to achieve that, all that's left is to give a bit of a plan for the whole thing. Since this is a 5 blog design challenge, I will dedicate each of the blogs to a certain topic:

 

  1. Idea & Concept
  2. Electronics design
  3. Mechanical design
  4. Software
  5. Assembly & testing

 

That would be my initial plan for this design challenge, but of course, it's very prone to change as every project is, because it will come with new unexpected challenges. My next blog will be dedicated to the electronics design for this project. In that blog, I plan to test out all of the circuitry needed as well as design a big PCB which will run across the bottom of the whole medication box. That blog will be linked at the end of this blog once I've uploaded it.

 

 

5. Standard pill organizer

     To kick off, I designed and printed a simple pill organizer as a test, to see what my grandma and family members would think. They really liked how it turned out. For designing this box I kept to the principles I described above, I wanted a more secure lid, I wanted it a darker color and I wanted rounded edges at the bottom of each compartment so the pills can be picked up more easily. The size of the single cell compartments is the same as the one in the test. If you want to try printing out this box, you can find all of the files here: 3D printed pill organizer.

{tabbedtable} Tab LabelTab Content

Box

Let's begin with the design of the box


It keeps the 3x7 layout because my grandma is used to it. Instead of a sliding lid it has a lid with a hinge. I like the idea of a sliding lid more, but I'll need to work it out how to make that work properly. To keep the lid close you can see 2 holes at the front of the box which are used for magnets, there is a matching set of holes on the lid.

Lid

The second part that needs to printed is the lid. It has a matching set of holes for the magnets, and has the negative of the hinge design in the back. For the hinge, I just used some M3 screws and nuts.

There will be one more thing needed, which isn't printed, and that is some clear plastic/acrylic. The top needs to be see through so it needs to be made out of some material like that. There are 2 versions of the lid, one is a single window version and the other one is a 3 window version. You can find both files on GitHub linked above and below.

This did need a bit of time to print, since these aren't the smallest items, but they printed without any support needed. The box is a bit counterintuitive, because it needs to be printed on it's backside. I designed it like this so that there is a curve in one direction which is really nice instead of just layer on top of layer. Here is how the finished box turned out.

The acrylic is a bit of a finger print magnet, but it fit in perfectly. I managed to cut it just by using a knife and scoring it over and over and then using a file to get it just right to pop into place. There is a really satisfying click when the magnets close up the lid.

 

 

6. Summary

     In this blog, I wanted to present you the idea behind my project as well as the concept for it. To summarize it all. I want to build a smart medication box, which would keep track if my grandma is taking her medication on time and inform my mom and me if anything unexpected occurs, like taking the wrong medication during the day, or not taking the medication when she is supposed to. To point out the most important aspect of this build again, I want my grandma to use this in the same way she uses her old pill organizer. To her, this just needs to be a box of pills and nothing else, I don't want her to spend her time or any energy on this, if anything, with some of the small upgrades like the built in alarm, darker color and rounded edges, it will be easier for her to use. You can find the links to all of the codes and files used in this project down below! Thanks for reading the blog, I hope you liked it!

 

Milos

 

Relevant links for the competition:

Link to all of the files (open source) for this project (codes, 3D models,...):

My other projects:

 

Next Blog
Coming soon....