Shop OBEX P1 Docs P2 Docs Learn Events
Two IR LED one IR reciver — Parallax Forums

Two IR LED one IR reciver

LutamosLutamos Posts: 26
edited 2008-08-26 02:43 in BASIC Stamp
Hi I am new to this forum it all seems promising for help with my question. Soo anyway Um like the title says I am wanting to just use one Ir receiver and two Ir led and I was wondering how I would go about programing that cause I am a newbie to programing the basic stamp. I have the Boebot USB kit.
I got my idea from this peace of hard ware I bought but I could never get it to work at all. www.lynxmotion.com/images/Products/Full/irpd01.jpg


Thank, you very much
Lutamos

Comments

  • GICU812GICU812 Posts: 289
    edited 2008-08-24 19:58
    Well most IR recievers work at 38.6 Khz, but yours could be diffrent.

    I dont know what you want to do, my first impression is that you want to monitor two diffrent break points with one reciever. In that case, you just use diffrent modulations. One LED would send hi-low-hi-low-hi the other hi-hi-lo-lo-hi-hi They would have to fire one at a time, so 1 - 2 -1 -2 - 2. So it wouldnt have the best response time, but it would still be measured in ms.
  • ercoerco Posts: 20,256
    edited 2008-08-24 20:01
    This is exactly how the collision detectors in Parallax' Scribbler robot work. One center mount IR receiver looks for alternating signals from IR LEDs mounted on the left and right side of the robot. The software pings a left IR pulse out, looks for a reflection, then pings a right IR pulse out and looks for a reflection. Works fairly well, uses 3 io's as implemented. Well-documented in Scribbler (perhaps also Boe-Bot) literature and software online. Alternatively, you could have a dedicated oscillator onboard (555 timer or equiv) continuously pinging out both sides simultaneously and have 2 IR receivers, just using 2 input pins.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-24 20:05
    A Stamp I/O pin can provide up to about 20mA of current. You can just drive both LEDs at the same time from the same I/O pin and use the code written for one LED. You need a current limiting resistor for each LED. An IR LED works at roughly 1.7V forward voltage. That means that the resistor has to drop (5V - 1.7V = 3.3V). At 10mA forward current, the resistor would have to be R = V / I = 3.3V / 0.01A = 330 Ohms. Each LED would need a 330 Ohm resistor in series with the anode lead. The cathode leads would be connected to ground (Vss). The other ends of the 330 Ohm resistors would both be connected to the Stamp I/O pin. When the Stamp I/O was made HIGH, the LEDs would turn on. The IR Remote for the BoeBot tutorial has all the programming examples you'll need as well as wiring examples.
  • GICU812GICU812 Posts: 289
    edited 2008-08-24 20:34
    Mike is right (as always tongue.gif) but if you drive both IR leds off one pin, there will be no way to diffrentiate between the two, that and my LEDs draw up to 50ma, so if you want full brightness, you'll need to use a transistor. They'll still work over short distances at 10ma though.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2008-08-24 20:49
    Save a resistor.

    2_in_series.jpg
  • LutamosLutamos Posts: 26
    edited 2008-08-24 20:55
    O oops I forgot to tell you guys what I was wanting to do with this. I am playing with the Ir navigation part from the boe bot book. so I want to try just using one receiver and didn't know how to go about programing it or if it was possible but I saw a video of someone using one receiver. So how would one reciver separate the left from the right light? would one light be at a different frequency than the other?
  • MSDTechMSDTech Posts: 342
    edited 2008-08-24 21:58
    Actually, you just sent a pulsed output to one of the IR LED's, check for a response then send a pulsed output to the other IR LED and check for its response. If one of them detects an object, the object is on the side of the robot you just pulsed.
    Similar to the following:
    IR_Detect···· PIN· 9
    IR_Left······ PIN· 10
    Ir_Right····· PIN· 11
    irDetectLeft··· VAR···· Bit············ ' Variable For Left IR Input
    irDetectRight·· VAR···· Bit············ ' Variable For Right IR Input
    Main:
    DO
    FREQOUT IR_Left, 1, 38500
    irDetectLeft = IR_Detect
    DEBUG "irDetectLeft = ", BIN1 irDetectLeft, CR
    PAUSE 20
    FREQOUT IR_Right, 1, 38500
    irDetectRight = IR_Detect
    DEBUG "irDetectRight = ", BIN1 irDetectRight , CR
    PAUSE 20
    DEBUG HOME
    LOOP
    END
  • LutamosLutamos Posts: 26
    edited 2008-08-25 01:25
    O Ok thank you for the help!
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-08-26 02:43
    Use two IR-LED's and two resistors -- a resistor costs about 5 cents or less, "saving" one doesn't help.
Sign In or Register to comment.