Go Down

Topic: Moving digital input wire causes signal (wire isn't connected to anything) (Read 431 times) previous topic - next topic

tmh88

I'm new to Arduino and seem to be having a strange situation. I set digital pin 8 on my uno for input, and when I have a wire inserted into it (other end isn't even connected to anything), it's sending a signal when I move the wire.

Is my Arduino defective or is this something that I'm just completely unaware of? The bottom of the Arduino is sitting on a piece of rubber so I know there's nothing below it to conduct to. Like I said, the other end of the wire isn't even attached to anything. Simply wiggling the wire causes it to send a signal as if the bottom is grounding. It does this for any of the inputs I set it to.

So, is this normal or am I just not aware of how inputs actually function?

retrolefty

Quote
So, is this normal or am I just not aware of how inputs actually function?


Yes that is normal. You are seeing the effects of a 'floating input pin' condition. You don't even need to add a wire to see the effects, just do a continuous digitalRead() on an input pin with nothing connected to it and it will return 1 and 0 values randomly due to noise. That is why when wiring up to simple switch contacts one must utilize external pull-up or pull-down resistors (or enable the internal optional pull-up for the pin) so that when the button is not being pressed and it's contacts are open there is still a valid voltage (either ground or +5vdc through a resistor) seen by the input pin. An input pin with nothing wired to it is not presented with a valid input voltage to sense so it goes insane and just lies to you if you try and read it's value.

That make sense.

tmh88

Thanks, I just had my roommate take a look at it (he's a computer engineer), and he knew exactly what you were talking about. I didn't have it set as a pull-down resistor, so my room mate swapped it for me and now it works perfectly. Thanks for the tip.

Go Up