# Value read is not changing while rotating pot in arduino?

I am trying to read voltage using analogRead in Arduino Uno from a voltage divider circuit consisting of 1k resistor and 10k pot. The Pot used is bourns 3296. The values obtained only range from 1011 to 1023? Why is the count not reducing further if I rotate the pot?

(this how i have connected the circuit, but the pot is the one that i have mentioned above, i couldn't find that kind in the software, but i have made the connection this way only)

``````int analogPin = A0;

// variable to store the value read
float val = 0;

void setup() {
Serial.begin(9600); // setup serial
}

void loop() {
Serial.println(val); // read the input pin
val = analogRead(analogPin); // debug value
}
``````

Since potentiometer itself is a voltage divider, I have tried connecting as per the answer, the ends of the 10k pot to 5V and ground , and the slider pin to the analog pin A0. The new circuit is as shown below, but I am still unable to get the value ranging from 0 to 1023. The values returned only vary in between 1010 to 1023. What is going wrong? How do I get the full range?

• And the code your using while your at it. Issue is probably in the divider circuit, but still good to have a look at all of it. May 13, 2019 at 18:46
• A potentiometer is a voltage divider in itself. You don't need the extra 1k resistor May 13, 2019 at 18:46
• @chrisl I am trying to model a sensor which works at 5V as a voltage divider. So can I just use the pot? Most of the simulations that I have seen use a resistor along with pot. Please confirm.
– Megh
May 13, 2019 at 19:08
• Yes, you only need the pot. Connect it as described at the start of your sketch. A pot is a resistor strip, that gets divided by the middle wiper. May 13, 2019 at 19:17
• ok, one more question, then what does those voltage dividers with pots serve purpose for?
– Megh
May 13, 2019 at 19:22

A potentiometer is already a voltage divider by itself. The outer contacts are connected to the ends of a resistor strip. The middle pin is connected to a wiper, which can slider over the strip, dividing the strip into 2 parts. So you connect it like it is described at the start of your sketch (before the last edit): The outer pins to 5V and ground respectively and the middle pin to the analog input. (When using this in different circuits, keep in mind, that you should not draw too much current from the middle pin. Don't drive any load directly from it. The analog input does only draw a very small amount, so that's absolutely no problem.)

When adding a constant resistor in series with the pot, you are only adding a dead range, that cannot be set with the circuit.

what does those voltage dividers with pots serve purpose for?

Only the pot: Potentiometers are mostly used to give a setpoint, a user controlled voltage, which can be read by a microcontroller or used directly for controlling further electronics.

With an additional resistor: You can put in an additional resistor at the high side of the pot, to lower the voltage further. For example if you - for whatever reason - have to use a higher voltage for the voltage divider, than the microcontroller can handle. You can calculate the value of the resistor, so that the voltage on the analog pin will never exceed the limits. But this scenario must be very rare. I didn't encounter such a situation ever.

• I did the connections like you said, but still the value returned varies only between 1010 to 1023. What is wrong?
– Megh
May 14, 2019 at 15:40
• Please show a wiring diagram of the new situation. You can add it to your question by editing it. Let the original question stay as before, so that others can follow and learn from it later. Just add the new information at the questions bottom May 14, 2019 at 16:23
• The answer didn't solve the problem, so you can uncheck it, until it does May 14, 2019 at 18:03