Problem with potentiometer

Hi, my first go at getting my brand new Arduini UNO to work with built in example #1 got me stumped right away. Wired up the 10k potentiometer as instructed and uploaded the sketch but even without turning the knob, I started getting different readings on the serial monitor (ranging from 200 to 400) - which I did not expect. Turning the knob did appear to change the readings but not in the range 0 to 1023 which I would expect.

Anyone any clues as to what the problem could be?

Thanks,

I'd like to help but I don't know what "built in example #1" is. I guess you have some sort of kit not just a UNO but there are loads of different starter kits.

If you can post the instructions and the sketch you're using it will be a lot easier to help.

Steve

Time to check your wiring then.
Please post a picture and a schematic/drawing of your connections.

Pieter

Yes I do have a starter kit but the examples I am trying to follow are from the Arduino Website and the MacOS version of the Arduino IDE.

The example I mean is at > Resources > Tutorials > Built-in Examples > Basic > #1 Analog Read Serial: Read a potentiometer, print its state out to the Arduino Serial Monitor.

My wiring is exactly the same as on the website, but if a picture helps be glad to do so!

I have loads of experience in programming but none whatsoever with electronics, so I have have loads to learn.

Thanks for your offer of help,

Allan

Either the pot is wired wrong or it's defective. It's unlikely the Arduino is defective. Most likely it's wired wrong. The center terminal of the pot should go to pin A0.

Try disconnecting the pot and connect A0 to ground. You should read zero.

Disconnect that and connect A0 to 5V. You should read 1023.

Hi DVDdoug,

My wiring was exactly as given on the website: 1 - 5V, 2 - A0, 3 - GND.

Did as you suggested and the readings are 0 and 1023 so I guess the pot is defective?

Allan

Either pot is bad, or connection was bad.

If you have nothing connected to a pin, reading it gives random values (the inputs are very high impedance, so with nothing connected, they'll pick up noise from the environment, like an antenna).

So if the wires to the pot weren't actually making contact (maybe you're working on breadboard, which has unreliable connections, and/or were relying on the two sets of power/ground rails being connected inside the breadboard, but they're not?)

Here are some possibilities:

*You may try re-seating the potentiometer. I know the ones I got from the kit liked to pop out occasionally. *If you know how to use a volt-ohm meter, check to see that the potentiometer reads what the instructions say it should. Maybe the kit has different value potentiometers (pots). Try another one if it doesn't match. * You could replace the potentiometer with a resistor of equal value to the serial resistor and you should get a value near mid range. Connect the place the 2 resistors meet to the analog pin.

Hope that helps.

Problem solved?

To make sure my breadboard wasn't causing the problem, I wired up the potentiometer directly using M/F jumpers (which I bought today) and the readings were exactly as I expected. Completely left gave 0 on the serial monitor, completely right gave 1023 and turning the knob varied the reading between 0 and 1023. So my potentiometer isn't defective.

So I guess some more tinkering is needed to identify what exactly was causing the error. Most of you already said that the wiring was probably the culprit and I seem to have confirmed your suspicions using my new M/F jumpers.

Thanks for all your time and helpful suggestions.

Allan

The question is - did you have the pot connected in the first place? How did you actually connect to the terminals? Did you solder them? Did you use clip-leads? People sometimes fantasise that pointing a wire at the lug on the pot in some way means "connecting" to it. :roll_eyes:

ScottyNL: Hi, my first go at getting my brand new Arduini UNO to work with built in example #1 got me stumped right away. Wired up the 10k potentiometer as instructed and uploaded the sketch but even without turning the knob, I started getting different readings on the serial monitor (ranging from 200 to 400) - which I did not expect. Turning the knob did appear to change the readings but not in the range 0 to 1023 which I would expect.

Anyone any clues as to what the problem could be?

Thanks,

Definitely the analog pin is not properly connected for some reason, wiring, faulty pot, faulty soldering, corroded connections, etc etc.

The only way to check connections reliably is measure with a multimeter. Most have a continuity-check mode with a built in beeper - use this to check every connection is sound. A close visual inspection is also worth doing.

Is that a Linear Taper pot, or an Audio/Logarithmic Taper pot? The Audio can have large jumps with minuscule movements if you are in the exponential region of the pot.