Jump to content


Photo

HOWTO: [Novice] - Measure Resistance with a Voltage Divider


  • Please log in to reply
14 replies to this topic

#1 Drew Barfield

Drew Barfield
  • Members
  • 16 posts

Posted 23 July 2007 - 06:27 PM

Hello Everyone,

Using a voltage divider circuit one can "convert" a variable resistance into a variable voltage.

schematic.gif

A voltage divider is just two resistors in series connected between a voltage supply and ground. If R1 is connected to +5V and R2 is connected to GND then the voltage at the point between the two resistors (AI0) is:

Vout = Vcc * R2 / (R1+R2)

For U12 users this means:

Vout = 5 * R2 / (R1+R2)

Here is the circuit on a breadboard:

wiring.JPG

In this setup, R1 is 50K ohms and my photoresistor is 50K ohms in darkness:

V = Vcc * R2 / (R1+R2) = 5 * 50000 / (50000 + 50000) = 2.5 Volts

Under the lamp my photoresistor can go as low as 1K ohms:

Vout = Vcc * R2 / (R1+R2) = 5 * 1000 / (50000 + 1000) = 0.098 Volts

potentials.JPG

If R2 is the photoresistor, the voltage will decrease with increasing light intensity. If you need an increase in voltage with decrease in light intensity then switch the positions of R1 and R2.

Finally, call upon AI0 to tell you the voltage of the circuit:

>> [voltage overVoltage errorcode LabJack_idnum] = EAnalogIn( -1, 0, 0, 0 )
voltage =
	   3.6279
overVoltage =
	 0
errorcode =
	 0
LabJack_idnum =
	 0

Drew Barfield
Physics and Computer Science Major
University of North Carolina Wilmington

#2 LabJack Support

LabJack Support
  • Admin
  • 8449 posts

Posted 24 July 2007 - 08:18 AM

Great tutorial topics. I am sure these will be useful to many people, so thanks. Note that the U12 input impedance is somewhat low, and this comes into play when using a voltage divider. The analog input impedance can be described as about 100 kohms, so if your source has a 50 kohm resistor in series there is going to be substantial error. See Section 2.1 of the U12 User's Guide. That Section gives a modified formula that can be used to account for the error, but since there are usually other sources of substantial error anyway (e.g. resistor accuracy), you might just want to do a calibration of the whole system on the particular U12 AI channel. The U3 & UE9 have much higher input impedance. See Section 2.6.3.6 of the U3 User's Guide for voltage divider information with the U3.

#3 Drew Barfield

Drew Barfield
  • Members
  • 16 posts

Posted 24 July 2007 - 12:28 PM

LabJack, Thank You. I was required to use the 50K photoresistor because it is one of the components in my physics "directed independent study" (DIS). If I had the choice I would go with a 1K or 5K photoresistor and a like-valued counterpart for R1.
Drew Barfield
Physics and Computer Science Major
University of North Carolina Wilmington

#4 pashanoid

pashanoid
  • Members
  • 23 posts

Posted 25 May 2011 - 10:33 AM

Could you recommend (or tell me how to figure it out) a voltage divider resistor to MOST ACCURATELY measure a variable resistor 0-500 Oms? I've tried two 6.8k resistors and I'm getting about 7 readings. I'd like to get maybe 20. I'm building a servo machine to move solar panels. Here is a picture of my variable resistor (soviet military) http://twitpic.com/52exh8, measurements I'm getting are:
Votage: 0
Votage: 0
Votage: 0
Votage: 0
Votage: 0.0048828125
Votage: 0.0048828125
Votage: 0.0048828125
Votage: 0.009765625
Votage: 0.0048828125
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.0146484375
Votage: 0.0146484375
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.0244140625
Votage: 0.01953125
Votage: 0.0244140625
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125

Thank you for your support and a great product (U12)!!!

#5 LabJack Support

LabJack Support
  • Admin
  • 8449 posts

Posted 25 May 2011 - 12:34 PM

Are you interested in measuring the actual resistance between the wiper (leg 3) and either leg 1 or leg 2? Or do you want the ratio between the legs (e.g. knob is at 25%)? What are you using for excitation? +5V?

#6 pashanoid

pashanoid
  • Members
  • 23 posts

Posted 25 May 2011 - 12:50 PM

Are you interested in measuring the actual resistance between the wiper (leg 3) and either leg 1 or leg 2? Or do you want the ratio between the legs (e.g. knob is at 25%)?

What are you using for excitation? +5V?

