0
\$\begingroup\$

I have a simple and basic question. I am using Arduino uno to read the output from a 10K potentiometer. I understand that Uno uses a 10 bit ADC, therefore it can display outputs from 0 as 0V to 1024 as 5V.

Question: I am getting these values from the pot and displayed on the serial monitor of arduino IDE, while I vary the resistance of the 10K Pot. How am I supposed to calculate or know the output voltage and resistance corresponding to the values from 0 to 1024?

Another question is, when I vary the POT's knob to a maximum point i.e. 5V, the output displayed is 1007 or 1008. Isn't it supposed to output 1024 for 5V?

\$\endgroup\$
  • \$\begingroup\$ Assuming that the 10k pot is linear (lol) then 'half way' (135 degree turn) should correspond to 5K or a 512 reading - its just simple fractions. In practice you may want to try calibrating the system by plotting angle/resistance/reading and correcting for errors in linearity. \$\endgroup\$ – JIm Dearden May 18 '15 at 15:55
1
\$\begingroup\$

A converted value of 1024 would correspond to 5v - or to whatever voltage you put on the chip's Vref pin. But with 10 bits, the maximum number the converter can deliver is 1023. It's a small difference, but keep it in mind.

To find the voltage corresponding to a the converted value: V = (value / 1024) * Vref. Thus a reading of 1008 corresponds to 4.92v, assuming 5.00 volts at Vref.

\$\endgroup\$
1
\$\begingroup\$

You can use the map function to map the 0-1023 value to a value you can use.

http://www.arduino.cc/en/Reference/Map

map(value, fromLow, fromHigh, toLow, toHigh)

int val = analogRead(0);
val = map(val, 0, 1023, 0, 500);
analogWrite(9, val);

This will give you an output from 0 to 500, and that will be your voltage * 100. The reazon i use 500 is because if you spefify from 0 to 5, it will only give you integers. With 500 you can just divide by 100 and that is your result with 2 decimal points.

\$\endgroup\$
0
\$\begingroup\$

You can put a voltage probe(I.e. multimeter) in parallel with the pot to create a best fit curve of the voltage to the ADC value. This works best if its a linear pot, but as is the case with all analog circuits, it won't be perfect.

EDIT: Assuming its a linear pot you can also grab the resistance values from a multimeter by turning it to the extremes to get an idea of what it should be.

If the current is constant well then you can just use ohms law to find the resistance cause you'll know the voltage from your previous empirical measurements.

\$\endgroup\$
0
\$\begingroup\$

Two things I can think of...

The ADC requires a Vref. It will be close to your 5.x volts Vin on your Arduino but not exact. All measurements will be made with reference to that voltage level. I think you can measure that voltage on an Arduino pin.

The position of the wiper in the pot is garaunteed to be across the entire resistor even when the screw is backed all the way off so the actually Vout may not be as high as Vin.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.