Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino and ESP8266 Nodemcu Based Smart Water Level Monitoring System

View and Edit Project In Cirkit DesignerImage of Arduino and ESP8266 Nodemcu Based Smart Water Level Monitoring System

Circuit Documentation

Summary

This circuit is designed to monitor water levels using an ultrasonic sensor and control a water pump accordingly. It features visual indicators (LEDs) and an audible alert (buzzer) to signal water level status. The system is controlled by an Arduino UNO microcontroller, which communicates with an ESP8266 NodeMCU for potential IoT capabilities. A 5V relay is used to switch the water pump on and off, and a 5V adapter provides power to the circuit.

Component List

Buzzer

5V Adapter

5V Relay

ESP8266 NodeMCU

LED: Two Pin (Green)

LED: Two Pin (Red)

5V Mini Water Pump

Ultrasonic Sensor

Arduino UNO

Wiring Details

Buzzer

5V Adapter

5V Relay

ESP8266 NodeMCU

LED: Two Pin (Green)

LED: Two Pin (Red)

5V Mini Water Pump

Ultrasonic Sensor

Arduino UNO

Documented Code

Arduino UNO Code (sketch.ino)

void setup() {
  pinMode(8, OUTPUT); // Trigger pin
  pinMode(9, INPUT);  // Echo pin
  pinMode(10, OUTPUT); // Buzzer
  pinMode(11, OUTPUT); // Red LED
  pinMode(12, OUTPUT); // Green LED
  pinMode(7, OUTPUT);  // Relay control
  Serial.begin(9600);  // Communication with ESP8266
}

void loop() {
  // Measure water level
  long duration, distance;
  digitalWrite(8, LOW);
  delayMicroseconds(2);
  digitalWrite(8, HIGH);
  delayMicroseconds(10);
  digitalWrite(8, LOW);
  duration = pulseIn(9, HIGH);
  distance = (duration / 2) / 29.1;

  if (distance < 10) { // Water level low
    digitalWrite(11, HIGH); // Red LED on
    digitalWrite(10, HIGH); // Buzzer on
    digitalWrite(7, HIGH);  // Turn on water pump
    Serial.println("LOW WATER LEVEL");
  } else if (distance > 30) { // Water level full
    digitalWrite(12, HIGH); // Green LED on
    digitalWrite(10, HIGH); // Buzzer on
    digitalWrite(7, LOW);   // Turn off water pump
    Serial.println("FULL WATER LEVEL");
  } else {
    digitalWrite(11, LOW); // Red LED off
    digitalWrite(12, LOW); // Green LED off
    digitalWrite(10, LOW); // Buzzer off
  }

  delay(1000); // Wait for a second before next measurement
}

This code configures the Arduino UNO pins for input and output to interface with the ultrasonic sensor, LEDs, buzzer, and relay. It contains a loop that measures the water level and activates the appropriate indicators and controls the water pump based on the measured distance. Serial communication is established for potential data transmission to the ESP8266 NodeMCU.