Bagaimana Cara Membuat Sistem Pemantauan Ketinggian Air Menggunakan Aplikasi Blynk


How to make a water level monitoring system with the new Blynk app

Hello and welcome back. In this project, we will learn how to make a  water level monitoring system with the new  Blynk app. For that, I used the  Nodemcu ESP8266 board. Also, an ultrasonic sensor is used to measure the  water level and a 5VDC 10A relay module is used to activate the water pump. It depends on your requirement. (You have to select the relay module according to the water pump you are using) Also, if you are using this project in practice, please use a waterproof ultrasonic sensor. Then, this system can be used for a long time. Finally, I would like to say that we can control and monitor this system using our smartphone or computer. We can also see these values on the LCD screen and LED indicators. I think this is a good advantage for us.

If you want to visit it with the old  Blynk app, please use this link.

Ok, let’s do it step by step. The required components are given below.

Ezoic

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.


Step 2

Secondly, place the Nodemcu board and LEDs on the breadboard. And then, connect the resistors for the LED bulbs.

Step 3

Thirdly, connect the LED bulbs to the Nodemcu board. For that, use the circuit diagram below.

Ezoic

Step 4

Now, connect the LCD screen, ultrasonic sensor, and relay module to the Nodemcu board. Please use the circuit diagram above.

Ezoic

Step 5

Now, let’s set up the  Blynk web app step by step. For that, follow the instructions below.

  • First, go to the  Blynk website and create a new account using your email address. And then, log in to your account and create a new template for this project.

  • Now, click the datastream tab and create two data streams for that.
  • Virtual PIN / Name —  Water level / PIN — V0 / MIN — 0 / MAX — 20 (The height of the  water tank)
  • Virtual PIN / Name —  Water pump / PIN — V1 / MIN — 0 / MAX — 1

  • After, click the web dashboard tab and create a suitable web dashboard for this project. For that, I used a button and one gauge widget.
  • Ezoic

  • Now, click the one-by-one setting buttons on the widgets and select the  water level data stream for the gauge widget and the water pump data stream for the button widget. Finally, click the save button.
Ezoic
  • Next, click the search icon button and create a new device. For that, select the template you created earlier.

OK, the  Blynk web dashboard is ready for us.

Ezoic

Step 6

Now, let’s set up the  Blynk mobile dashboard for this project. For that, follow the instructions below.

  • First, download and install the Blynk app on your smartphone. Then, click the template you created on the web dashboard.

  • Next, add a button widget and one gauge widget to the dashboard. And then, customize these widgets as you like.

  • Now, select the “water level” data stream for the gauge widget and the “water pump” data stream for the button widget. And then, name these widgets as you like.
  • Ezoic

Ok, the Blynk mobile dashboard is ready for us.

Step 7

Ok, now connect the Nodemcu board to the computer and upload the program for this system. It’s as follows.

Ezoic

/*Water level monitoring system with the New Blynk app
   Home Page
*/
//Include the library files
#include <LiquidCrystal_I2C.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

//Initialize the LCD display
LiquidCrystal_I2C lcd(0x27, 16, 2);

char auth[] = "";//Enter your Auth token
char ssid[] = "";//Enter your WIFI name
char pass[] = "";//Enter your WIFI password

BlynkTimer timer;

// Define the component pins
#define trig D7
#define echo D8
#define LED1 D0
#define LED2 D3
#define LED3 D4
#define LED4 D5
#define LED5 D6
#define relay 3

//Enter your tank max value(CM)
int MaxLevel = 20;

int Level1 = (MaxLevel * 75) / 100;
int Level2 = (MaxLevel * 65) / 100;
int Level3 = (MaxLevel * 55) / 100;
int Level4 = (MaxLevel * 45) / 100;
int Level5 = (MaxLevel * 35) / 100;

void setup() {
  Serial.begin(9600);
  lcd.init();
  lcd.backlight();
  pinMode(trig, OUTPUT);
  pinMode(echo, INPUT);
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  pinMode(relay, OUTPUT);
  digitalWrite(relay, HIGH);
  Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);

  lcd.setCursor(0, 0);
  lcd.print("Water level");
  lcd.setCursor(4, 1);
  lcd.print("Monitoring");
  delay(4000);
  lcd.clear();

  //Call the functions
  timer.setInterval(100L, ultrasonic);
}

//Get the ultrasonic sensor values
void ultrasonic() {
  digitalWrite(trig, LOW);
  delayMicroseconds(4);
  digitalWrite(trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig, LOW);
  long t = pulseIn(echo, HIGH);
  int distance = t / 29 / 2;

  int blynkDistance = (distance - MaxLevel) * -1;
  if (distance <= MaxLevel) {
    Blynk.virtualWrite(V0, blynkDistance);
  } else {
    Blynk.virtualWrite(V0, 0);
  }
  lcd.setCursor(0, 0);
  lcd.print("WLevel:");

  if (Level1 <= distance) {
    lcd.setCursor(8, 0);
    lcd.print("Very Low");
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, LOW);
    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);
    digitalWrite(LED5, LOW);
  } else if (Level2 <= distance && Level1 > distance) {
    lcd.setCursor(8, 0);
    lcd.print("Low");
    lcd.print("      ");
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, HIGH);
    digitalWrite(LED3, LOW);
    digitalWrite(LED4, LOW);
    digitalWrite(LED5, LOW);
  } else if (Level3 <= distance && Level2 > distance) {
    lcd.setCursor(8, 0);
    lcd.print("Medium");
    lcd.print("      ");
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, HIGH);
    digitalWrite(LED3, HIGH);
    digitalWrite(LED4, LOW);
    digitalWrite(LED5, LOW);
  } else if (Level4 <= distance && Level3 > distance) {
    lcd.setCursor(8, 0);
    lcd.print("High");
    lcd.print("      ");
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, HIGH);
    digitalWrite(LED3, HIGH);
    digitalWrite(LED4, HIGH);
    digitalWrite(LED5, LOW);
  } else if (Level5 >= distance) {
    lcd.setCursor(8, 0);
    lcd.print("Full");
    lcd.print("      ");
    digitalWrite(LED1, HIGH);
    digitalWrite(LED2, HIGH);
    digitalWrite(LED3, HIGH);
    digitalWrite(LED4, HIGH);
    digitalWrite(LED5, HIGH);
  }
}

//Get the button value
BLYNK_WRITE(V1) {
  bool Relay = param.asInt();
  if (Relay == 1) {
    digitalWrite(relay, LOW);
    lcd.setCursor(0, 1);
    lcd.print("Motor is ON ");
  } else {
    digitalWrite(relay, HIGH);
    lcd.setCursor(0, 1);
    lcd.print("Motor is OFF");
  }
}

void loop() {
  Blynk.run();//Run the Blynk library
  timer.run();//Run the Blynk timer
}
  • Now, copy and paste the  Blynk auth token, It’s in the  Blynk web dashboard. For that, click the device info tab.
  • Ezoic

  • And then, enter your WIFI SSID and password. After, enter the height of the  water tank. I used a 20 cm  water cup for this project.
Ezoic
  • Now, select the board and port. After, upload this program to the Nodemcu board.

Ok, now you can test this project. The full video guide is below. So, see you in the next project or tutorial.

How to make a water level monitoring system with the new Blynk app

Posting Komentar

Lebih baru Lebih lama