Question about photoresistors
MovieMaker
Posts: 502
OK, I built the circuit on page 208 of Robotics with the boebot.
I used two photoresistors that looked identical.· When I ran the Parallax test on Left and Right I found that they varied widely.
Left numbers were from Zero to 300+ while the right numbers were from 0-6500. They both worked but varied quite a bit. So, I replaced the whole circuit three times with the same result. I guess my conclusion is that the 0-300 numbers where the average and somehow I got a SUPER photoresistor.· To correct this, I guess I could go to RadioShack and buy a matched pair if they make them or just change the multipliers in software. What numbers in· the program are you getting. Here is the code. It is so small, I will just cut and paste.
' Robotics with the Boe-Bot - BalancePhotoresistors.bs2
' Test adjustments to Boe-Bot photoresistor circuits.
' {$STAMP BS2}······························ ' Stamp directive.
' {$PBASIC 2.5}····························· ' PBASIC directive.
timeLeft····· VAR···· Word·················· ' Variable declarations.
timeRight···· VAR···· Word
DEBUG "PHOTORESISTOR VALUES", CR,··········· ' Initialization.
····· "timeLeft· timeRight", CR,
····· "
·
"
DO·········································· ' Main routine.
· HIGH 11···································· ' Left RC time Measurement.
· PAUSE 3
· RCTIME 11,1,timeLeft
· HIGH 7···································· ' Right RC time measurement.
· PAUSE 3
· RCTIME 7,1,timeRight
· DEBUG CRSRXY, 0, 3,······················· ' Display measurements.
······· DEC5 timeLeft,
······· "···· ",
······· DEC5 timeRight,
······· "·· Before"
· timeLeft = (timeLeft */ 351) + 7
· DEBUG CRSRXY, 0, 5,······················· ' Display measurements.
······· DEC5 timeLeft,
······· "···· ",
······· DEC5 timeRight,
······· "·· After"
· PAUSE 200
LOOP
Thanks,
MovieMaker
I used two photoresistors that looked identical.· When I ran the Parallax test on Left and Right I found that they varied widely.
Left numbers were from Zero to 300+ while the right numbers were from 0-6500. They both worked but varied quite a bit. So, I replaced the whole circuit three times with the same result. I guess my conclusion is that the 0-300 numbers where the average and somehow I got a SUPER photoresistor.· To correct this, I guess I could go to RadioShack and buy a matched pair if they make them or just change the multipliers in software. What numbers in· the program are you getting. Here is the code. It is so small, I will just cut and paste.
' Robotics with the Boe-Bot - BalancePhotoresistors.bs2
' Test adjustments to Boe-Bot photoresistor circuits.
' {$STAMP BS2}······························ ' Stamp directive.
' {$PBASIC 2.5}····························· ' PBASIC directive.
timeLeft····· VAR···· Word·················· ' Variable declarations.
timeRight···· VAR···· Word
DEBUG "PHOTORESISTOR VALUES", CR,··········· ' Initialization.
····· "timeLeft· timeRight", CR,
····· "
·
"
DO·········································· ' Main routine.
· HIGH 11···································· ' Left RC time Measurement.
· PAUSE 3
· RCTIME 11,1,timeLeft
· HIGH 7···································· ' Right RC time measurement.
· PAUSE 3
· RCTIME 7,1,timeRight
· DEBUG CRSRXY, 0, 3,······················· ' Display measurements.
······· DEC5 timeLeft,
······· "···· ",
······· DEC5 timeRight,
······· "·· Before"
· timeLeft = (timeLeft */ 351) + 7
· DEBUG CRSRXY, 0, 5,······················· ' Display measurements.
······· DEC5 timeLeft,
······· "···· ",
······· DEC5 timeRight,
······· "·· After"
· PAUSE 200
LOOP
Thanks,
MovieMaker
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
What I finally did was change the numbers and I get the high number on both of them now. But, the low number instead of zero is around 300. After changing all the hardware three times, I figured that the low numbers where about average and I must have gotten a very sensitive chip.
Thanks for the reply.·
Post Edited (MovieMaker) : 4/27/2009 1:33:19 AM GMT
The capacitors in your R/C circuit can vary 20% and the resistors vary at least 5%, so there is no perfection with this circuit by design. You could also try using other pairs of caps, too.
I'm pretty certain that the book shows you how to adjust the two values to be somewhat equal, too.
It's all part of the fun and a good question you ask.
Ken Gracey