FLOAT SWITCH or FLOAT SENSOR WITH ARDUINO

A float sensor or float switch is used to detect the level of liquid within a tank. It is also called as magnetic float sensor or float switch as its working is same as of switch. Magnetic float sensor is an electromagnetic ON/OFF switch. It senses the level of water present in the tank by making switching connection.

WORKING OF FLOAT SWITCH

To make a circuit closed/complete circuit float sensor use magnetic reed switch. Then what is reed switch?

Reed switch

It is an electrical switch which can operate/work by applying magnetic field. It consists of ferromagnetic flexible metal reeds contact isolated in hermetically sealed glass envelop.

The metal contact is normally open. But as we applied magnetic field or place a magnet near one metal end of the switch it attracts the other end of metal, which makes path for current to pass through. When the magnet moves far away the switch, the contacts demagnetize and will separate (breaking the circuit).

Reed switch

Float sensor is working on the same concept as reed switch, but one more question might be arising. In reed switch we are using magnet but how can we get magnet in water tank? Right! We don’t need to worry about it because float sensor is being designed in that manner magnet is already presents there.

float sensor

 

When we outfit sensor in an empty tank the switch position is at bottom but as water starts filling up switch position rises up which generates magnetic field for the reed switch. So simply, when water level goes down sensor break the circuit and series led connected will turned off, while when level goes up sensor make the circuit and series led connected will turned on.

REQUIRED HARDWARE

S.No. Item Quantity
1 Arduino Uno 1
2 Breadboard 1
3 Magnetic Float Sensor 1
4 LED 1
5 Resistor 220 ohm 1
6 Male to Male jumper 4

CIRCUIT DIAGRAM – INTERFACING OF FLOAT SWITCH WITH ARDUINO

Make the following connections with Arduino

float sensor with arduino

FLOAT SENSOR ARDUINO CODE

int FloatSensor = 2;
int led = 13;
int buttonState = 1; //reads pushbutton status

void setup() {
  Serial.begin(9600);
  pinMode(FloatSensor, INPUT_PULLUP);
  pinMode (led, OUTPUT);
}

void loop() {
  buttonState = digitalRead(FloatSensor);

  if (buttonState == HIGH) {
    digitalWrite(led, LOW);
    Serial.println("WATER LEVEL - LOW");
  }
  else {
    digitalWrite(led, HIGH);
    Serial.println("WATER LEVEL - HIGH");
  }
  delay(1000);
}

OUTPUT

After uploading the code successfully, you can see when water level goes up led attached will get turn on and when water level goes down led will get turn off.

Total Visits: 4982
0 0 vote
Article Rating
Subscribe
Notify of
guest
7 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Mohamed Abul-Soud
Mohamed Abul-Soud
6 months ago

Thanks for your kind help

best dentist in dickson tn
5 months ago

760909 613044Hi. Cool write-up. There is really a difficulty with the web internet site in firefox, and you may want to test this The browser could be the marketplace leader and a huge portion of folks will miss your outstanding writing due to this issue. 624308

SEO Harrisburg
5 months ago

569844 612337Thanks for every other magnificent post. 38149

Lars
Lars
2 months ago

How do I add more float sensors, I need a total of 4 sensors in my projekt?

Lars
Lars
2 months ago

Thank you
just to understand the code.

in this code the 4 float sensors provide output to the same LED ??

if i want f1 output to LED1

and f2 output to LED2and so on

how do i write the code ??

/ Lars

Mahendra
Mahendra
2 months ago

Hello Lars, Reply 2nd As you can see in above code, here on detection we are printing messages in Serial, such as “Float sensor 1 HIGH”, right. Inside favourable condition, you can write command in block of either if { // what you want to do // statement 1 // statement 2 } or else{ } You can see this topic, how to take input in arduino bit.ly/2yWME2Q // Updated code See below int f1 = 2, f2 = 3, f3 = 4, f4 = 5; int bs1 = 0 , bs2 = 0, bs3 = 0, bs4 = 0;… Read more »

Translate »
7
0
Would love your thoughts, please comment.x
()
x