Professional Documents
Culture Documents
New Water Lavel
New Water Lavel
New Water Lavel
An ultrasonic water level controller is a device which can detect water levels in a tank
without a physical contact and send the data to a distant LED indicator in a wireless
GSM mode.
In this post we are going to construct a ultrasonic based solar powered wireless water
level indicator using Arduino in which the Arduinos would be transmitting and
receiving at 2.4 GHz wireless frequency. We will be detecting the water level in the
tank using ultrasonics instead of traditional electrode method.
Overview
There are many practical considerations before we design one.
• Nobody wants to drill a hole on water tank’s body for electrodes which might leak
water later on.
• Nobody wants to run 230 / 120 VAC wire near water tank.
• Nobody wants to replace batteries every month.
• Nobody wants to run additional long wires hanging on a room for water level
indication as it is not pre-planned while building the house.
• Nobody wants to use the water which is mixed with metal corrosion of the electrode.
• Nobody wants to remove the water level indicator setup while cleaning the tank
(inside).
Some of the reasons mentioned above may look silly but, you will find less satisfactory
with commercially available products with these cons. That’s why penetration of these
products are very less among the average households.
After considering these key points, we have designed a practical water level indicator
which should remove the cons mentioned.
Our design:
• It uses ultrasonic sensor to measure the water level so no corrosion problem.
• Wireless indication of water level real time at 2.4 GHz.
• Good wireless signal strength, enough for 2 story high buildings.
• Solar powered no more AC mains or replacing battery.
• Tank full / overflow alarm while filling the tank.
Let’s investigate the circuit details:
Transmitter:
The wireless transmitter circuit which is placed on the tank will send water level data
every 5 seconds 24/7. The transmitter consists of Arduino nano, ultrasonic sensor HC-
SR04, nRF24L01 module which will connect the transmitter and receiver wirelessly at
2.4 GHz.
A Solar panel of 9 V to 12 V with current output of 300mA will power the transmitter
circuit. A battery management circuit board will charge the Li-ion battery, so that we
can monitor the water level even when there is no sunlight.
Let us explore how to place the ultrasonic sensor at water tank:
Please note that you have to use your creativity to mound the circuit and protect from
rain and direct sunlight.
Cut a small hole above the tank’s lid for placing the Ultrasonic sensor and seal it with
some kind of adhesive you can find.
Now measure the full height of the tank from bottom to lid, write it down in meters.
Now measure the height of water holding capacity of tank as shown in the above image
and write in down in meters.
You need to enter these two values in the code.
Schematic diagram of Transmitter:
Make sure that your solar panel’s output power i.e. output (volt x current) is greater
than 3 watts. The solar panel should be 9V to 12V.
12V and 300mA panel is recommended which you can find easily on market. Battery
should be around 3.7V 1000 mAh.
5V 18650 Li-ion charging module:
The following image shows a standard 18650 charger circuit
The input can be USB (not used) or external 5V from LM7805 IC. Make sure that you
get the correct module as shown above, it should have TP4056 protection, which has
low battery cut-off and short circuit protection.
The output of this should to be fed to XL6009’s input which will boost to higher
voltage, using a small screw driver output of XL6009 should be adjusted to 9V for
Arduino.
Illustration of XL6009 DC to DC boost converter:
The receiver can show 5 levels. Alarm, when the tank reached absolute maximum water
holding capacity while filling tank. 100 to 75 % - All four LEDs will glow, 75 to 50 %
three LEDs will glow, 50 to 25 % two LEDs will glow, 25% and less one LED will
glow.
The receiver can be powered from 9V battery or from smartphone charger to
USB mini-B cable.
Code for Receiver:
// ----------- Program Developed by R.GIRISH / Homemade-
circuits .com ----------- //
#include <RF24.h>
#include<SPI.h>
RF24 radio(9, 10);
int i = 0;
const byte address[6] = "00001";
const int buzzer = 6;
const int LED_full = 5;
const int LED_three_fourth = 4;
const int LED_half = 3;
const int LED_quarter = 2;
char text[32] = "";
void setup()
{
pinMode(buzzer, OUTPUT);
pinMode(LED_full, OUTPUT);
pinMode(LED_three_fourth, OUTPUT);
pinMode(LED_half, OUTPUT);
pinMode(LED_quarter, OUTPUT);
digitalWrite(buzzer, HIGH);
delay(300);
digitalWrite(buzzer, LOW);
digitalWrite(LED_full, HIGH);
delay(300);
digitalWrite(LED_three_fourth, HIGH);
delay(300);
digitalWrite(LED_half, HIGH);
delay(300);
digitalWrite(LED_quarter, HIGH);
delay(300);
digitalWrite(LED_full, LOW);
delay(300);
digitalWrite(LED_three_fourth, LOW);
delay(300);
digitalWrite(LED_half, LOW);
delay(300);
digitalWrite(LED_quarter, LOW);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setChannel(100);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.startListening();
}
void loop()
{
if (radio.available())
{
radio.read(&text, sizeof(text));
Serial.println(text);
if (text[0] == 'S' && text[1] == 'T' && text[2] == 'O' &&
text[3] == 'P')
{
digitalWrite(LED_full, HIGH);
digitalWrite(LED_three_fourth, HIGH);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
for (i = 0; i < 50; i++)
{
digitalWrite(buzzer, HIGH);
delay(50);
digitalWrite(buzzer, LOW);
delay(50);
}
}
if (text[0] == 'F' && text[1] == 'U' && text[2] == 'L' &&
text[3] == 'L')
{
digitalWrite(LED_full, HIGH);
digitalWrite(LED_three_fourth, HIGH);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
}
if (text[0] == '3' && text[1] == '/' && text[2] == '4')
{
digitalWrite(LED_full, LOW);
digitalWrite(LED_three_fourth, HIGH);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
}
if (text[0] == 'H' && text [1] == 'A' && text[2] == 'L' &&
text[3] == 'F')
{
digitalWrite(LED_full, LOW);
digitalWrite(LED_three_fourth, LOW);
digitalWrite(LED_half, HIGH);
digitalWrite(LED_quarter, HIGH);
}
if (text[0] == 'L' && text[1] == 'O' && text[2] == 'W')
{
digitalWrite(LED_full, LOW);
digitalWrite(LED_three_fourth, LOW);
digitalWrite(LED_half, LOW);
digitalWrite(LED_quarter, HIGH);
}
}
}
// ----------- Program Developed by R.GIRISH / Homemade-
circuits .com ----------- //
That concludes the receiver.
NOTE: if no LEDs are glowing, which means the receiver can’t get signal from transmitter.
You should wait 5 seconds to receive the signal from transmitter after turning on the receiver
circuit.
Author’s prototypes:
Transmitter:
Receiver:
What is a 5V Relay Module : Working & Its Applications
Relay is one kind of electro-mechanical component that functions as a switch. The relay coil is
energized by DC so that contact switches can be opened or closed. A single channel 5V relay
module generally includes a coil, and two contacts like normally open (NO) and normally closed
(NC). This article discusses an overview of the 5V relay module & its working but before going to
discuss what is relay module is, first we have to know what is relay and its pin configuration.
What is a 5V Relay?
A 5v relay is an automatic switch that is commonly used in an automatic control circuit and to
control a high-current using a low-current signal. The input voltage of the relay signal ranges from 0
to 5V.
5V Relay Pin Configuration
The pin configuration of the 5V relay is shown below. This relay includes 5-pins where each pin
and its functionality are shown below.
Pin1 (End 1): It is used to activate the relay; usually this pin one end is connected to 5Volts
whereas another end is connected to the ground.
Pin3 (Common (COM)): This pin is connected to the main terminal of the Load to make it active.
Pin4 (Normally Closed (NC)): This second terminal of the load is connected to either NC/ NO
pins. If this pin is connected to the load then it will be ON before the switch.
Pin5 (Normally Open (NO)): If the second terminal of the load is allied to the NO pin, then the
load will be turned off before the switch.
Features
Normally Open (NO): This pin is normally open unless we provide a signal to the relay modules
signal pin. So, the common contact pin smashes its link through the NC pin to make a connection
through the NO pin.
Common Contact: This pin is used to connect through the load that we desire to switch by using
the module.
Normally Closed (NC): This NC pin is connected through the COM pin to form a closed circuit.
However, this NC connection will break once the relay is switched through providing an active
high/low signal toward the signal pin from a microcontroller.
Signal Pin: The signal pin is mainly used for controlling the relay. This pin works in two cases like
active low otherwise active high. So, in active low case, the relay activates once we provide an
active low signal toward the signal pin, whereas, in an active high case, the relay will trigger once
we provide a high signal toward the signal pin.
However, these modules generally work on an active high signal which will strengthen the relay coil
to make contact with the common terminal with the normally open terminal.
5V VCC: This pin needs 5V DC to work. So 5V DC power supply is provided to this pin.
Ground: This pin connects the GND terminal of the power supply.
5Volts 1-Channel Relay Module Components
The components in a 5v relay module with a single channel include a relay, output terminal, status
LED, power LED, freewheeling diode, input connector & switching transistor.
Relay
A 5V relay is coated with blue color plastic material. For both AC & DC loads, the utmost operating
voltage & current are also displayed on the relay. This relay operates with 5V, so it is called a 5V
relay.
Output Terminal
The output terminal of the relay module is located at the left-hand side, used to fix an AC/DC load
& AC/DC i/p power source. Every o/p connector’s terminal is connected through NC, COM pins &
NO of the relay.
The relay module consists of screws that are used to connect wires & cables. The max current
supported by this module is 10A & the max contact voltage is 250V AC & 30V DC. Thick main
cables are mainly used whenever high voltage & current load is used.
Status LED
Status LED is connected by using a current limiting resistor that is located on the top right side of
the relay module. So this LED illustrates the relay status by activating the relay & coil through a
signal pin. The DC supplies throughout a relay coil.
Power LED
Power LED shows the condition of the power source that is connected through the single channel
module. If we provide the above 5V source toward both the pins of the module like Vcc & GND,
the LED will be damaged due to high voltage.
Freewheeling Diode
The connection of this diode can be done across the coil to keep away from the back EMF effect,
so-called a flyback diode. The type of coil used in the relay is the inductive type. Once the current
supplies throughout an inductive load, then it generates a back EMF voltage, which may harm the
circuit. So, this diode is mainly used to keep away from this effect.
Input Connector
The input connector is located on the right side of the module. This connector is mainly used to
supply a 5V power supply & input signal. In addition, it also supplies power supply toward the
power LED, relay coil & status LED.
Switching Transistor
Generally, the input signal which is given to a relay is from the I/O pins of microcontrollers like
ESP32, TM4C123, Arduino, etc. However, the highest current sourcing capacity of GPIO pins is
usually below 20mA.
Therefore, a switching transistor is used in this module is to strengthen the current to the
requirement of the minimum current level of the relay coil. A switching transistor is used to control
the 5V relay from the microcontroller’s GPIO pin.
Some kinds of relay modules are available with an optoisolator like a switching device to give
optical isolation among high & low voltage circuits.
However, if you are utilizing a separate relay exclusive of a module & you want to utilize several
relays within your projects, then a relay driver IC can be used to drive several arrays from the pins
of GPIO in a microcontroller.
Specifications
The specifications of a 1- channel relay module include the following.
Voltage supply ranges from 3.75V – 6V
Quiescent current is 2mA
Once the relay is active then the current is ~70mA
The highest contact voltage of a relay is 250VAC/30VDC
The maximum current is 10A
Working
The relay uses the current supply for opening or closing switch contacts. Usually, this can be done
through a coil to magnetize the switch contacts & drags them jointly once activated. A spring drives
them separately once the coil is not strengthened.
By using this system, there are mainly two benefits, the first one is, the required current for
activating the relay is less as compared to the current used by relay contacts for switching. The other
benefit is, both the contacts & the coil are isolated galvanically, which means there is no electrical
connection among them.
How to Use/Relay Module Circuit Diagram
The circuit diagram of the single-channel relay module circuit is shown below. In this circuit, we
can observe that how the relay module is activated and deactivated through a digital signal. This
signal is applied to a control pin of the relay module. The following circuit diagram is the internal
5V single channel relay module diagram.
Apply to
Input
Rated Rated Relay the Screw Stripped
Type Temperature Input Voltage voltage
Voltage Current Rated Torque Wire Length
polarity
Voltage
FY-41F-
AC/DC24V 24VDC / / 7mm
3