How to remove noise from static electricity in the pin of a microcontroller?
Touching a floating input pin can cause damage, charge on your body may be enough to overload any protection in the device. However, it sounds like you need a pull-up or pull-down resistor to ensure the logic state is stable while the switch is open. For example, it may not be safe to assume the input is high if the switch connects it to ground but isn't pressed. We need to see your schematic to be more helpful.
Brian.
Hi,
General rule:
Don't leave (unused) inputs floating. Neither digital inputs nor analog inputs.
Klaus
Thanks for your answer.But I have used pull down resistor and no pin is float! I have used a NOT gate before pin like figure below. Is anything wrong with this!? When I touch a pin a 50Hz square wave generates in that pin!
Hi,
We simply had to guess what this means....
It's not clear which pin you touch and why you touch it.
Klaus
Your body serves as an antenna, picking up ambient mains hum, and applies it to the input. The IC amplifies it while clipping it to a square wave. You can observe a similar effect in transistors and mosfets, when you touch a bias terminal (particularly if it's not connected to anything). That is the reason inputs should not be left floating.
If the pick-up is very severe it might be able to inject enough voltage to drive the NOT gate between logic levels but it would be an unusual case. The only scenario I can think of is where your body is essentially grounded through your feet/floor but the power supply feeding the circuit is floating. In other words, it isn't you injecting the signal, you are ground but the rest of the circuit has 50Hz on it.
Does your circuit have it's own ground connection?
Brian.
in the OLD days we used flipflops, or R-C networks to make a BOUNCELSS SWITCH. That is when you push the button, even it it makes 5 on off contacts before settling down to be CLOSED, the bounceless circuit outputs only ONE push.
People do not make these hardware bounceless switches anymore, because the DE-BOUNCE the switch using SOFTWARE.
But if you can not access the lines of code, start with a simple 0.01 uF ceramic capacitor between the input pin of the chip and ground.