read pot help wanted

I am just getting started in the arduino world. one example i fount was how to get a read out on the serial monitor from a pot. so i copied down the code (and it is attached). when i uploaded the code, it worked, but the full range 0-1023 was in less then a tenth of a turn of the knob. so my question is: is the code specified for a certain sized pot? and if so how can i change it so it works more accurately with my pot? (10K ohm i believe) any help or advice would be greatly appreciated.

Read_Pot.ino (669 Bytes)

Did you attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground?
You need a linear pot sounds like you have a audio taper pot.

Show us a drawing of your circuit with labeled values for components.
Show us a picture of your wiring.

i have an outer pin connected to my ground, then i have the middle pin connected to A0, and the other outer pin connected to 5v, as i was instructed

Show us a photo, not all pots have pins in that arrangement.

Or if you have a multimeter investigate the pot directly...

You want linear taper (A), not logarithmic (B) for all pots except
audio analog volume controls, generally speaking.

I know that it is difficult to see, and all the same color wire going into the arduino may also make it a bit harder to follow, but it is all i had.

What is the part number for your potentiometer? Where did you get it from?

Hi, have you got a multimeter to measure the resistance and voltages for us.
The resistance from one end terminal to the other for a start it should be 10K no matter where the pot is turned.
Between one end and the middle and it should vary form near zero ohms to near 10K.
Then try it from the other end and middle. This will show if you have a faulty pot.
Tom....... :slight_smile:

Wouldn't a non-linear pot still give analog 0 at one end and and 1023 at the other though, but just not be linear between the extremes? Surely the ends are the same no matter what the pathway? (Not that I've ever used one, just seems sensible to me.)

JimboZA:
Wouldn't a non-linear pot still give analog 0 at one end and and 1023 at the other though, but just not be linear between the extremes? Surely the ends are the same no matter what the pathway? (Not that I've ever used one, just seems sensible to me.)

Yes.
(And, they're known as "log" or "audio" taper.)

Maybe the wires aren't making good contact in that header?

What value is the pot?
The analog inputs are not "High Z" inputs (they're not op-amp inputs), more like middling , so you don't want a high-value pot.

it worked, but the full range 0-1023 was in less then a tenth of a turn of the knob.

Wouldn’t a non-linear pot still give analog 0 at one end and and 1023 at the other though, but just not be linear between the extremes? Surely the ends are the same no matter what the pathway? (Not that I’ve ever used one, just seems sensible to me.)

Yes.
(And, they’re known as “log” or “audio” taper.)

You need a linear pot.

http://www.expertsmind.com/topic/resistors/potentiometer-9614.aspx

steinie44:
Did you attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground?
You need a linear pot sounds like you have a audio taper pot.

Log or linear, if correctly matched and wired, it is going to read zero or close to it at one end of the travel, and 1023 or close to it at the other end of the travel.

Log or linear, if correctly matched and wired, it is going to read zero or close to it at one end of the travel, and 1023 or close to it at the other end of the travel.

True, but not half '512' in the center of a audio-taper potentiometer.

steinie44:

Log or linear, if correctly matched and wired, it is going to read zero or close to it at one end of the travel, and 1023 or close to it at the other end of the travel.

True, but not half '512' in the center of a audio-taper potentiometer.

Potentiometer, Resistors, Assignment Help

No argument there, but also nowhere near full scale in only 1/10th of the travel.

@mechlectrician7

Are there any markings on the pot? If so, what are they.

steinie44:

Log or linear, if correctly matched and wired, it is going to read zero or close to it at one end of the travel, and 1023 or close to it at the other end of the travel.

True, but not half '512' in the center of a audio-taper potentiometer.

What it reads halfway along is totally irrelevant to this discussion. The OP says it's reading 1023 1/10th of the way in: that shouldn't happen with a linear or an audio pot, so it seems something is amiss here.

Once it's reading 0-ish at one end, and 1023-ish at the other, then we can worry about the (non-) linearity of the case.

OK try this.
Note what end the readings very, and the amount you turn it.
then reverse the + and - ends, just swap + and -.
Note what end the readings very, and the amount you turn it.
What is the result?

I just wired this and ran the code with a linear pot and it works perfect. Full range 0 to 1022, and 500 half way.
I don’t have a audio pot handy, will look for one.

thank you for all the help, but i found the problem. I have a bad pot, i’ll have to get another one soon and try again

OK, that's what I was getting at instead of just saying it.