I'm using leg 3 (the wiper) and leg 1. With 5Vdc I get a better reading. There are 4 legs, I took a photo: http://twitpic.com/52ggbd I need to get as much readings as possible. 20 would be ideal. So far I get about 11 different readings from this resistor. Is there maybe a way to connecto to legs 1,2,3,4 and get more measurements per one 120 degree angle turn? Thank you for your help!

Attached Thumbnails

  • 306457753.jpg


#7 pashanoid

pashanoid
  • Members
  • 23 posts

Posted 25 May 2011 - 12:55 PM

Are you interested in measuring the actual resistance between the wiper (leg 3) and either leg 1 or leg 2? Or do you want the ratio between the legs (e.g. knob is at 25%)?

What are you using for excitation? +5V?

Don't know if it helps, but this is a video of my experiment -- (in Russian) -- but it shows the servo I'm building. It will be controlled by U12.

#8 pashanoid

pashanoid
  • Members
  • 23 posts

Posted 25 May 2011 - 01:08 PM

Are you interested in measuring the actual resistance between the wiper (leg 3) and either leg 1 or leg 2? Or do you want the ratio between the legs (e.g. knob is at 25%)?

What are you using for excitation? +5V?

Don't know if it helps, but this is a video of my experiment -- (in Russian) -- but it shows the servo I'm building. It will be controlled by U12.

Ratio would be nice. That way I know the exact angle I guess. I was just going to measure voltage drop and calibrate the motor/reducer so that when it moves I know the angle it's actually at. Thus, the servo.

#9 LabJack Support

LabJack Support
  • Admin
  • 8449 posts

Posted 25 May 2011 - 01:20 PM

I'm using leg 3 (the wiper) and leg 1. With 5Vdc I get a better reading.

Better than what?

If you want the ratio you don't need a fixed resistor. Connect +5V to leg 1 and connect leg 2 to GND. Connect the wiper (leg 3) to AI0. Also jumper +5V to AI1 so you can measure that.

Now take a reading from AI0 and AI1. The ratio AI0/AI1 is the ratio of your pot.

As you adjust the pot fully, you should see the voltage on the wiper vary from 0 to +5V.

#10 LabJack Support

LabJack Support
  • Admin
  • 8449 posts

Posted 25 May 2011 - 01:21 PM

If you want more accuracy you will need to consider the U12 input impedance as mentioned in post #2 above. If you do some sort of calibration, though, this will be taken care of.

#11 pashanoid

pashanoid
  • Members
  • 23 posts

Posted 25 May 2011 - 10:35 PM

Wow! 605 readings :) this is way too much now... Thank you!

#12 RaulPitt

RaulPitt
  • Members
  • 1 posts

Posted 01 April 2014 - 04:23 AM

Could you recommend (or tell me how to figure it out) a voltage divider resistor to MOST ACCURATELY measure a variable resistor 0-500 Oms? I've tried two 6.8k resistors and I'm getting about 7 readings. I'd like to get maybe 20. I'm building a servo machine to move peimar solar. Here is a picture of my variable resistor (soviet military) http://twitpic.com/52exh8, measurements I'm getting are:
Votage: 0
Votage: 0
Votage: 0
Votage: 0
Votage: 0.0048828125
Votage: 0.0048828125
Votage: 0.0048828125
Votage: 0.009765625
Votage: 0.0048828125
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.009765625
Votage: 0.0146484375
Votage: 0.0146484375
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.0244140625
Votage: 0.01953125
Votage: 0.0244140625
Votage: 0.01953125
Votage: 0.01953125
Votage: 0.01953125

Thank you for your support and a great product (U12)!!!

Hello friend bit old thread but were you able to find out the issue? I am getting similar measurements so I think you can assist me in correct manner..



#13 LabJack Support

LabJack Support
  • Admin
  • 8449 posts

Posted 02 April 2014 - 08:06 AM

Tells us the details of your measurement and we will see what suggestions we have.  What is your variable resistor range?  Which LabJack are you using?



#14 shreyaswattam

shreyaswattam
  • Members
  • 1 posts

Posted 23 June 2014 - 05:28 PM

hii

If we want to measure the actual resistance between leg1 and Wiper and how accurately can we measure it???(I was unable to see the video) what will be the error percentage???



#15 LabJack Support

LabJack Support
  • Admin
  • 8449 posts

Posted 23 June 2014 - 07:55 PM

We have an appnote that explains how to measure the resistance of potentiometers and other typical analog sensors:

Typical Analog Sensors (Appnote)

 

Calculating the error percentage requires a little bit more effort.  Stack exchange has a decent example for calculating relative error for voltage divider circuits:

here

 

You need to know the precision of the resistors in the circuit as well as the precision of the device measuring the voltage.  You can find specifications about each of our devices in their respective datasheet/users guide






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users