Pages: [1]   Go Down
Author Topic: 10k potentiometer analog read outputs seemingly random numbers  (Read 1707 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am the n00bist of n00bs please excuse me if this is stupid. I have scoured forums and can't find anything.

As a stepping stone to a more complicated project, I'm trying to set up a 10k potentiometer with my UNO rev 3 as specified in the AnalogRead/serial write tutorial, which is here:

http://arduino.cc/en/Tutorial/AnalogReadSerial

I have the two outer pins connected to +5 and GND respectively, and the wiper connected to analog 0. When I execute the code and view the serial read in the IDE, the numbers displayed jump around randomly and never stay the same for two consecutive reads. Unless there is some crazy algorithm going on, it looks like turning the knob on the pot has zero impact whatsoever on the serial read. Any suggestions? I'm at a loss. I haven't found my problem anywhere online.

Thanks a ton. And sorry if I'm being lame. Please call me out if I could have found the answer somewhere else.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 619
Posts: 33961
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quite simply you have not wired it up like the tutorial said. It sounds like the wiper is not making contact. That is what happens when you read a pin with nothing attached. This is called a floating input.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2071
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

jumping +/- 1 to 2 around a value is normal, try to connect a 100nF capacitor from the middle to ground, it may help..
« Last Edit: August 14, 2012, 04:29:58 pm by pito » Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 105
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a multimeter? Check what it says about the parts youre using.

That the values jump a bit is normal but they should increase/decrease generally if you connected it right.

Check this example out:
Generally what you need is in the middle of the page under the header:
"Reading from a Potentiometer: Analog Input Reading"
http://www.varesano.net/blog/fabio/potentiometers%20what%20they%20are%20how%20they%20work%20and%20how%20use%20them%20arduino
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As far as a connection issue, that was my initial thought, but I don't see how that could be. I soldered 22 gauge wire to the pins on the pot and I'm having the same issue. I also tried both a 10k slide potentiometer (the one I need to use in my final project) in addition to a cheapo RadioShack pot to no avail. I also tried multiple analog inputs (changing the code appropriately, of course). The issue is persisting.

The read is jumping around a few hundred at a time, not just a couple that I could attribute to noise.

I could pick up a capacitor, but I assume it should be able to work without one at least to some extent, right?

The next step is definitely a multimeter. Mine is at home. I'll check back in when I can test that way.

Is there any way to verify that the analog inputs on my board are working without having a known-working potentiometer?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 619
Posts: 33961
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any way to verify that the analog inputs on my board are working without having a known-working potentiometer?
Connect it to 5V, it should read 1023, connect to ground it should read 0.
Connect to the 3V3 pin and it should read about 675.
Logged

Pages: [1]   Go Up
Jump to: