Smart Cup
Team ID: Team AB
Team Member: Tong Lei; Shulin Liu; Jiarong Xie
Introduction
Smart cup aims to provide people a way to live a healthier life. With a special monitoring system, smart cup can track the water consumption of user and calculate the average water consumption in a specific period. If the average water consumption is below the recommended value, smart glass will gently remind user to drink more water. At the same time, smart cup can show the water temperature to make sure that user drinks the water with appropriate temperature. Besides, smart cup has a special liquid classification system to make sure user is drinking “real” water instead of unhealthy soft drink. Last, smart cup can also detect and show the environment temperature and humidity, which could remind user to drink more frequently if the weather is too dry.
Figure 1: Smart Cup
Motivation
• Health authorities commonly recommend eight 8-ounce glasses per day
• A typical adult naturally loses about 2-3 liters of water per day
• Benefits of drinking water:
- Lubricates the joints
- Forms saliva and mucus
- Regulates body temperature
- Helps maintain blood pressure
- Prevents kidney damage
Figure 2: Benefits of Drinking Sufficient Water
Goals
• Remind people to drink sufficient water
• Remind people to drink healthy water instead of soft drinks
• Remind people whether the water is ready to drink with appropriate temperature
• Remind people of the weather condition and drink regularly when it is dry
Methodology
Phenomena of Interest
• Measure the total weight of the cup to get the amount of liquid in the cup
• Measure the time to calculate the hourly water consumption
• Measure the light intensity at the bottom of the cup to get the types of liquid
• Measure the temperature of the water to make sure it is comfortable to drink
• Measure the temperature and humidity of environment
Sensors Used
• Weight Sensor: HX711
- Bracket diameter: 10CM
- Working voltage: 5V or 3.3V
- Test weight: 5KG
- Height: 3.5cm (including column)
- AD module: HX711 (24-bit high-precision A/D conversion chip HX711)
- Operating temperature range: -20 degrees - +85 degrees
- Accuracy after calibration: less than 1g
• Light Sensor: LM393
- Measure the light level at the bottom
- Input Voltage: 3.3V to 5V
- Signal output indicator light
- LDR module 4 PIN
- Able to detect ambient brightness and light intensity Adjustable sensitivity
• Temperature Sensor: DS18B20
- Measure the air temperature in the cup as an indicator of the water temperature
- Operating voltage: 3V to 5V
- Temperature Range: -55°C to +125°C
- Accuracy: ±0.5°C
- Output Resolution: 9-bit to 12-bit (programmable)
- Unique 64-bit address enables multiplexing
- Conversion time: 750ms at 12-bit
- Available as To-92, SOP and even as a waterproof sensor
• Temperature and Humidity Sensor: DHT11
- Measure the air temperature and relative humidity of the ambient environment
- Measurement Range: 20-90% RH, 0-50°C
- Humidity Accuracy: ± 5% RH
- Temperature Accuracy: ± 2°C
- Resolution: 1
- Package: 4 Pin Single Row
Logic Flow Chart
Figure 3: Logic Flow Chart
Experienments and Results
First Meeting
• Finalized the types of sensors that we need, including a weight sensor (HX711, ordered through Amazon), a temperature sensor (from provided sensor kit), a light sensor (from provided sensor kit), and a temperature and relative humidity sensor (from provided sensor kit)
• Made a prototype “smart-cup” with only temperature sensor and light sensor (weight sensor is on the way)
• Connected multiple sensors to Raspberry Pi, and organize the python code to show the output of sensors correctly
• With testing, we confirmed that the light sensor can detect the change of light density while changing the liquid above it from coffee into pure water. We also confirmed that the temperature of the air in the cup could be a good indicator of the temperature of liquid in cup
• Implemented the design details of “smart-cup”, including the placement of sensors, data that we need to set up a range for different types of liquid, method to eliminate the effect of ambient light outside the cup
Second Meeting
In this meeting, we tried to figure out whether we could use water level sensor to detect the volume of liquid in bottle. We designed an experiment. We added specific volume of water into the cup at a time with a water level sensor, then kept adding. We tried to find the linear relationship between the volume of water and water-level sensor output voltage. But just like the Figure 4 showing below, we did not find a linear relationship between these two variables. After water depth achieving 2 cm, the voltage kept staying at 1.8V. Thus, based on this experiment, we held the view that water level sensor was not a good choice for smart cup.
Figure 4: Water Level Sensor Voltage Output vs. Water Depth
Third Meeting
• We made a model of the smart cup and placed all sensors in it.
• Weight sensor calibration: at first, the output of the weight sensor was just a huge number which would decrease when we put more weight on it. Thus, we used a set of standard weights to do calibration on it, transferring its unit to ‘g’. The standard weights include 4 standard weights of 0.5 lb, 10 standard weights of 10 g. Different combinations of them were used to obtain as many as data points. For each weight, relatively stable sensor reading out was collected for about half a minute. The average of these data was used as the reading for calculation. R was used for processing the data. A linear model between the sensor reading and the actual weigh was assumed and regressed. The result is shown in Figure 6. The slope of the line is -0.00283, the intercept is 23460.(weight = -0.00283*output + 23460g)
Figure 5: Weight Sensor Calibration
Figure 6: Weight Sensor Output Value vs. Actual Weight
• We deigned an experiment to find out the threshold for light sensor to tell the difference between water and non-water liquid: we put the light sensor at the bottom of the cup and a LED light source on top. Then we put water and other soft drink in cup each time, recorded the output value of the light sensor. From the results in Figure 9, it is easy to find the difference among water and other soft drink. We set the threshold as 1V.
Figure 7: Types of Soft Drink
Figure 8: Running a Drink Type Test
Figure 9: Light Sensor Output vs. Different Types of Liquid
• Wrote a python code in Raspberry Pi, which was used to control the smart cup and upload the water consumption record to OpenChirp.
Figure 10: Non-Water Consumption from OpenChirp
Figure 11: Water Temperature from OpenChirp
Figure 12: Results on Terminal
Final Experiment
After finishing all parts of this smart cup, we conducted an experiment on it. At the beginning, there was 195 ml water in the cup. Then we drank 135ml water. After that, we drank the rest of the water and poured 300ml unclear soft drink in it. Next, we drank 200 ml soft drink. Then we drank the rest of them couple minutes later. The timeseries results from OpenChirp exactly matched our experiment.
Figure 13: Timeseries Results from OpenChirp
Discussion
This project provides us an opportunity to put the knowledge that we learn from class into practice:
• In this project, we use four different sensors: light sensor, weight sensor, temperature sensor and temperature & humidity sensor. During this project, we learn how to connect multiple sensors to the Raspberry Pi. Based on what we learn from course, we use different GPIO interfaces of Pi. Then we use python code to read data from sensors based on the number of those interfaces and manipulated with the data to obtain the information we need.
• We use OpenChirp to upload and visualize the water consumption record. It is the first time that we use IOT. We hold the view that IOT makes the transition of data between different devices much more convenient. The embed visualization function also provides us an efficient way to find the pattern of data.
• With collecting data from sensors, calibration and sending commands to the actuator, we become familiar with the complete process of using sensors. In a word, we know how to use sensors to design a product.
Although we spent a plenty of time on this smart cup, it is still not perfect. We can make a better version if we have more time and higher budget. For example, we only use the light sensor to tell if the liquid is water or not for now. But if we have enough sensors, we can buy more sensors and collect more information about the liquid, which could help us make better prediction about the type of the liquid.
This project also improves our ability to find problems and solve them. During this project, we met different kinds of problems. For example, we found the output of weight sensor was not stable with unpattern fluctuation one day. After checking, we found that we used the same GPIO interface for two sensors, which may arise some signal confliction. Thus, we used another interface to fix it.
Thanks to the assistance of Professor Mario and TAs, their help and patience make us finish this project successfully.
Reference
[1] https://www.healthline.com/nutrition/how-much-water-should-you-drink-per-day
[2] https://www.amazon.com/TeOhk-Electronic-Digital-Converter-Breakout/dp/B07SX2MYMX/ref=sr_1_9?keywords=hx711&qid=1571273390&sr=8-9
[3] http://kookye.com/2016/08/01/smart-home-sensor-kit-for-arduinoraspberry-pi/
[4] https://robu.in/product/lm393-photosensitive-light-dependent-control-sensor-module/
[5] https://components101.com/sensors/ds18b20-temperature-sensor
[6] https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf