close
KnowledgeBase

Water Level and Weight Monitoring using Waterproof Ultrasonic Sensor and HX711 Load Cell, with Blynk App

Overview

This project aims to develop wireless monitoring using IoT Technology to interface the data acquired from the sensors to your smartphone. The project uses Blynk IoT platform to handle the data acquired. Two sets of sensor data are monitored: (1) water level, and (2) weight. The water level monitoring is part of an automated pumping system which
automatically fills a tank with water if the water level is too low.

Hardware Used

Parts Overview

Image result for doit esp32
ESP32 Dev Board is a combo Wifi and Bluetooth development board compatible with the Arduino IDE. It’s already integrated with antenna and RF balun, power amplifier, low-noise amplifiers, filters, and power management module. The entire solution takes up the least amount of printed circuit board area. This board is used with 2.4 GHz dual-mode Wi-Fi and Bluetooth chips by TSMC 40nm low power technology, power and RF properties best, which is safe, reliable, and scalable to a variety of applications.
JSN-SR04T waterproof ultrasonic distance sensor is suitable for outdoor applications such as car reversing sensors, security alarms, industrial inspection, outdoor water level sensing, and many more. This sensor has a distance measurement range of 20cm – 600cm.
The working principle of an ultrasonic sensor it that a pulse is transmitted at time 0, and is reflected back by an obstacle or barrier. The sensor receives this reflected signal and converts it to an electric signal. The next pulse can be transmitted when the echo fades. This time period is called cycle period. The recommend cycle period should be no less than 50ms. If a 10μs width trigger pulse is sent to the signal pin, the ultrasonic module will output eight 40kHz ultrasonic signals and detect the echo back. The measured distance is proportional to the echo pulse width and can be calculated by the formula above. If no obstacle is detected, the output pin will give a 38ms high level signal.
Related image
The Load Cell sensor and Load Cell Amplifier module is shown above. The load cell amplifier is a small breakout board for the HX711 IC that amplifies very small strain/force measurements, and allows you to easily read analog data to measure weight. By connecting the amplifier to your microcontroller you will be able to read the changes in the resistance of the load cell and with some calibration you’ll be able to get very accurate weight measurements. This can be handy for creating your own industrial scale, process control, or simple presence detection.
Load cells use a four wire Wheatstone bridge to connect to the HX711 chip.
A Wheatstone bridge has four resistors forming the sides of a diamond shape. A battery is connected across one pair of opposite corners, and a galvanometer across the other pair.
Wheatstone bridge is illustrated above. It is an electrical circuit used to measure an unknown electrical resistance by balancing two legs of a bridge circuit, one leg of which includes the unknown component. The primary benefit of the circuit is its ability to provide extremely accurate measurements (in contrast with something like a simple voltage divider). Its operation is similar to the original potentiometer.

Library Used

Software Used

Hardware Set-up

Schematic Diagram
This is the Schematic diagram for the entire system
This is the actual circuit of the system.
This must be the set up for the load cell so that it will properly flex when a certain load is being measured. You can put any spacer as long as it will elevate your load cell .

Software Set-up

First we need to set up a Blynk account. In order to use Blynk we must download first the application from Google play if you’re using Android or App Store if using Apple otherwise.

Here are the steps in setting up Blynk :

1. Create Account

After you download the Blynk App, you’ll need to create a New Blynk account. This account is separate from the accounts used for the Blynk Forums, in case you already have one.

We recommend using a real email address because it will simplify things later.


An account is needed to save your projects and have access to them from multiple devices from anywhere. It’s also a security measure.
2.Create a New Project
After you’ve successfully logged into your account, start by creating a new project.
3. Choose Your Hardware
4. Get your Authentication Token
Click the icon and it will direct you to your project settings.
Authentication Token is a unique identifier which is needed to connect your hardware to your smartphone. Every new project you create will have its own Authentication Token. You’ll get Authentication Token automatically on your email after project creation. You can also copy it manually. Click on devices section and selected required device .
5. Adding Widgets
Now after generating your authentication token you can now add Widgets by clicking the icon and add widgets such as button, displays etc.
In choosing your Widgets you can drag and drop the widgets that you want but take note of your Energy balance if it is your first time without any projects created in your account it is usually 2000 energy balance.

Here are more tutorials and projects on Blynk.

Code:

This is for the calibration of your load cell. The number 0.173  represents the known weight, in my case I used the weight of my cellphone as my reference for the known weight. For more information about calibrating your load cell follow this link https://www.youtube.com/watch?v=pZpzdu97JYw  

This is the code for the final system. As you can see there is no other statements on  the loop function other than the blynk.run() which does the handling and interfacing of output data.

Code Breakdown

This Function is for getting the distance and automatically convert it to cm

This is for sending the data gathered from the hardware, to the Blynk server.

This is a main blynk routine responsible for keeping connection alive, sending data, receiving data, etc.

 This macro instance allows you to send data periodically with given intervals not interfering with Blynk library routines.

These are the output data gathered from the hardware to the blynk application.
This is the final output for our water level sensor. As you can see there are times that it reads 0, this is because the reception beam of the ultrasonic sensor is very wide but overall the reading from the sensor is accurate .
This is the final output for the Load cell as well as the data read from the ultrasonic sensor.

Conclusion

The project needs a more thorough calibration and a fixed mechanical enclosure. Specially the load cell, we need to mount and fix it properly so that the platform is sturdy and stable across the full range of loads that can possibly be placed above it. But overall the data gathered and the functionality of the system is accurate. Also the Blynk platform offers a fast way to prototype an IoT application.

Reference

Tags : arduinoblynkdistance sensorESP32ESP32 dev boardhx711iotLoad Cellpumpsolenoidultrasonic sensorWater Levelwater pumpwaterproofwifi

Leave a Response


Warning: Cannot assign an empty string to a string offset in /home/createl1/public_html/community/wp-includes/class.wp-scripts.php on line 486

Warning: Cannot assign an empty string to a string offset in /home/createl1/public_html/community/wp-includes/class.wp-scripts.php on line 486