Shop OBEX P1 Docs P2 Docs Learn Events
What is the right IR receiver for BS2 and the experiments from the BoeBot manua — Parallax Forums

What is the right IR receiver for BS2 and the experiments from the BoeBot manua

IceFireProIceFirePro Posts: 86
edited 2010-06-10 20:43 in BASIC Stamp
I was today at Radioshack, and only found "IR RECEIVED and IR DETECTOR package for 3:49 i think. But the part shown in the tutorial from Parallax has 3 pins, rather than 2. What's going on here?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-10 03:02
    You found an IR phototransistor at RadioShack. Look that up in the Wikipedia. Parallax's tutorial uses a modulated IR receiver. Look up the datasheet for the device (via the link on the webstore page) and you'll see a diagram for what's inside. The phototransistor detects the presence of any IR. The receiver/detector contains a phototransistor or photodiode, amplifier, filter, and a detector for pulsed IR with a pulse rate of around 38KHz. Some receiver/detectors have a center frequency of 40KHz.
  • IceFireProIceFirePro Posts: 86
    edited 2010-06-10 03:59
    Unfortunately, they don't have the modulated receiver at radioshack.

    What can i do with the infrared phototransistor? What's it's application?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-10 04:09
    Typically a phototransistor is used when the distance to the IR LED is small and there's little chance of ambient light getting into things. One example is a "photointerrupter" where there's a disk on a motor shaft or knob shaft and the disk is opaque to IR with evenly spaced holes in it. You have an IR LED on one side of the disk and an IR phototransistor on the other side. Normally no light gets through. When the disk rotates to where a hole comes between the LED and phototransistor, the phototransistor conducts. You can use this as a tachometer sensor for measuring shaft speed or a distance sensor for measuring distance travelled if the shaft is that of a wheel.

    The whole purpose of using modulated IR is to minimize the effect of ambient light. Room lights and the sun don't put out 38KHz pulses of light although some compact fluorescent bulbs did. The manufacturers of the bulbs changed the frequency to try to avoid this.
  • IceFireProIceFirePro Posts: 86
    edited 2010-06-10 04:46
    This is a very helpful post. Thanks!
  • KB3JJGKB3JJG Posts: 95
    edited 2010-06-10 11:34
    They do sell a modulated receiver at the shack, the part number your looking for is 276-640, link here http://www.radioshack.com/product/index.jsp?productId=2049727

    Here is some code I use with that detector and a universal remote programmed for SONY.· This code drives my bot, works some led's, and moves a ping servo back and forth.· The subs for actual direction are missing, they are not needed for this example.
    IrDet PIN 9  
    irPulse VAR Word
    remoteCode VAR Byte
     
    DO
    GOSUB Get_Ir_Remote_Code
    IF remoteCode = 6 THEN GOSUB turn_right
    IF remoteCode = 4 THEN GOSUB turn_left
    IF remoteCode = 2 THEN GOSUB go_foreword
    IF remoteCode = 8 THEN GOSUB go_back
    IF remoteCode = 5 THEN GOSUB no_motion
    IF remotecode = 7 THEN GOSUB ping_left
    IF remoteCode = 9 THEN GOSUB ping_right
    IF remoteCode = 0 THEN GOSUB ping_center
    IF remoteCode = 3 THEN GOSUB led
    IF remoteCode = 1 THEN GOSUB ledoff
    LOOP
    RETURN
     
    Get_Ir_Remote_Code:
    remoteCode = 0 ' Clear all bits in remoteCode
    ' Wait for resting state between messages to end.
    DO
    RCTIME IrDet, 1, irPulse
    LOOP UNTIL irPulse > 1000
    ' Measure start pulse. If out of range, then retry at Get_Ir_Remote_Code.
    RCTIME 9, 0, irPulse
    IF irPulse > 1125 OR irPulse < 675 THEN GOTO Get_Ir_Remote_Code
    ' Get data bit pulses.
    RCTIME IrDet, 0, irPulse ' Measure pulse
    IF irPulse > 300 THEN remoteCode.BIT0 = 1 ' Set (or leave clear) bit-0
    RCTIME IrDet, 0, irPulse ' Measure next pulse
    IF irPulse > 300 THEN remoteCode.BIT1 = 1 ' Set (or leave clear) bit-1
    RCTIME IrDet, 0, irPulse ' etc
    IF irPulse > 300 THEN remoteCode.BIT2 = 1
    RCTIME IrDet, 0, irPulse
    IF irPulse > 300 THEN remoteCode.BIT3 = 1
    RCTIME IrDet, 0, irPulse
    IF irPulse > 300 THEN remoteCode.BIT4 = 1
    RCTIME IrDet, 0, irPulse
    IF irPulse > 300 THEN remoteCode.BIT5 = 1
    RCTIME IrDet, 0, irPulse
    IF irPulse > 300 THEN remoteCode.BIT6 = 1
    ' Adjust remoteCode so that keypad keys correspond to the value
    ' it stores.
    IF (remoteCode < 10) THEN remoteCode = remoteCode + 1
    IF (remoteCode = 10) THEN remoteCode = 0
    RETURN
    
    
  • ercoerco Posts: 20,256
    edited 2010-06-10 15:44
    Another use for a phototransistor is as an analog signal receiver. WAY back in high school, my winning science fair project was Forest Mimms-inspired voice transmitter & receiver. Speak into a microphone, and your voice does amplitude modulation of an IR LED beam. The receiver's phototransistor picked up that IR beam, amplified it and piped the sound out of a speaker. With lenses and proper alignment I could get decent audio at ~30-40 feet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • IceFireProIceFirePro Posts: 86
    edited 2010-06-10 20:43
    Great! I have a spare Comcast remote, I'll go buy the receiver today.
Sign In or Register to comment.