FLOAT SENSOR-Uncategorized

You are a beginner with Dasduino. Or electronics? A specific module caught your eye, but you do not know how to use it? Do not worry, HUM is here for you! How to Use Module (HUM) is a blog tutorials series by soldered where you will find all you need in order to begin working with your favorite module. Tutorials include technical characteristics, work principles, instructions on how to connect the module with Dasduino and the basic code. Everything else is left to your imagination.


The float sensor is a device used to determine the fluid level in a tank. There are many applications in real life, such as flood detection in an area where a river spills, a sewer overflow, a barrel filled with oil, and many other useful uses. Because the current that the switch can handle is very low (maximum 0.5A), the switch must be used in a combination with a relay or a contractor when connected to a load greater than 0.5A.


Wire length: 37cm
Input diameter: 8mm
Netto weight: 70g


It is very important that we choose a float sensor made of the type of material suitable for our needs.

Nylon: suitable for almost all types of oils, diesel, organic chemicals
Polypropylene: suitable for a wide range of acids, detergents, chemicals, oils, and water
Polyphenylene sulphide: suitable for more aggressive chemicals and operating at higher temperatures, up to 120 °C
Stainless steel: suitable for medical use, use in food processing, hydraulic oils, fuels and applications at higher operating temperatures, up to 135 °C


The float sensor is connected via a contractor or relay, but it can also be connected to Dasduino as an input (switch or push button) for the required project. The float sensor has 2 basic work principles: when the water reaches the sensor, i.e. the float sensor is above the water level and the water will activate the sensor as the level increases, and when the float sensor is underwater, i.e. when the sensor reads the water level drop below some predefined levels.
Therefore, the float sensor has two work principles:
•Above water; water reaches the sensor
•Underwater; water lowers under the sensor’s level

The image shows the Float sensor above water and how water turns it on as it rises.

The image shows the Float sensor underwater and how the water drop turns it on.



The image shows a simple connection between the Float sensor and Dasduino. The float sensor is connected to Croduino as a standard switch. We will use a built-in pull-up resistor in the program to read the logical unit, i,e. logical zero. After you have connected everything as indicated in the scheme, it’s time to test our connection by uploading the code. Open the Arduino IDE, find your Dasduino, i.e. to which port it is connected and switch the board to the Arduino Nano. As an indicator that the float sensor is turned on, we will use the LED on pin 13 that is built-in on each Arduino.

void setup(){
  pinMode(13, OUTPUT);
void loop(){
  bool buttonState = digitalRead(12);
  digitalWrite(13, buttonState);

Transfer the original code to Dasduino.

When the float sensor switch is pulled up, the LED will be on. The circuit opens when the switch is not pulled, the circle closes when the switch is pulled. The float sensor uses a magnetic reed switch that consists of two contacts enclosed in polypropylene. An internal magnet will pull the two contacts together if the switch is pulled and vice versa.