Shop OBEX P1 Docs P2 Docs Learn Events
IR Signal — Parallax Forums

IR Signal

vla7vla7 Posts: 79
edited 2009-03-31 20:15 in BASIC Stamp
I'm looking to send an IR signal to two IR detectors.· Each IR detector will be associated with it's own LED.· For example the right IR detector associated·with a green LED and the left IR detector associated·with a red LED.· I want the detectors to compare the IR signal and if the right detector is receiving the stronger signal than the green LED would light up and likewise for the left detector and red LED.· I have built my own IR Beacon to do this.· I can make an led light up if·a detector·'sees' the IR signal but I don't know how to write the code to have two detectors compare the signal value.· I would appreciate any guidance accomplishing this.· I will be using a basic stamp.
·

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-03-31 03:38
    It's sort of difficult to do what you want, since the IR detectors only have high or low outputs. The best that I can think of would be to PWM the IRLED with less and less high (over some amount of time), then time how long the signal takes to go away. Compare the times, and you'll have the weaker signal. Alternately, you could slowly modify the pulse frequency away from the prime for a similar effect. You may have a hard time doing this with a BS2, though (as opposed to a Propeller).
  • ercoerco Posts: 20,256
    edited 2009-03-31 20:15
    Assuming that you're dealing with ~38 khz pulsed IR, SLRM is correct, most 3-lead signal detectors are simply on/off devices that go low when they detect a signal. They don't give an analog intermediate value when they get a weak signal.

    So two thoughts for you. First, mount your two detectors slightly off-axis (non-parallel) in seperate optical enclosures so they can only see out through a limited window (aperture) and each one has a different angle of view. The two ranges will overlap in the center, when both detectors see your beacon. Off-center, only one will see the beacon. You'll want to make your baffles light-tight all around and paint them with non-reflecting ultra flat black spray paint. This can be painted posterboard or almost anything, but it needs to be optically opaque and non-reflecting.

    Second, you could play the frequency sweep game, where your beacon sends IR tone IR bursts at ~32 Khz, 33, 34, 35,·36, 37,38, then repeats. These off-frequency bursts will eventually trigger your sensors,·and assuming they are identical sensors, the one with the best view (closer or aimed more directly at beacon) will trigger first (more off-frequency). Plenty of examples of this in· Boe-Bot & Scribbler code, where the robot emits an off-frequency signal sweep, looking for a reflection from nearby objects. The more off-frequency signal detected, the closer (or more IR reflective) an object is.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.