0

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) 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? pot interfacing with arduino uno

  • 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. – Chad G May 13 at 18:46
  • A potentiometer is a voltage divider in itself. You don't need the extra 1k resistor – chrisl May 13 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 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. – chrisl May 13 at 19:17
  • ok, one more question, then what does those voltage dividers with pots serve purpose for? – Megh May 13 at 19:22
1

OK, I am unable to leave a comment (< 50) so...

Use this link to learn about the AREF pin on the Arduino, this may not be your problem but it is good to know about anyway: what is arduino adc reference?

Your pot MAY be broken. Measure the resistance of the pot with an ohm meter, from the center pin to either of the side pins. Verify when you turn it the resistance varies from 10K to 0.

You can also measure the voltage it is providing your Arduino by measuring the voltage it presents to pin A0. Verify the voltage changes little by little from +5 to 0 when you turn it back and forth.

You list the pot as being a "bourns 3296" which the data sheets show as a "Multiturn / Cermet / Industrial / Sealed" pot.

Just so you know, when you adjust it you will have to turn it 25 turnes to fully adjust it through its entire range. The data sheet shows "Effective Travel.........25 turns nom."

0

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 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 – chrisl May 14 at 16:23
  • The answer didn't solve the problem, so you can uncheck it, until it does – chrisl May 14 at 18:03

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.