|
|
If you follow all the
steps, you can easily make this IoT based water level monitoring system using ESP32 and Blynk app.
Let’s Start the project.
Materials Required
S.no
Material Name
Quantity
1
ESP32 DEV KIT V1
1
2
HC-SR04 sensor
1
3
0.96″ I2C OLED Display
1
4
220-ohm 0.25watt Resistors
2
5
BC547 NPN Transistor
1
6
LED 5mm
1
7
2-pin Push Button
1
8
2-pin Terminal connectors
3
9
5V DC Buzzer
1
10
L7805CV IC
1
11
PCB Board
1
Circuit of IoT Based Water Level Indicator.
v In the circuit, if you want to use AC voltage, then you have to use a PM01 AC to DC converter. Otherwise, you can directly give 5V DC supply to this circuit.
v The GPIO D26 & D27 are connected with Echo & TREG pin of the SR04M-2 waterproof ultrasonic sensor.
v The OLED SDA & SCL pins are connected with D21 & D22 GPIO of ESP32.
v GPIO D12 is connected with the push button to stop the buzzer. I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors with the push button.
v And the indicator LED and Buzzer are connected with GPIO D14 & D13 of ESP32.
v You can use any other ultrasonic sensor.
v The minimum distance between sensor and full tank water level must be greater than 25cm.
PCB Layout for Smart Water Level Indicator.
Front or Upper Side of PCB
Back or Wiring Side of PCB
Set up Blynk IoT Cloud for the IoT-based project.
You can refer to the following article to set up the new Blynk cloud account: -
https://iotcircuithub.com/blynk-iot-platform-setup-esp8266-esp32/
Create Blynk Template.
v During creating the template, I selected ESP32 as the hardware and the connection type as WIFI.
v In the template, I have created first DataStreams (Pin: V1, Datatype: Integer, Min Value: 0, Max Value: 100) to show the water level in tank in percentage.
v Second DataStream (Pin: V2, Datatype: String) will show the distance between sensor and water level in cm.
Add Automation in Blynk IoT.
v I have added Automation to get the LOW water Level notification in the Blynk IoT app.
v I have turned on the Condition and Action radio button for the first DataStream V1. Type of Automation will be “Sensor”.
Create Web Dashboard in Blynk Cloud.
v After that, click and drag 1 Gauge widgets, and 1 Level widget, and select the related DataStreams for each widget.v Then click on “Save” to save the template.
v Add Device in Blynk Cloud using Template
You can refer to the following article to set up the new Blynk cloud account: -
https://iotcircuithub.com/add-device-in-blynk-cloud-using-template/
For this IoT-based home automation project, I have used the Arduino IDE to program ESP32.
First update the Preferences –> Additional boards Manager URLs: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
• Then install the ESP32 board (2.0.5) from the Board manager or https://drive.google.com/uc?export=download&id=1jg7_S8ZCCgD__UZn0BqnulLm44lEseCL to download the ESP32 board.
• Download the required libraries from the following links:
ü Blynk Library (Version 1.1.0)
Link: https://drive.google.com/uc?export=download&id=1u4drknPjoA2qS1mE6QPC0w7DcYhBTSSm
ü AceButton Library (Version 1.9.2)
Link: https://drive.google.com/uc?export=download&id=1tJ4g08a5KStHZLPuB4CO6UemjK5-0DU2
ü Adafruit_SSD1306 Library (Version 2.5.7)
Link: https://drive.google.com/uc?export=download&id=1oQnuxtN47w7Vl-Zif46o5QvLHeCjmUMn
Source Codes for Blynk ESP32 Water Level Sensor
Download the code through link: https://drive.google.com/uc?export=download&id=1tCZNA4gmxTAwNIm65RltnznsPjmy3GOC
è In the sketch, you have to update only the BLYNK_TEMPLATE_ID, BLYNK_DEVICE_NAME, Auth Token.
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
#define BLYNK_AUTH_TOKEN ""
è Enter the WIFI Credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
è Define Water Level Distance for empty tank and full tank in CM.
int emptyTankDistance = 70 ; //Distance when tank is empty
int fullTankDistance = 30 ; //Distance when tank is full
è Define trigger value in percentage, alarm will start when water level drop below triggerPer
//Set trigger value in percentageint triggerPer = 10 ;è Here I have defined the triggerPer 10%, but you can define any value like 5%, 20% etc.
è The ESP32 will only calculate the water level if the measured distance is between empty tank distance and full tank distance.
è After doing these changes, please upload the code to ESP32.
For PDF Click: Download
The End of Project
Copyright
by https://iotcircuithub.com/











Comments
Post a Comment