Baymax Lamp - Helps You Take Medications on Time

by Arpan Mondal in Circuits > Arduino

1485 Views, 9 Favorites, 0 Comments

Baymax Lamp - Helps You Take Medications on Time

Bat-Signal lamp.png
20230726_132430-01.jpeg
20230726_132647-01.jpeg

I have allergies for which I need to take homeopathic medicine twice or thrice a day. The problem with those meds is that they have strict rules about when I am supposed to take them. For example, I am not allowed to eat or drink anything half an hour before and after taking them. So it has been quite a hassle remembering to take the meds at the right time.

Recently, I watched a TV show called Baymax which is based on the character from Big Hero 6. Baymax is a cute medical robot who helps people who need medical attention. So I got the idea to make a real life mini Baymax that does exactly the same thing!

Here's how he works:

Baymax's body glows white normally. But when it is time to take a medicine, it turns to a specific color. Different colors can be set for different meds so that you know which med you are supposed to take at that time. Once you see the color, you need to tap your phone on the medicine box to bring back the color of his body to white (This will be done using an NFC tag). After that is done, the next color will appear when it is time to take the next medicine, and so on.

Although it sounds complex, it is very simple to build. Also, this project is completely made out of recycled materials (except the electronics) so it is environmentally friendly too :)

Read ahead to see how I made it!

Supplies

Ndemcu / Esp8266 microcontroller Buy

Common cathode RGB LED Buy

Jumper wires Buy

NFC tags / stickers Buy

A broken LED bulb

Styrofoam

Soldering iron (Optional)

Adhesive

5v power adapter (A smartphone charger with Micro USB should do the job)

Permanent marker

Making His Belly

IMG20230726113628.jpg
IMG20230726113718.jpg
IMG20230726123725_1.jpg

