Pages: [1]   Go Down
Author Topic: [Resolved] Resistance problem affecting pin reads  (Read 714 times)
0 Members and 1 Guest are viewing this topic.
California, US
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My USB Duemilanove-328 is about 2 years old. I haven't done much with it.

I pulled it out a couple days ago to play around with, and I noticed what I first thought were bugs in my software, but after some testing, I discovered that there was a hardware problem.

Polling a random pin several times per millisecond, I find that the pin state is fluctuating rapidly. The pin state strobes between high and low, whether the pin is connected to anything or not. This problem seems to be occurring on all pins on my Arduino. However, I find that by touching certain metal parts of the circuit board with my finger, I can stabilize the reads and get the correct input. This leads me to believe that there is a resistance imbalance somewhere on the board.

Is this a common problem? Is there anything I can do about it, or do I need to replace the board?
« Last Edit: March 29, 2011, 01:23:08 am by tachyonimpact » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12928
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Focus on the pins that are connected to something.  What are they connected to?  How do they behave?
Logged

California, US
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The connected pins are connected to push switches. When not pushed, the poll on pin 2 gives about 50% "HIGH" readings. When pushed, the poll gives 100% "HIGH" readings, as expected.

Pin 3, however, always gives 100% "HIGH" readings.

Everything is connected through a breadboard.

If I touch the groundwire while polling pin 2, I will get 100% "LOW" readings, as expected. This persists as long as I am touching the groundwire. However, if I tap and release the pushbutton while holding the groundwire, I will get 100% "HIGH" readings from then on, until I let go of the groundwire for a moment.

The Arduino seems to be remembering the ground resistance. This doesn't make any sense.

Perhaps I made a mistake in the past and shorted something.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12928
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What value are you using for the pull-down resistors?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds like floating inputs.

Enable the internal pullups:

pinMode(pinX, OUTPUT);
digitalWrite (pinX, HIGH);

then use your switch to connect to ground, and look for Lows to initiate your action.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

California, US
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

HA
HAHAHA
HAHA
HA

Ok. I'm not an electrical engineer or anything. I mostly just tinker around with this thing for fun. Now I feel stupid, because I was not using any resistors on the groundwire connection. What value is best? I have many resistors of various values on hand, so I'll put one in the circuit and see if it solves my problem.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27113
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1K.
Or use the internal pullups - do you still have your sketch that is running?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

California, US
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Enabling the internal pullups on pins 2 and 3 (set to input) just gave them a permanently HIGH input reading, even when the switches are not closed.

The sketch is the BitLash Arduino shell. I am using its internal functions to set pinmodes and read/write on the pins.

Edit: Also, a 1k resistor connected between ground and the circuit had no effect.
Edit2: Touching the 1k resistor while it is connected to ground seems to fix it. I'll try with a 10k.
Edit3: Nope, even a 15k didn't change anything.
« Last Edit: March 29, 2011, 12:43:24 am by tachyonimpact » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12928
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Now I feel stupid,

Why?  No one is born with a knowledge of "floating pins".

Enabling the internal pullups on pins 2 and 3 (set to input) just gave them a permanently HIGH input reading, even when the switches are not closed.

Did you change the switch to ground the pin when closed?  For pull-up resistors, the switch is connected to GND.  For pull-down resistors, the switch is connected to VCC.

Quote
Edit2: Touching the 1k resistor while it is connected to ground seems to fix it. I'll try with a 10k.

Your circuit is not correct.  You still have a "floating pin".

Does this help...
http://www.arduino.cc/en/Tutorial/button
Logged

California, US
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks! I was just doing it wrong. The inputs are fine now.
Logged

Pages: [1]   Go Up
Jump to: