Monitor Your Water-Tank Level Easily with Arduino Wireless Water-Tank Level Meter with Alarm

13 May 2023 Balmiki Mandal 0 µC - µP

Wireless Water-Tank Level Meter with Alarm using Arduino

Do you want to know the level of water in your tank and get an alarm when it reaches low levels? If so, you might need a wireless water tank level meter. This wireless water tank level meter can help you monitor and alert you when water levels reach critically low amounts. With this article, we will show you how you can build your own wireless water tank level meter with Arduino.

How Does the Wireless Water Tank Level Meter Work?

The wireless water tank level meter is simple to build and use. It consists of an Arduino board, an ultrasonic sensor, a transmitter module, and a receiver module. The sensor measures the water level in the tank and sends the information to the transmitter module, which in turn transmits the data wirelessly to the receiver module that is connected to the Arduino board.

The Arduino board then processes the data from the receiver module, and compares it against a pre-configured threshold level. If the water level is lower than the threshold, the Arduino board triggers an alarm, either via an LED or a buzzer.

Materials Needed to Build a Wireless Water Tank Level Meter with Arduino

  • Arduino Board
  • Ultrasonic Sensor
  • Transmitter Module
  • Receiver Module
  • LED/Buzzer (Optional)
  • Power Supply
  • Jumpers and Wires

Steps to Build a Wireless Water Tank Level Meter with Arduino

  1. Set up the Arduino Board. Connect the Ultrasonic Sensor's Trig and Echo pins to Digital pin 8 and 9 respectively on the Arduino board. Also, connect the power supply to the Arduino board.
  2. Connect the Transmitter module to the Arduino board. Connect the Data pin of the transmitter module to the Digital pin 12 of the Arduino board.
  3. Connect the Receiver module to the Arduino board. Connect the Data pin of the Receiver module to the Digital pin 11 of the Arduino board.
  4. Connect the power supply to the ultrasonic sensor and both the Wireless modules.
  5. Connect the LED/Buzzer (optional) to the Arduino board.
  6. Upload the code to the Arduino board. Here is the code for the wireless water tank level meter:
#include <Ultrasonic.h>   // Include Ultrasonic Header File
#include <SPI.h>           // Include SPI Library 
#include <VirtualWire.h>   // Include VirtualWire Header File

int trigPin = 8;    // Trigger pin of Ultrasonic Sensor connected to Arduino Pin 8 
int echoPin = 9;    // Echo pin of Ultrasonic Sensor connected to Arduino Pin 9 
int ledPin = 10;    // Buzzer/LED pin connected to Arduino Pin 10 
float threshold = 20; //Threshold Value 

Ultrasonic ultrasonic(trigPin, echoPin); // Define Ultrasonic Sensor 

void setup()
{
  Serial.begin(9600); // To debug, open serial monitor 
  pinMode(ledPin, OUTPUT); 
  digitalWrite(ledPin, LOW);

  //VirtualWire Setup
  vw_set_tx_pin(12);  // Set Transmitter Pin 
  vw_set_rx_pin(11);  // Set Receiver Pin 
  vw_setup(2000);     // VW speed of 2000 bits per second 
}

void loop()
{
  float distance = ultrasonic.read();      // Read Ultrasonic Sensor 
  int value = (int)distance;              // Convert float to int 
  char payload[VW_MAX_MESSAGE_LENGTH];    // Create Payload 
  char* entry = "Tank Level";             // Define Payload Entry 
  
  snprintf(payload, VW_MAX_MESSAGE_LENGTH, "%s-%d",entry,value); // Add Payload entry and data to payload 
  vw_send((uint8_t *)payload, strlen(payload));                  // Send payload 
  vw_wait_tx();                                                   // Wait until packet is transmitted 
  
  Serial.print("Distance: ");
  Serial.print(distance);                                        // Print Distance for debugging 
  
  if(distance < threshold){                                       // Check Water Level 
    digitalWrite(ledPin, HIGH);                                  // Turn ON Alarm (LED/Buzzer)
    delay(300);                                                 
    digitalWrite(ledPin, LOW);                                   // Turn OFF Alarm (LED/Buzzer)  
  }

delay(500);                                                      // Delay 
}

Conclusion

That’s it! You have successfully created a wireless water tank level meter with Arduino.The wireless water tank level meter helps you monitor the amount of water in the tank and set alarms when it reaches critically low levels. We hope that this tutorial has been helpful to you in creating your own wireless water tank level meter.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.