For this, I took an old broken LED bulb (yes, I don't throw them away) and popped open the diffuser. The diffuser is not made of glass even though it looks like it is. It is in fact made of plastic, so it should not be a problem to open it with brute force. But I must still warn you, it might hurt you if you don't do it carefully.

I used a screw driver to open it. Although I was successful, I did end up poking it into my thumb and getting some blood out :(

Rest of His Body

sketch1690472872537_1-01.jpeg
IMG20230726115326.jpg
IMG20230726120944.jpg
IMG20230726121027_1.jpg

It's time to show off your sculpting skills! Don't worry, it's very easy.

First, I placed the diffuser on a white paper and drew the outline of Baymax's body around it. You can see it in the first image.

Next, I took some pieces of thick Styrofoam (thermocol) and cut it roughly into the shapes of his arms, legs and head. You can find lots of Styrofoam inside waste packaging materials. They are used to safely pack and transport fragile items. His arms are shaped like bent tear drops. His legs are cylindrical and his head is a large oval.

Once I was ready with the basic shapes, I used a sand paper to smoothen the Styrofoam and provide roundness to all sharp corners. Baymax is actually made of balloon-like material in the movie, so I took my time to carefully smoothen out everything so that his body looks as realistic (as in like the movie) as possible. To do this, I first used a low grit sand paper to carve out the main shape and then a high grit sand paper to make the surface smoother. You can see how I did it in the 2nd and 3rd images.

Once done, I placed everything on the table to see if they were of the right size. If not, I sanded them more until they were.

His Head

IMG20230726130105_1.jpg

If you have noticed from the previous images, his body looks kinda odd even after spend so much time carving out the shapes as carefully as possible. But once I added his eyes, he looked very close to Baymax from the movie.

Now, you can just take a black marker and draw his eyes and the line connecting them. But I wanted it to be a little more 3D so I used two small beads from an old dress and colored them black with a permanent marker. I then stuck them to his head using adhesive. I used the same marker to draw the line connecting the two eyes.

Instead of all this, why didn't I just go ahead and 3D print the entire thing? Well, first of all, I wanted to build this out of recycled materials. Also, I neither own a 3D printer nor are there any cheap 3D printing services nearby. And this method is much faster than waiting for a 3D print to complete. So I guess it's a win-win?

How Will the Medicine Reminder Work?

Bat-Signal lamp(2).png

Let's first understand the components in our system. We have Adafruit that is the IOT platform that interacts with our microcontroller. Then we have the microcontroller itself which is a Nodemcu. Trigger signals will be a scheduled time (for medicine reminders) and NFC tag (to dismiss the reminder). Here's how they all work together:

  1. A time based trigger is scheduled for medicine reminders. Each medicine can have a label, say 1, 2, 3, and so on. When it is time to take a medicine, the trigger sends a signal to Adafruit
  2. Adafruit forwards this signal to our Nodemcu as it is.
  3. The node mcu then looks up the color to display on the LED based on the signal received from Adafruit. For example, Medicine 1 may have red color assigned to it.
  4. When we scan the NFC tag, another signal is sent to Adafruit. This time the signal is 0.
  5. Adafruit forwards this signal to the Nodemcu.
  6. Nodemcu sees that the signal is 0 and turns the LED white again.
  7. This repeats for the next medicine when it is time.

Setup Adafruit

ada1.png
ada2.png
ada3.png

Go to io.adafruit.com

Create an account and login. Now follow the steps as mentioned:

1. Click on Feeds from the top bar and select New feed. Give a name to your feed. I would suggest you to use the same name I have used, “BAYMAX”. This will make life easier during programming.

2. Click on Dashboards from the top bar and select New dashboard. Give the same name as your feed.

3. Click on the dashboard you created and select the gear icon on the right. Then select “Create a new block” and select the Gauge.

4. Now select your feed name (BAYMAX in this case) in the popup window.

Then click on the next step. In the next window, don’t change anything. Just click “create block

5 .Now your block is created. Click on “My key” on the top bar and note down your username and active key. This is unique to your project and make sure not to share it with anyone (Unless you want them to mess with your project that is)

Setup a Scheduled Trigger

ac11.png
ac1.png
ac2.png

Now we need to schedule our medicine timings. This can be done inside Adafruit itself.

  1. Click on "Actions" on the top bar and select "New Action"
  2. Then select "Choose this action" under "Scheduled"
  3. Then select "Hourly" after "time period". Select "Every day at" and enter your medicine time.
  4. Select "Publish Message to" after "Then". Select "BAYMAX" after "Feed" and finally input 1 after "With".

Repeat the 4 steps to create other medicine timings. The only change you need to make everytime is in step 4. In the "With" section, we need to enter different number everytime. First medicine can be 1, next one can be 2, and so on.

NFC Tag Time

IMG20230728121038-01.jpeg
IMG20230728121055-01.jpeg

NFC tags come in different shapes and types. The one I recommend is the sticker type. Most tags are usually small and circular, but the ones I have are large and rectangular. It doesn't make a difference though. You can use any type of NFC tag and it should work fine.

All you need to do is stick one NFC tag to your medicine box. We will configure this tag in the next step.

Configuring the NFC Tag

Screenshot_2023-07-28-12-05-11-78_2e840d222d67ef3caca3a1c67d71d48f.jpg
Screenshot_2023-07-28-12-02-43-02_2e840d222d67ef3caca3a1c67d71d48f.jpg
Screenshot_2023-07-28-12-04-26-87_2e840d222d67ef3caca3a1c67d71d48f.jpg
Screenshot_2023-07-28-12-03-12-61_2e840d222d67ef3caca3a1c67d71d48f.jpg
Screenshot_2023-07-28-12-03-32-10_2e840d222d67ef3caca3a1c67d71d48f.jpg
Screenshot_2023-07-28-12-03-39-63_2e840d222d67ef3caca3a1c67d71d48f_1.jpg

Now we need our smartphone to understand what the NFC tag should do. For this, we will use an app called Macrodroid. Here is the download link for android devices. If you have an IOS device, you don't have to install any app. The built-in Shortcuts app will work just as well.

To set up macrodroid, follow the images in this step.

  1. Select create macro and click on Triggers
  2. Search for NFC tag and select it. Then select Write new tag and tap your phone on the NFC tag on your medicine box. Macrodroid should show a success message immediately.
  3. Now select Actions and select HTTP request.
  4. Select Post in the request method.
  5. In the URL section, enter the following URL: https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data. Replace {username} with your Adafruit username and {feed_key} with the name of your feed in lower case. (baymax in this case)
  6. Go to the Content body tab and select application/json in the content type. Type {"datum":{"value":"0"}} in the body.
  7. Next, go to the header params tab. Click on the + and type X-AIO-Key in the parameter name. In the value section, enter the active key you noted in your adafruit dashboard.

And we are done! Save the macro and close the app.

For IOS users, here's a link to help you get started with Shortcuts: https://appleinsider.com/inside/iphone/tips/how-to-make-nfc-automations-to-use-with-your-iphone

Programming the Microcontroller

FAAVS8GL4BBKLZF.jpg
Screenshot from 2023-07-28 11-53-38.png

I have attached the arduino code at the end of this step. Once you double click on it, you might get a popup asking you to put it inside a folder. Just click 'OK' and it will do the job and open up the code in the Arduino IDE. There are few changes you will have to make though.

You'll have to add your Wifi SSID, password, adafruit Active key and Username in the necessary fields. Everything is labelled properly, so it should be easy to find them.

In my code, I have added colors for 3 medicines. Medicine 1 is assigned red, Medicine 2 is assigned blue and medicine 3 is assigned green. And when the input is 0, I have assigned white color as a default value. In case you would want the light to be off by default, in the last else block, replace all the three 255 with 0.

The rest of the code has to do with connecting to Adafruit and Wifi network, and everything is labeled well, so it should be easy to understand.

Downloads

Making the Circuit Connections

Bat-Signal lamp(3).png

This is the last step in the build process. The circuit is very simple. In our code, we have defined D5, D6 and D7 pins of the Nodemcu to Red, Green and Blue colors respectively. So we will connect the red pin of the LED to D5, green pin to D6 and blue pin to D7. Finally, we connect the cathode (-) of the LED to GND.

If you have trouble figuring out the correct pins of the LED, you can refer to the second image above. The longest pin is the cathode. Second longest pin is green and the rest are red and blue.

Done!

20230726_143209-01.jpeg
20230726_132432-01.jpeg
sketch1690471828267-01.jpeg

And there you have Baymax, your personal healthcare companion! He definitely looks very cute standing at the corner of the desk, or besude a book shelf. But this is not the end of the project! I have plans to add more healthcare features to him. For example, he can remind me to drink water every hour. We can have an NFC tag on the water bottle in the same way. Also, I plan on adding a PIR sensor to detect how long I have been sitting on my desk. He can remind me to take a walk if it's been too long. The possibilities are infinite.

Hope you enjoyed reading, and will make one too!

Photo Gallery :)

20230726_144617-01.jpeg
20230726_144258-01.jpeg
20230726_144448-01.jpeg
IMG20230726143201-01.jpeg
Screenshot_2023-07-27-20-35-14-17_29b563cd0bc4fd07bd0c105b17b28204_x4-01.jpeg

He looks too cute wherever I put him, so here are some pictures :)