LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Photoresistor Voltage Measurement

Hello,

I'm building a line-following robot controlled by a myDAQ. To line follow, I'm using two 20K Ohm resistors and two photoresistors to build the diagram described here:http://www.acroname.com/howto/photoresistor/photoresistor.html I've built both circuits and connected the wires labeled "V" together. The circuit has the characteristic of a negative voltage when the light going to the left photoresistor is blocked, and a larger, positive voltage when the right photorestor is blocked. 

 

However, the measured voltage continuously drops after the circuit is plugged into a 7.2V nimh battery. Therefore, I was thinking of storing the previous reading of voltage, then comparing it to the current voltage to see if the robot was going off the black line. The code below uses a for loop with a shift register, however it does not store the previous value.

photoresistor code.png

Any help would be greatly appreciated.

0 Kudos
Message 1 of 2
(3,700 Views)

If your voltage source is a single +7.2V power supply (doesn't matter if it is a battery) and you are able to get a negative voltage, then you have some sort of floating reference ground. There is a change you are shorting your reference to your physical negative terminal on the battery. It would help if you posted your schematic.

0 Kudos
Message 2 of 2
(3,678 Views)