Hydrator - a Device That Motivates You to Drink Water
by Arpan Mondal in Circuits > Arduino
4151 Views, 30 Favorites, 0 Comments
Hydrator - a Device That Motivates You to Drink Water
Drinking enough water is very important for everyone. But everyday I end up drinking less water than how much I should. I know there are people like me who need to be reminded to drink water. If you're one of us, then this project will change your life (probably).
Meet the Hydrator! This device will motivate you to drink water. How? It works like a game. You'll have to keep your water bottle on top of it. Every hour, the ring around the base lights up. The light remains on until you pick up the bottle, drink water and place it back. After which, the light turns off until the next hour.
But what's so motivating in that? Well it is in the light ring. The light is blue in the beginning. Every time you miss drinking water, the color of the light slightly shifts towards red. The more number of times you miss your reminder, the more red it becomes. Basically it goes from blue to violet and eventually to complete red. Your goal is to keep the color of the light as close to blue as possible by the end of the day.
This was just a basic overview of what it does. You'll get to know the exact working as you read through this instructable.
Interesting? Let's make it! Drink a glass of water and sit back as I take you through the build process!
Supplies
An old CD
Common cathode RGB LED https://www.amazon.com/Water-clear-Color-Common-Ca...
NodeMcu (ESP8266) https://www.amazon.com/AZDelivery-Nodemcu-Module-E...
Female - Female jumper wires (optional) https://www.amazon.com/LANDZO-Multicolored-Breadbo...
5v USB power supply https://www.amazon.com/Travel-Charger-Adapter-Sams...
Sand paper
Black chart paper
Making the Base
I have kept this simple. No fancy equipment or parts. Take an old CD and use a sandpaper to remove the cover on one side. You'll see that the CD starts becoming transparent. Once you've removed most of the material, sand the other side too. This will give it a frosty look so that the light can disperse well. have
Now take a black chart paper and cut out a circle that's exactly the same size as that of the CD. Now, make a ring anywhere around the center using a compass. An easy way to cut the ring out is by folding the paper in half and cutting along the marking.
Once done, you can stick the paper on the CD as in the image above. Now you should have a CD with only a ring of transparent area.
Support for the Base
For this, I took a noodle cup and cut out the top portion. All you need to do is stick it to the base to give it some height. Make a small notch in it for the LED wires to pass through.
Then, take a cap that fits it (the cap from the same noodle cup should be fine) and place it on the cut out cup. Do not stick it now because we still need to stick an LED inside.
Electronics
Also, to detect when the bottle is placed and when it is being lifted, we need to use an IR proximity sensor.
The connections are very simple. Just follow the diagram above. Don't get confused with the D0 of the sensor and D0 of Nodemcu. In the sensor, D0 indicates Digital Output. To avoid confusion, I have not used the D0 of Nodemcu for any purpose. You can leave it untouched.
Also, D2 is connected to D3 directly with a wire.
Now you may ask, why use a Nodemcu and not an Arduino? Well you can use an Arduino too. It depends on your code. My code connects to the internet which makes it more accurate.
Code and Working
There are two codes here. Hydrator and Hydrator pro (inspired from how smartphones are named :p)
Don't worry, both are free, you don't have to pay me.
Note: In the code, you'll have to make some changes.
You have to add your wifi ssid and password in the program where it says 'YourNetworkName' and 'YourPassword'. Also the 'YourAuthToken' should be replaced with the auth token you received from blynk (explained in following steps)
First let me explain what the code does.
The Nodemcu is connected to the internet through a service called Blynk. Blynk is in turn connected to another service called IFTTT.
In the following steps, we will be configuring IFTTT to send a signal to the Nodemcu every hour at :00
So every hour, the Nodemcu receives the signal and turns the LED on. If we lift the bottle to drink water, the proximity sensor detects it and the Nodemcu turns off the LED.
If we're not lifting the bottle, the Nodemcu waits for 10 minutes for us to complete the task. In case we don't do it in 10 minutes, the Nodemcu makes the colour of the LED little more red (increments the value of red colour by 25 and decrements blue by 25) and turns off the LED. So next time when the light turns on (next hour), it will be a little more red than before, indicating you've missed drinking water last hour. If you keep missing each hour, the LED becomes more and more red, and finally at the end of the day, it becomes completely red.
So now what's with the pro version of the code? It's the same as the normal version but with added notification alerts. This version notifies you to drink water before the 10 minute delay ends (at around 7 minutes) via a notification on your phone.
Also at the end of the day if the colour of the LED is too close to red, it sends you another notification. I haven't tested this particular code so if you try it out, do let me know if it works.
Configure IFTTT
Install IFTTT on your phone.
Now follow the images.
Click on +, select "this" and select "date and time". Select "Every hour at" then "00"
Now click on "that" and search for "webhooks" on the search bar. Click on "make a web request" and enter the URL. The URL format is https://IP/Auth/update/D4
Replace Auth with the Auth token of the blynk project (explained in next step) and IP with blynk cloud IP of your country. To get the IP, open command prompt and type "ping blynk-cloud.com". For India, the IP is 188.166.206.43
Select "put" in the method section and select "application/json" in the content type. In the body, type ["1"].
Configure Blynk
Install Blynk.
Create a new project. An Auth token will be mailed to you. This is the one you have to add in the URL in previous step and in the program.
Tap on the "+" and add a Button from the widget box. In the button settings (which you can open by tapping on the button), select the PIN as "GP4" and slide the toggle towards "switch".
Good news! We're done, all that is left is the assembly.
Assembly
Stick the RGB LED inside the base. For placing the Nodemcu and sensor, I made a small black cardboard box and stuck it to the base with superglue. Also a small hole should be made in the box for the Nodemcu power supply to pass through. Make sure the sensor isn't too far and can detect the bottle.
All Done!
All you need to do is plug in the the power supply to the Nodemcu (a smartphone charger should do fine) and place your water bottle on the Hydrator! The Nodemcu will automatically connect to your WiFi network and you can wait for the reminder to pop!
Of course it might not seem very practical to some people. But I can see it being useful for other purposes too. For example it can work as a reminder to take medicines for old people who keep forgetting. A little tweaking of the code can get it to work the way you want it to.
Hope you enjoyed this project. Good luck on making one for yourself!