Sometimes, we forget simple but essential things with our busy lifestyle. Being a small thing doesn’t mean that it’s not important in our lives. You might be a coffee lover or a sweets lover. No matter who you are, you feel uncomfortable when you run out of the essential supplies at your home or even your office. This might make your whole day down.
Hence, a method or a system is much needed to remind us when our supplies are running low. This helps us to maintain our lives in a good manner without any obstacles. From my experience, I’m usually running out of A4 sheets as they are a vital part of my university studies. Most of the times, I notice this on Monday morning right before the lecture starts and I have to borrow some from my friends.
To avoid this, I have planned to build a device to alert me when my stationery is low. As I had the second thought of implementing this system to maintain the amount of the essential household items, I built a prototype circuit which can be used at home as well as at working places.
I planned to build this as a pocket sized portable device. Further, this device can be placed outside a transparent liquid container to detect the liquid level inside. Therefore, you can carry this anywhere and use it on a wide range of supplies according to its less space consuming and convenience of setting up properties.
BriefingThere are two main tasks that this device can perform.
1) Measure weight
2) Detect liquid level
Most of the times we can identify the amount remaining of our supplies by its weight or its liquid level. Therefore, I have included an option to calibrate the device to set the threshold values and it will automatically inform us by flashing a red LED when our supplies are getting lower than the given value. Using the selector switch you can select the method: weight measuring or the liquid measuring.
When our supplies are low usually we go shopping or we order them from online stores. To facilitate these two options I have added an ESP8266 module to connect this device to the home WiFi network. You can check the status of your supplies while you are on your way to home, by logging into the device from your smart phone and buy them if the supplies are low. So, you don’t have to come home, check the status of supplies and go shopping. For those who preferred online stores, I have added another option to order supplies automatically when they are low.
Let’s see how this device is built.
Components- ESP8266 board (NodeMCU) is acting as the central processing unit as well as the WiFi communicating system. Force sensitive resistor (FSR) is used to measure weights and the Sharp IR sensor is used to detect liquid levels.
- In Force Sensitive Resistor, the resistance between the tracks reduces when the sensor is pressed. Therefore, the total weight to be measured is applied to the Force Sensitive Resistor.
- Sharp IR sensor is mainly used to measure distances. However, using its method of measuring the distance, I have implemented a way to use this as a liquid level detector. The main advantage of this is, we can detect liquid level from outside of the container only if the container is transparent.
- An RGB LED is used to notify the status of the supplies and to give notifications to the user in the calibration process.
- One switch is used to select the weight measuring mode or the liquid level detection mode and another switch is used to calibrate high and low levels in the selected mode.
I have uploaded the schematic of the circuit under the schematic tab. Before soldering the components, it's better to make the circuit on a breadboard and test it. After making the circuit, the major part or the programming the NodeMCU is left.
Getting Started with the NodeMCUNodeMCU is a platform for developers as well as for those who are not familiar with electronics. Basically, it contains the ESP8266 module. As most people are familiar with Arduino programming, I will show you how to program the NodeMCU using the Arduino IDE.
- Open the Arduino IDE. Go to Tools > Board > Boards Manager.
- Select the ESP8266 from the list and install “esp8266 platform”
- Go to Tools > Board and select NodeMCU 1.0 and select the correct COM port of your NodeMCU after connecting it to the computer.
- Now test the board by uploading the File > Examples > Basic > Blink, and check whether the LED on NodeMCU is blinking.
Follow the schematic of the circuit. I have used a vero board to solder the components together. Try to make it as small as possible to reduce the size of the device. The switch inside the box is the mode selection switch and the other one close to the LED is the calibration switch.
As the enclosure I found an old box with a suitable size. After placing the circuit board inside, the force sensitive resistor is placed at the bottom and stick a piece of Styrofoam to apply the pressure when the lid is closed. To make this a portable device, I have soldered a 9v battery clip to the Vin pin and Ground pin, so that no external power is needed.
If you cannot find a suitable enclosure, I have uploaded a CAD design of an enclosure. Cut the parts from 1mm plywood board using a laser cutter.
Basic ConfigurationLet's try to do something using our device. Here, I will show you how to use the device under the weight measuring mode. Use the "Email Notifier" code, in the attached code files. From this code, the device will automatically sends you an email when your supplies are low. I suggest to use this code, if you preferred go shopping by yourself. Before uploading the code, change following things.
- SSID and the Password of your WiFi network.
- Receiver's email address, subject and the Email body.
- Set the login details of your email address in Gsender.h file. Here, you have to enter the Email address and the password in the base64. Use this Base 64 Converter.
Now we have to set the threshold values for the device. Let's take a coffee bottle. Keep it on the device and set the switch to calibration mode. You can notice the flashing blue LED. Now reduce the weight of the bottle to set the minimum weight and add weight to the bottle to set the maximum weight. Set the switch to threshold position. Here you can check whether your device is calibrated correctly. If the weight is within the limit, the green bulb flashes and if it's below the limit, the red bulb flashes.
After set the calibration switch to the off position, the LED will turn off. Now the device is monitoring the weight of your coffee bottle. If the weight is low, the device flashes the red LED and send an email. The LED will remain flashing until you refill the coffee bottle.
You can use the same method to detect liquid levels. All you have to do is, change the mode selection switch and go through the above steps again.(Sorry for the low quality of the videos.)
Power ConsumptionWhen we are working with batteries, their lifetime is more important because if we do not focus on the power consumption we have to spend money on batteries as well. Therefore, I have added some features to reduce the power consumption of our device.
The device is not always connected to the WiFi. It connects only when it is needed to connect. From this, the efficiency is increased more than 80 percent. When we compared the power when connected to the WiFi, it is ten times larger than the idle power.
Further, you can set the time gap between the sensor readings to at least 6 hours. The time gap in the uploaded code is about 2 seconds. By this, the current needs to turn on the sensors are reduced and increase the efficiency more.
According to my calculation, a 9V battery can last for 5 days. If you can use 2 X AA batteries to power up the NodeMCU directly, it will last for 12 days. Using 2500mAh, 1 cell Li-Po battery you can run this device more than a month (Varies with the self discharge rate of the battery.)
Amazon DRSAmazon DRS or the Dash Replenishment Service helps you to refill your supplies by ordering them automatically when your supplies are low. If you do not prefer other methods of refilling you can use this service.
Now we know that our device can detect whether our supplies are low. All we have to do is to connect it with the Amazon DRS. I'm not going to explain everything to avoid this post being a much lengthier one and as Amazon provides detailed descriptions and step by step guide on DRS.
Follow this link to get the basic idea on Connecting a device with Amazon DR Service.
Getting Started with Amazon DRSBefore you begin, you have to create an Amazon Developer Account.
- After creating the account, go to the "Security Profiles" under the "Apps and Services" tab.
- Go to "Create new security profile".
- Set profile name and profile description as you desire.
- Go to Login with Amazon > Select the created security profile form the drop down list.
- Set the privacy notice URL to your website or to the blog and update the Logo.
- Go to Web settings under the Manage in your security profile > set origins and return URLs
- Note down the Security Profile ID, Client ID and Client Secret, Vendor ID as these fields are needed for the next steps.
Now we need to setup the Dash Replenishment Account. Go the the Dash Replenishment Service tab and click begin. Fill the required fields using the noted fields.
before proceeding ahead we have to create an SNS topic.
Follow this link on How to Create an SNS Topic.
Further details. SNS Notification Messages.
ConfigurationAfter creating your account and the setting the SNS service, you need to register the required product. Instructions are provided in the Amazon website.
To link Amazon DRS with our device, upload the DRS code to the NodeMCU.
After uploading, check WiFi connections. You can identify our device by "Home Supplies". Connect and type 192.168.4.1 IP address in the address bar. Click "Configure WiFi" from the WiFi manager. Now you can set your Home WiFi network details and DRS authorization code here.
After completing all these steps, you can continue the calibration process. If your preferred item is running low, the device will automatically request the Amazon DRS service.
Sum Up thingsThough I name this device as "Portable monitor for home supplies", this can be use in most places including your office, school, workshop etc. Usually, I don't like big devices which are used only for one specific task. Hence, I made this as small as possible to monitor almost your every type of supply. Following are the advantages of this device.
- Easy to build - Minimum number of components makes it easy even for non technical people
- Low cost - You can build several devices rather than building just one.
- Pocket sized and light weight - You can carry and setup this anywhere easily.
- Battery powered (Optional) - No need to connect lengthy wires to supply power.
- Can be used for almost every supply monitoring.
- Several Modes available according to user preferences.
- Liquid levels can be detected from outside - As you don't want any dirt in your milk or coffee.
Never run out of your supplies again with this handy device.Try to build this and comment here if there are any questions. I'm waiting to help you. Thank you for reading.
Comments