This project to check water level in tank if water level < 20% pump will start and when water level > 80% pump will stop with HC-SR04 ultrasonic sensor, show data in 0.96 inch OLED Display and send distance to firebase realtime database for React dash board in next project, with Blynk.
Dashbased for monitor by Reacjs: https://github.com/kreangsak-project-sharing/react-dashboard-water-level
- Arduino core for ESP8266 WiFi chip: https://github.com/esp8266/Arduino
- Firebase Realtime Database Arduino Library for ESP8266 and RP2040 Pico: https://github.com/mobizt/Firebase-ESP8266
- Adafruit_SSD1306: https://github.com/adafruit/Adafruit_SSD1306
- Blynk Library: https://docs.blynk.io/en/blynk-library-firmware-api/installation/install-blynk-library-in-arduino-ide
#define BLYNK_TEMPLATE_ID "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#define BLYNK_TEMPLATE_NAME "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#define BLYNK_AUTH_TOKEN "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#define FIREBASE_HOST "Firebase database URL"
#define FIREBASE_AUTH "Database Secrets"
#define WIFI_SSID "Wifi Username"
#define WIFI_PASSWORD "Wifi Password"
IPAddress ip(192, 168, 0, 100); //Wifi IPAddress
int maxDist = 1000; // Tank Height or full water level you need in millimeters
LED & Relay | NodeMCU ESP8266 | Remark |
---|---|---|
LED Wifi Status | D3 | Check wifi connection |
LED Pump Working | D4 | Check pump working |
LED Pump Stop | D5 | Check pump stop |
Pump Start for Relay | D6 | Replace this to relay |
HC-SR04 Pin | NodeMCU ESP8266 |
---|---|
VCC | VU |
TRIG | D7 |
ECHO | D8 |
GND | GND |
0.96 inch OLED Display | NodeMCU ESP8266 |
---|---|
GND | GND |
VDD | 3V |
SCK | GPIO 5 (D1) |
SDA | GPIO 4 (D2) |
- Can change pumpstartmanual state to ture for start pump when water level < 80%
- Can change pumpstopmanual state to ture for stop pump
- Can change resetboard state to ture for restart board
- Login to https://blynk.cloud/dashboard/login
- Add datastreams value as picture, in mobile app will show follow this.
- Dashbased for monitor by Reacjs: https://github.com/kreangsak-project-sharing/react-dashboard-water-level
- Arduino monitor water level with NodeMCU ESP8266 + firebase: https://github.com/kreangsak-project-sharing/arduino-water-level-firebase-realtime