Pull down resistor not working as expected

Hi there...

I'm trying to read a simply high off an UNO pin7.
Using a 10k Ohm pull down resistor.
If I leave the board untouched everying works fine but as soon as I touch pin 7, the port flips to high.
I could obviously leave it untouched in later operation but the same effect happens with a longer cable connected.
I have tried a 2kOhm resistor instead, same effect.
Using the build-in pull up resistor also shows the same effect as well as using another board.
Maybe it's me :~
Any help greatly appreciated.

(deleted)

Sure, please see attached.
I'm basically getting this strange behaviour as soon as I touch the pin on the Arduino side...

Pull Down R.jpg

Symptoms seem to suggest that the pull-down resistor isn't actually connected. I suggest removing all the external components and circuit, modify your sketch to enable the internal pull-up resistor on that pin, and try again.

When you say "the build-in pull up resistor also shows the same effect" that is unexpected but perhaps you don't mean it literally, because replacing a pull-down resistor with a pull-up would certainly have an effect.

(deleted)

I just did a fairly simple test and connected a 16kOhm resistor to pin7, the other end to GND (of the Arduino board).
The board read a "0" value until I touched the wire of the resistor that's connected to pin7.
It doens't result in a constant HIGH but keeps flipping to high regularly (within seconds) by just holding it.

tizio:
I just did a fairly simple test and connected a 16kOhm resistor to pin7, the other end to GND (of the Arduino board).
The board read a "0" value until I touched the wire of the resistor that's connected to pin7.
It doens't result in a constant HIGH but keeps flipping to high regularly (within seconds) by just holding it.

Yes this means that you have not connected your pull down resistor correctly.
That is exactly what happens when there is no pull down resistor.

Does this happen on other pins?

And you're using pinMode (7, INPUT); in setup ?

Hm, so if you take a look at the little drawing that I posted (attached again).
This is effectively what I did with my test, only difference is that instead of having a switch against 5V, I touched pin7.
Should the resistor against ground not take the low voaltage of my body against ground?
How do I need to connect the pull-down resistor to avoid this behaviour?

The same happens on other pins.

Below is a code extract modified for testing...

const int ringerContact=7;
const int hookSwitch=4;
const int dialSwitch=2;
boolean ringerVar = false;

void setup()
{
Serial.begin(9600);
pinMode(ringerContact, INPUT);
pinMode(hookSwitch, OUTPUT);
pinMode(dialSwitch, OUTPUT);
digitalWrite(hookSwitch, LOW);
digitalWrite(dialSwitch, LOW);
}

void loop()
{
ringerVar = digitalRead(ringerContact);
Serial.println(ringerVar);
if (ringerVar ==1)
{
delay(1000);
}
}

Pull Down R.jpg

This is effectively what I did with my test, only difference is that instead of having a switch against 5V, I touched pin7.
Should the resistor against ground not take the low voaltage of my body against ground?
How do I need to connect the pull-down resistor to avoid this behaviour?

OK I will try again.
What you said you did is correct. If you had performed it correctly you would not see the results that you are telling us you do.
Just to be 100% sure, use a 1K pull down resistor. If you still get the problem then you have not got the circuit you think you have.

Please post code correctly. Read the how to use this forum sticky.

OK, used the suggested 1K - works fine.
2K as well, 16k still fails.
So I guess I'll need to try to get away with 2K.
I'm just really wondering that the "standard" approach does not seem to work for me?

Anyway, thanks for all your help so far, will need to change my circuit now first and re-test (and I'll check out the code posting rules - sorry).

tizio:
OK, used the suggested 1K - works fine.
2K as well, 16k still fails.
So I guess I'll need to try to get away with 2K.
I'm just really wondering that the "standard" approach does not seem to work for me?

The standard approach does work. You are using a non-standard approach by touching the pin directly. When you touch the pin, you have a situation where your finger has an unknown impedance and an unknown potential that is determined by (1) what electrical interference is affecting your body, and (2) what other parts of your body are connected to, and (3) the resistance of your body between the finger that is touching the pin, and the path back to the GND and 5V on the Arduino.

Advice: Wire your circuit with a pulldown or pullup (internal or external), and don't try to test it by touching the pin.

Best is a switch wired from the Arduino pin to GND, enable the internal pullup, and use LOW for the indication that the switch is closed.