Shop OBEX P1 Docs P2 Docs Learn Events
Question about photoresistors — Parallax Forums

Question about photoresistors

MovieMakerMovieMaker Posts: 502
edited 2009-04-28 00:15 in Accessories
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

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-04-26 23:57
    If you swap the left and right photoresistors do the values follow the hardware?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • MovieMakerMovieMaker Posts: 502
    edited 2009-04-27 01:28
    Yes.

    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
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2009-04-27 03:44
    MovieMaker,

    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
  • MovieMakerMovieMaker Posts: 502
    edited 2009-04-28 00:15
    Thanks.
Sign In or Register to comment.