Wireless Water Level Controller
2184 11
Piyush Sinha

Wireless Water Level Controller

This project is based on a water tank management system. When the water level will reach a certain...

Description:-

This project is based on a water tank management system. When the water level will reach a certain height, then the water pump will automatically off. This setup is completely wireless. I have used Bluetooth communication in this project. Ultrasonic sensor will detect the level of water then it will send the data to Pump. This project can help to save water. We can apply this whole setup in our home.

Project Used Hardware

Arduino pro mini Microcontroller IC, Ultrasonic Sensor, HC-05 Bluetooth module, 270 Ohm & 10 Ohm resistors, 7805 voltage regulator, Water pump, Relay module.

Project Used Software

Arduino IDE

Project Hardware software Selection

Atmega328P Microcontroller IC Arduino pro mini Microcontroller is the most widely used standalone Atmega IC for electronics projects. Arduino pro mini is compact in size. We can mount this on over heads water tank.

Ultrasonic Sensor: The Ultrasonic Senor uses Ultrasonic waves to determine the distance of an object like Bats, hence it can be used as a distance measuring sensor. There are two Ultrasonic Transducers present in which one acts as a transmitter which transmits a high frequency Ultrasonic signal and other acts as a receiver which will wait for the receiving of echo signal which gets reflected by any object in its path. The time between the two signals when divided by speed of sound gives us the distance of the object. Theoretically, the sensor claims to have a measuring distance of 2cm to 400cm. However, a range up to 75-80cm can be easily achieved practically. They are cheap, easy to interface and require low power to operate. They can be used to measure the depth of water as waves can travel in water, detect and avoid obstacles in the path of a robot and also as a parking assist sensor.

Relay Module: Relays are the most commonly used switching devices used in electronics. It can be used to switch high current loads easily unlike transistors which are limited by the maximum current that can flow through them and also can’t switch AC loads. This 5V/3.3V two Channel 10A Relay Module can switch both AC and DC loads. It is an Electromagnetic switch. When the coil inside is energized with a small current, it can switch ON or OFF the high current circuit. It has PCB screw terminals to directly connect. They can be used in Home automation to switch ON or OFF the appliances, in Electronic circuits to perform switching operations, in safety circuits to disconnect or connect the heavy loads in case of any dangerous situation, in Automobile applications like turning on windscreen wipers, power windows fuel pump, cooling fan, etc.

7V Power Supply Module: Here I used two batteries, 7 volt DC battery I used in ultrasonic sensor, it will supply power ultrasonic sensor, transmitter HC-05, Arduino pro mini.

Water Level Controller

Wireless Water Level Controller

Arduino Water Level Controller

Arduino Water Level Controller

Circuit Diagram

This project has two parts.

Transmitter side: First I connected the battery to the whole system, then I have used a voltage regulator, that is 7805, it will convert the input voltage to 5volt. Then I have given 5 volts to ultrasonic sensor, HC-05 and Arduino pro mini. Ultrasonic sensor will sense the level of water, and it provides output signal to Arduino pro mini (transmitter). Arduino pro mini will send this output signal to HC-05 and it will send this signal to receiver side.

Receiver Side: On the receiver side, I connected hc05, Arduino pro mini, relay, and water pump. Receiver HC-05 will receive the signal from transmitter HC-05. Then it will send the signal to Arduino pro mini. Then Arduino pro mini will send signal to relay for switching the pump. Here I used Arduino UNO just for supplying 5V DC voltage to the circuit.

Water Level Controller Circuit

Water Level Controller Circuit

Code

Project Code / Firmware 
Bluetooth Configuration Code
#include <SoftwareSerial.h>
#define tx 2
#define rx 3
SoftwareSerial configBt(rx, tx); // RX, TX
void setup() 
{
  Serial.begin(38400);
  configBt.begin(38400);
  pinMode(tx, OUTPUT);
  pinMode(rx, INPUT);
}
void loop() 
{
  if(configBt.available()) //if the bluetooth module is sending something...
  {
    Serial.print(configBt.readString()); //print whatever the bluetooth module is sending 
  }  
  if(Serial.available()) //if we have typed anything into the serial monitor input text box...
  {
    configBt.write(Serial.read()); //write whatever we typed into the serial monitor input text box to the bluetooth module
  }
}
Transmitter Code
#include <SoftwareSerial.h>
#define tx 2
#define rx 3
int const trigPin = 5;
int const echoPin = 4;
int state;
int led = 6;
int duration, cm;
SoftwareSerial bt(rx,tx); //RX, TX
void setup() 
{
  Serial.begin(9600);
  bt.begin(38400);
  pinMode(tx, OUTPUT);
  pinMode(led, OUTPUT);
  pinMode(rx, INPUT);;
  pinMode(echoPin, INPUT)
  pinMode(trigPin, OUTPUT);
}
void loop() 
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
// convert the pulse travel time into a distance
cm = microsecondsToCentimeters(duration);
if(cm >=15){
   digitalWrite(led, HIGH);
   bt.write('1');
 }
   else{
    digitalWrite(led, LOW);
    bt.write('0');
   }
//delay(1000);
}
long microsecondsToCentimeters(long microseconds)
{
return microseconds / 29 / 2;
}
Receiver Code
#include <SoftwareSerial.h>
#define ledPin 4
char state = 0;
#define tx 2
#define rx 3
SoftwareSerial bt(rx, tx); //RX, TX
void setup()
{
  pinMode(ledPin, OUTPUT);
  //digitalWrite(ledPin, LOW);
  Serial.begin(9600);
  bt.begin(38400);
  pinMode(tx, OUTPUT);
  pinMode(rx, INPUT);
}
void loop()
{
  if(bt.available()>0)
  {
    state = bt.read();
    Serial.print(state);
  }
   if (state == '1') {
  digitalWrite(ledPin, HIGH); // LED ON
  //state = 0;
 }
   if (state == '0'){
  digitalWrite(ledPin, LOW); // LED ON
 // state = 0;
   //delay(500); 
}
}