Float switch a type of level sensor that float on the surface of a liquid. It basically consists of a hollow float body containing a sensor or switch. As the liquid level rises/falls, the float switch moves up/down accordingly and the sensor/switch tracks its movement.
Stem-mounted and cable-suspended are the two main types of float switches. No matter, this post is about a quite common cable float level sensor/switch – the M15-2 Fluid Level Controller.
This waterproof float switch that comes with 2-meter heavy-duty cable can be used to detect the level of liquid within a tank and to control a pump, indicator, alarm, or other desired electrical device.
As pointed previously, this is the most common float switch type due to its high reliability, and it is ideal for clean water and suitable for many other media. It opens or closes the electrical circuit at an angle of ±45°. The cable length after the counterweight defines the fluid level at which the switch operates.
The leaflet accompanying the product is of no use. It is just a poorly-written English instruction. The instructional material is awkwardly-phrased, and with grammatical errors. So, I have no clear idea about its technical specifications. Anyway it is almost certain that it has a maximum rated switching current of 8A at a switching voltage of 250V.
You can watch this animation to get an idea about its working principle
The connection cable is in fact a 3-core cable – it has one black, one blue, and one brown wire connected directly to the internal single pole double throw (SPDT) switch. The black wire is the common point (COM) while blue is normally-open (NO) and brown is normally-closed terminals of the SPDT switch.
Not to mention, proper float switch wiring is absolutely necessary to ensure appropriate actions based on the open or closed position of the switch. You can wire the float switch in either the normally-open or normally-closed position. A normally-open float switch remains open when down, and a normally-closed float switch remains closed when down. Note that this configuration may differ for different float switch models and types, so do some research to set it right.
Below is a general installation diagram taken from a Chinese website. I have retouched the image to give it some clarity (their description is still pathetic)!
Now to the inside view of the cable float sensor/switch (borrowed from the web).
Although this design idea seems simple, it provides long-term reliability at a cheerful price point. These types of devices can be used in tank level applications where water, oil, chemicals, and hydraulic fluids are being used. One disadvantage is that they cannot measure a variable level (only indicate low and high levels).
A quick test of this cable float switch requires only two LEDs and a power source. A very simple, basic, and self-explanatory idea is shown below to help you do that easily.
This is more than enough at this point. However, I also provide a tested code to read this float switch using an Arduino. Hope you do not need further explanation. Try it yourself!
/* -CONNECT BLACK/COM WIRE OF FLOAT SWITCH TO D8 & -CONNECT BROWN/NC WIRE OF FLOAT SWITCH TO GND */ const int floatSwitch = 8; //FLOAT SWITCH INPUT const int led_NC = 9; //RED LED OUTPUT const int led_NO = 10; //GREEN LED OUTPUT void setup() { pinMode(floatSwitch, INPUT_PULLUP); pinMode(led_NC, OUTPUT); pinMode(led_NO, OUTPUT); } void loop() { int switchVal; switchVal = digitalRead(floatSwitch); if (switchVal == LOW) { digitalWrite(led_NC, HIGH); //FAST FLASH delay(250); digitalWrite(led_NC, LOW); delay(250); } else { digitalWrite(led_NO, HIGH); //SLOW FLASH delay(500); digitalWrite(led_NO, LOW); delay(500); } }
Furthermore, if there is a hatful of requests, I will try to share a hardware debouncer design idea suitable for this float switch. That is all for now. Have Fun
Hi,
My name is Koen, i am from Holland living inThailand.
The float switch in my watertank is failing because the weight of the cable is rotating the floatswitch much too soon, so my pump stops pumping too soon!
Did you ever hear of this?
Koen: Haven’t experienced it yet, but I think the issue can be fixed by adding an optional stabilizing weight (in addition to the existing counterweight) that can be fixed at a suitable point on the cable.
Also watch this video https://www.youtube.com/watch?v=-AmQf3bd20s
Thanks!