Project Arduino – Floating Digital Port
Defining a digital port as INPUT on an Arduino microcontroller can cause issues with static energy because when a digital port is set as an input, it becomes high impedance, meaning it does not have a strong connection to either ground or the voltage supply.
This high-impedance state can allow static electricity to accumulate on the input pin, which can cause electrical interference, noise, and false readings. In extreme cases, it can even damage the microcontroller.
You can see this happening in the following video where a balloon with a static charge is slowly being held nearby port D2 that was defined as INPUT and would light up D13 when a charge would be given. Since there is nothing providing D2 with a charge – but it is expecting one – you could say D2 is now a floating digital port.
To prevent this from happening, it is recommended to use a pull-up or pull-down resistor to ensure that the input pin is held at a specific voltage level when it is not being actively driven by an external device. This helps to reduce the likelihood of static buildup and prevent the input pin from floating. Additionally, it is important to discharge any static electricity before connecting or disconnecting any cables to or from the microcontroller.
An example of a pull-down is shown in this video below where a 10-ohm resistor is placed between D2 and the GND.
A video explaining when to use PULL-UP and when to use PULL_DOWN can be found here
That left us with how big of a resistor should I use. Does translates into a STRONG or WEAK Pull-Up/Down and is explained here