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

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: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**

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

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