Full Width CSS

Floating Inputs and its Mitigating Measure in Arduino

What are the floating inputs?

Sometimes, Arduino reads random input on the input port. Even though we don't give any input in the Arduino, sometimes it tends to read some random input values. This is called floating inputs. When the input is defined as digital, and if you are not connected to the input to either HIGH or LOW the input is said to be floating. This may lead to some random input voltages. We can mitigate this issue by using pull-up or pull-down resistors. 

What are pull-up and pull-down resistors?

In the circuit, when it is closed, it makes a connection to the ground, and when the circuit is open, the rest of the circuit will keep floating. In the digital circuit connection, the input or output pins are always at 1(HIGH) or at 0(LOW). Sometimes, we need to change that value from 1 to 0 or 0 to 1, for that we need to hold digital pin either at 0 and change it to 1 or, hold the digital pin at 1 and change it to 0, it can be left on floating. For this, we need a pull-up or pull-down resistors. 

Now, if we put actual voltage in HIGH or LOW, the value of HIGH will be 5V(Logic HIGH) and LOW will be 0V or ground(Logic LOW).

Pull-up resistor is used to set up the default digital pin as HIGH whereas a pull-down resistor is used to set up the default digital pin as LOW. 

Though floating inputs are generally observed in digital inputs, it can also be found in analog inputs. 

Pull-up and pull-down resistors are generally used to interface the switch or some other inputs with a microcontroller which ensures that there are no floating values. Most microcontrollers have built-in pull up/down resistors so less external components are needed. 

In a digital circuit of 3.3V to 5V, we can put pull up/down resistors of value 10k ohm to 20k ohm, but the best practice is to use the value of 10k ohm. The above circuit diagram shows how to interface pull up/down resistors with a microcontroller. Arduino has its own pull-up resistor configured in its system that can be programmed to use without the use of external resistor, whereas there is no pull-down resistor so an external resistor is needed in case of the pull-down. For reference code to programme pull-up resistor you can visit: https://www.arduino.cc/en/Tutorial/DigitalInputPullup

So, in this way you can mitigate floating inputs. If you have any queries regarding this, do contact us at nasaelectronics157@gmail.com 

Post a Comment