Go Down

Topic: High signal with wire disconnected!!? (Read 1 time) previous topic - next topic

timcastelijn

hi everyone,

I am currently experiencing some weird behaviour of the arduino board. I was trying to wire up a stepper motor and a button, though the button function didnt seem to work properly. After some testing with the basic code from the website "button:" (http://arduino.cc/en/Tutorial/Button) I found out that when I connect a wire to digital input 2, a HIGH value is registered, even when the wire is not connected to anything.

Does anyone have suggestions?

cheers, tim

retrolefty

Quote
I found out that when I connect a wire to digital input 2, a HIGH value is registered, even when the wire is not connected to anything.


That is normal. Do a search on 'floating input'. Then search on pull-up and pull-down resistors. Then read about arduino internal pull-up option. A valid voltage must be presented to a digital input pin at all times, a unwired digital input pin does not have a valid low or high voltage presented to it. That must be provided by external circuitry or by use of the optional internal pull-up resistor.

Lefty



timcastelijn

allright thanks,

however I am wandering whether I stated the problem right:
when I connect one end of a jumper cable to the output the digitalRead value changes. it changes back when i disconnect it. The other end of the cable is not connected at to anything. It seems i'm using a loose wire as a button.

anyway thanks for the advice, I'll look it up.

cheers


retrolefty

#3
Apr 06, 2011, 02:42 pm Last Edit: Apr 06, 2011, 02:45 pm by retrolefty Reason: 1

allright thanks,

however I am wandering whether I stated the problem right:
when I connect one end of a jumper cable to the output the digitalRead value changes. it changes back when i disconnect it. The other end of the cable is not connected at to anything. It seems i'm using a loose wire as a button.

anyway thanks for the advice, I'll look it up.

cheers




Let me put it in the form of a question to you. What value do you expect to read from a digital input pin that has nothing wired to it?

The answer is there can be no valid expectation as a floating input pin is just reading random external and internal electrical noise and will randomly read high or low and change on it's own as the phase of the moon changes or how hard you stare at the pin.

Lefty


MarkT

CMOS inputs are _extremely_ high resistance(*) - this means that it will pick up static charges floating in the air, detect electric fields from nearby objects (such as mains AC), and generally act as an ideal voltage probe.  Normal conditions on earth are about 100 volts per metre of background field, anywhere with nylon carpets there will be thousands of volts on those carpets and the people that walk on them - you put a high sensititivity probe into that environment you are certainly not going to see 0V!

(*) greater than 10^12 ohms is typical of CMOS gates.  For a complex circuit like the Arduino pin (it is switched between input and output so there are various transistors connected, not just as input) the input resistance will be lower, perhaps 10^10 ohms...  Thus with nothing connected it is likely to be close to 0V, perhaps enough to stay as low.  However even a short piece of wire is going to pick up enough induced charge to switch it.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

timcastelijn

OK thanks guys, that explains it. I got the button working as well, the pull-down resistor was in the wrong place.


Go Up