top of page
Writer's pictureRamesh G

Bluetooth Controlled Water Level Controller

Updated: Jun 21


Water is one of the essential need for the survival of all human beings, animals and plants. The water overflow from the overhead tanks in the houses, commercial properties, educational institutions the percentage of water overflow wastage. To avoid such Spillage implementation of an automatic water level controller becomes a key factor which further reduces human intervention. In this Project work, an automatic water level controller using bluetooth wireless technology and Ultrasonic water level sensor is proposed.


This project can be further enhanced to control and animated the water level as follows.

Soft Slider - Automatic ON/OFF Pump

The water Pump automatic turning it ON, when the water level is reached LOW level set point, and water Pump automatic turning it OFF when the water level reached is HIGH level set point. The Low & High set point to be adjusted from 0 % to 100 % using slider from android app and value send to arduino and stored in Arduino EEPROM by pressing SET button in the android application.


Pushbutton- Tank height Set

A push button switch is provided for tank height set and value stored in Arduino EEPROM. If tank is empty then press to push button switch for tank height set in cm and value send to arduino and stored in EEPROM.


Gauge Display (Android)

The Cylindrical gauge display for water level percentage indication from 0 % to 100%.


Bar Graph Display (Android)

The Bar Graph LED display for water level percentage indication from 10 % to 100% by step 10.


Progress Monitor (Android)

The Progress Monitor display for water level percentage indication from 0 % to 100%.


Motor Indication (Android)

Pump Motor ON/OFF indicator for further animated display.


7 segment LED display (Android)

The final Arduino result is send to android application and displayed.


Thus, the Arduino water level indicator helps in preventing wastage of water in overhead tank. This project is wireless so, it is easy to install and it can work up to 400cm for HC-SR04 ultrasonic sensor.


Circuit diagram


Components required

Arduino Nano - 1 no

Bluetooth module HC-05 - 1no

HC-SR04 ultrasonic sensor-1no

1-Channel 5V Relay Module - 1no



HC-SR04 ultrasonic sensor

The Ultrasonic sensor has four terminals - +5V, Trigger, Echo, and GND connected as follows −

  • Connect the +5V pin to Vin Pin of Arduino Nano board.

  • Connect Trigger to digital pin D12 of Arduino Nano board.

  • Connect Echo to digital pin D13 of Arduino Nano board.

  • Connect GND with GND on Arduino Nano.

Datasheet Download


Bluetooth HC-05 Module

HC-05 is a Bluetooth module which is designed for wireless communication. This module can be used in a master or slave configuration. Bluetooth serial modules allow all serial enabled devices to communicate with each other using Bluetooth.

It has 6 pins,

Key/EN- NC

VCC to Connect 5 V power

GND to power Ground

TXD to Arduino Nano Rx (D0)

RXD to Arduino Nano Tx (D1)

State- NC


HC-05 module Information

HC-05 has red LED which indicates connection status, whether the Bluetooth is connected or not. Before connecting to HC-05 module this red LED blinks continuously in a periodic manner. When it gets connected to any other Bluetooth device, its blinking slows down to two seconds.

This module works on 3.3 V. We can connect 5V supply voltage as well since the module has on board 5 to 3.3 V regulator.

As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V level, so, no need to shift transmit level of HC-05 module. But we need to shift the transmit voltage level from microcontroller to RX of HC-05 module.

HC-05 Default Settings

Default Bluetooth Name: “HC-05”

Default Password: 1234 or 0000


Download Datasheet


Installing the Arduino Library

Download Ultrasonic library , we need to use this library.

Follow the next steps to install those libraries.


In your Arduino IDE, to install the libraries go to Sketch > Include Library > Add .ZIP library… and select the library you’ve just downloaded.


After installing the required libraries, copy the following code to your Arduino IDE.


Download Android application.


Android application

First open Mobile application and select Bluetooth image button, after that select Bluetooth HC-05 device to connect and enter Password as mentioned above (0000 or 1234).





Subscribe and Download code. Arduino Code

#include <Ultrasonic.h>

Ultrasonic ultrasonic(12, 13);


#include <EEPROM.h>


#define relay 7

#define buttonPin 10

int buttonState = 0;


char Character;

String Text;

String TankHigh;

String TankLow;

String water;

int CutOff;


int heightset;

int TankHeight;

//long distance;

int distance;

float percentage,math;

int LowCutoff;

int HighCutoff;

int Lowlevel;

int Highlevel;

void setup () {

Serial.begin(9600); // We initialize serial connection so that we could print values from sensor.

pinMode(buttonPin,INPUT);

pinMode(relay,OUTPUT);

Serial.setTimeout(200);

}


void loop () {

distance = ultrasonic.read();

//////////////////

if(Serial.available())

{

Character = Serial.read();

Text = Text + Character;


if (Character == '*') {

Text = Text.substring(0, Text.length() - 1); // Delete last char *

CutOff = Text.indexOf(',');

TankLow = Text.substring(0, CutOff);

TankHigh = Text.substring(CutOff+1, -1);

Text = "";

LowCutoff = (TankLow.toInt());

EEPROM.update(2,LowCutoff);

{LowCutoff= EEPROM.read(2); }


HighCutoff = (TankHigh.toInt());

EEPROM.update(4,HighCutoff);

{HighCutoff= EEPROM.read(4); }

delay(200);

}


}

/////////////////////////////////////

buttonState = digitalRead(buttonPin);

if (buttonState == LOW) // +RESISTOR, GND-BUTTON

{ TankHeight =distance;

EEPROM.update(0,TankHeight); }

{TankHeight= EEPROM.read(0); }

delay(200);

heightset= EEPROM.read(0);

Lowlevel= EEPROM.read(2);

Highlevel= EEPROM.read(4);

math = heightset-distance;

percentage = (math/heightset)*100;


if ((percentage >= 0) && (percentage <= 100))

if (percentage <= Lowlevel)

{

digitalWrite(relay, HIGH);

}

if (percentage >= Highlevel)

{

digitalWrite(relay, LOW);

}

Serial.print(distance);

Serial.print("|");

Serial.print(percentage);

Serial.print("|");

Serial.print(Lowlevel);

Serial.print("|");

Serial.print(Highlevel);

Serial.print("|");

Serial.print(TankHeight);

Serial.print("|");

Serial.print(digitalRead(relay));

Serial.print("\n");

delay(1000);

}



Recent Posts

See All

2 commenti


Ailtonmk Freitas
Ailtonmk Freitas
26 nov 2022
Congratulations..perfect project..could you send me the .aia file of this app I will be very grateful..e-mail ailtonmk@yahoo.com.br
Mi piace

M HR Helal
13 feb 2022

How to make this app by mit app inventor 2

Mi piace
bottom of page