Shop OBEX P1 Docs P2 Docs Learn Events
Light following robot — Parallax Forums

Light following robot

ltmhallltmhall Posts: 102
edited 2007-02-23 21:21 in BASIC Stamp
I'm designing a robot that will be able to roam towards a light in front of it (like the video in the boe bot video
library). However I will need it to roam towards a light in front of it with the room lights on.
Will I be able to use example in the robotics (pg 215) ?

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-02-23 00:12
    As long as the light you want it to follow is bright enough and the room lights are not "seen" by the sensor it should work. you might think about modulating the light it should follow and look for that. (like the ir detectors do)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • DerekDerek Posts: 15
    edited 2007-02-23 02:44
    You could also try to use a wheatstone bridge with your light senors with pots so that you can adjust the sensativity of the sensor so that its not sensative enough for the room light but can see a bright source that is pointed directly at them

    -Derek
  • ZootZoot Posts: 2,227
    edited 2007-02-23 07:17
    Another trick is to take readings from both sensors ONLY at startup (reset). Average them. Consider that your "ambient" light level. Then use that as threshold above which either sensor has rise before they'll kick the 'bot into action.

    Pseudo-code -- there are much more efficient ways to do this, and this doesn't show a difference threshold (e.g. left-right /6) but this illustrates the idea:

    Startup:
       get light left
       get light right
       ambient = ( light left + light right ) / 2
    
    Main:
        get light left
        get light right
         if ( light left > light right AND light left > ambient ) then
             turn left
         else if ( light right > light left AND light right > ambient ) then
             turn right
         else if ( light right > ambient and light left > ambient ) then
             go straight
         else
             stop
         endif
    
    goto main
    
    



    The bonus trick is -- deciding when and if the 'bot should "re-calibrate" the ambient light threshold.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • ltmhallltmhall Posts: 102
    edited 2007-02-23 11:57
    The light the robot has to follow will be brighter than the actual room light. However I'm planning on sheilding
    the photoresistor so they won't see the room lights. Is there an actual circuit I can build so I could adjust the
    sensitivity of the photoresistors ?
  • DerekDerek Posts: 15
    edited 2007-02-23 14:41
    Heres an image of a wheatstone bridge i found online. When G is 0v R1 and R2 are a ratio that is equal to RX and Rs

    or

    (R1/R2) = (Rx/Rs) when G=0V.

    by placing a potentiometer in the circuit you can adjust what the ratio will be until you find a suitable value. Placing the pot in different location has a different result but I wont spoil the fun of telling you everything, you can play with the circuit and find out.

    Note: The image does not show the pot and light sensor. Also an approx 100 ohm resistor is used in series with the potentoimeter. to test your circuit use a voltmeter where G is.


    ch28pg18.jpg
  • ltmhallltmhall Posts: 102
    edited 2007-02-23 14:54
    So I can place photoresistors where the resistors are located. Then place one lead of the pot in series with 100 ohms to
    the bridge. What supply voltage should I apply to the circuit 5V ?
  • DerekDerek Posts: 15
    edited 2007-02-23 21:21
    5V will work

    youll want to make a wheatstone bridge for each sensor tho.

    -Derek
Sign In or Register to comment.