Shop OBEX P1 Docs P2 Docs Learn Events
IR Remote controller — Parallax Forums

IR Remote controller

TumblerTumbler Posts: 323
edited 2009-09-30 14:39 in BASIC Stamp
Hello,

Is it possible to read an ir beam from, let's say, tv remote controller and program a bs2 so i can produce the same ir beam?
I searched here on this forum but couldn't find similar posts.

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2009-09-28 14:55
    The short answer is yes....www.parallax.com/StoreSearchResults/tabid/768/txtSearch/ir/List/0/SortField/4/ProductID/322/Default.aspx

    You might find that the stamp might not be able to reproduce the IR beam properly.

    There are two methods:
    One is to use the FREQOUT function and rely on the harmonic of the freqout frequency to act as your IR 38kHz carrier signal. This kinda works....between freqout pulses you'll want to NOT transmit...or pause for x amount of time. In the BS2, this is limited to the resolution of the pause statement...which is 1mS.
    The other is to use a 555timer as your main carrier (38kHz) and pulse it on and off with the pulsout command....I didn't find this to work so nicely for me either....for the same pause issues. (I guess one could pulsout to a non-connected pin for the short duration before going back to pulsout the proper connected pin...must try that).

    I just recreated an IR shutter remote for my camera and had this same problem. The Stamp could produce the proper length of ON signal, but the off signal wasn't short enough (I need pause for 700uS not 1mS).

    My SX setup was broken, so ended up using the propellor I had kicking around....worked way nicer, although is a bit overkill!

    Cheers

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
  • ZootZoot Posts: 2,227
    edited 2009-09-28 16:16
    said...
    I just recreated an IR shutter remote for my camera and had this same problem. The Stamp could produce the proper length of ON signal, but the off signal wasn't short enough (I need pause for 700uS not 1mS).

    Actually, there is a way to pause for very short and relatively precise times IF you have a free pin -- do a PULSOUT to the free and unused pin to kill time in intervals shorter than 1ms.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • aeroguyaeroguy Posts: 3
    edited 2009-09-28 21:06
    Zoot said...
    said...
    I just recreated an IR shutter remote for my camera and had this same problem. The Stamp could produce the proper length of ON signal, but the off signal wasn't short enough (I need pause for 700uS not 1mS).

    Actually, there is a way to pause for very short and relatively precise times IF you have a free pin -- do a PULSOUT to the free and unused pin to kill time in intervals shorter than 1ms.

    I've been dealing with this same issue - i.e. trying to generate short IR pulses with 1/2millisecond pauses in between. I haven't had success yet.

    Do you happen to know how long the PULSOUT command will take (sending it to an empty pin)?

    I don't have a scope to measure these things.

    Any help much appreciated!

    PS - a product support person also suggested using FREQOUT with a duration of 0 (zero), though he couldn't tell me how long that pulse would last.
  • ZootZoot Posts: 2,227
    edited 2009-09-28 21:20
    See here: www.emesys.com/BS2speed.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • TumblerTumbler Posts: 323
    edited 2009-09-29 06:27
    It's not easy after reading this (NEC protocol, wich olympus is using)
    The only thing i know is the olympus device address (dec 35)

    Now searchin a howto to send info over IR confused.gif

    Thx for the answers here
  • stephenwagnerstephenwagner Posts: 147
    edited 2009-09-29 12:09
    Tumbler,

    I have BS2 code to both transmit and receive NEC and RCA protocols that I used for this project: http://www.parallax.com/tabid/321/Default.aspx

    In an efffort to get the timing correct, i used an external 38KHz IR modulator from: http://www.rentron.com/remote_control/TX-IR.htm

    and data sheet: http://www.rentron.com/Files/TX-IR.pdf. A 555 timer approach did not work as well as the stable oscillator from rentron.

    I have used the NEC protocol BS2 transmitter to control a Canon camera, Scientific Atlanta Digital HD cable box, and a Panasonic HDTV.

    I will post the code tomorrow. There are a few tricks.

    1. Turn the oscillator IR·on and use PULSOUT to turn it off. The IR on is always a fixed length. The IR off has two delays depending if you transmit a "0" or a "1".

    2. PULSOUT to a dummy pin for short delays.



    SJW
  • TumblerTumbler Posts: 323
    edited 2009-09-29 13:40
    stephenwagner said...
    I will post the code tomorrow. There are a few tricks.

    That would be nice Stephen.
  • aeroguyaeroguy Posts: 3
    edited 2009-09-30 14:12
    I put together a setup using a 555 to generate 38kHz pulses which activate one transistor connected to the IR LED, which draws current from my power source, not the 555 (i.e., I'm amplifying the signal).

    There's a second transistor ~in series that only allows current to flow through the first transistor(and thus the IR LED) when it receives a high signal from my BS2.

    The signals from the BS2 are generated using the PULSOUT command, with the appropriate on/off sequences.

    I've been trying to turn my TV on and off with this, but have yet to accomplish it.

    I've measured the frequency of the 555 output, and it's good. I've also substituted a visible LED for the IR LED to see if the pulses from the BS2 were activating it, and they were (I saw a brief flash).

    Not sure what the problem is.... I think this arrangement should work. I have no means of monitoring what the IR LED is actually doing.

    Anyone have thoughts?

    Thanks!

    Post Edited (aeroguy) : 9/30/2009 2:19:53 PM GMT
  • aeroguyaeroguy Posts: 3
    edited 2009-09-30 14:16
    Zoot said...
    said...
    I just recreated an IR shutter remote for my camera and had this same problem. The Stamp could produce the proper length of ON signal, but the off signal wasn't short enough (I need pause for 700uS not 1mS).

    Actually, there is a way to pause for very short and relatively precise times IF you have a free pin -- do a PULSOUT to the free and unused pin to kill time in intervals shorter than 1ms.

    Zoot - I wonder if, for example, a PULSOUT, pin, 250 causes a pause of 500ms, (since each unit is 2 micro seconds), or if the program execution time significantly increases the effective pause...?

    That might explain why my setup isn't working, though it could be lots of things...
  • ZootZoot Posts: 2,227
    edited 2009-09-30 14:23
    Yes, you need to take into account some overhead as well. Using Tracy's timings at www.emesys.com/BS2speed.htm for BS2, you might expect 220-250us overhead for the command itself (about a 1/4 ms).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • stephenwagnerstephenwagner Posts: 147
    edited 2009-09-30 14:39
    The below code turns the modulator·ON for 9000 uSec,·OFF for 4500 uSec,·ON for 572 uSec,·OFF for 556 uSec or 1688 uSec,·ON for 572 uSec, OFF for 566 uSec or 1688 uSec........and the last ON for 572 uSec.

    I have not found a consumer product that has not responded to the short light ON burst.

    As long as the leading edge of the light ON to Light ON does not exceed the NEC specifications of 1130 uSec and 2260 uSec, it should work.

    Here·are the tricks. 1; The code starts by turning·ON the 38KHz modulator HIGH lightoff. PULSOUT lightoff·to the modulator and the light turns OFF. PULSOUT to the unconnected pin and the light remains ON. 2; The light is on between PULSOUT lightoff .bit math instructions for 572 uSec. I hope that makes sense.

    Here is the code:

    lightoff PIN 0 'Connet to 38KHz modulator
    lighton PIN 4 'Connect to nothing

    'a pulseout of 648 lighton is not achievable. 572uSec is achievable with no instruction befor the .bit math. Any instructions between .bit math instructions yields a light on in excess off 1130 uSec.

    'Therefore
    'a zero = 648 lighton + 480 lightoff = 1128 or 572 lighton + 556 lightoff = 1128uSec
    'a one = 648 lighton + 1612 lightoff = 2260 or 572 lighton + (556 lightoff + 1132 lightoff = 1688)) = 2260uSec

    codehigh VAR Word ' your commands
    codelow VAR Word

    Your code here:

    HIGH lightoff 'Turn on Transmitter
    PULSOUT lighton, 4254 ' 9000 uSec burst. On for 9000 uSec
    PULSOUT lightoff, 2247 'Off for 4500 Usec

    'codehigh.bit 15
    PULSOUT lightoff, pulseout1 * codehigh.bit15 + pulseout0

    'No code here yealds a light ON for 572 uSec.

    'The PULSOUT .bit math yields a light OFF for 556 uSec or 1688uSec.

    '572 + 556 = 1128·uSec and 572 + 1688 = 2260 uSec. 1128 or 1130 and 2260 are the NEC specifications for edge to edge timing.

    'codehigh.bit 14
    PULSOUT lightoff, pulseout1 * codehigh.bit14 + pulseout0

    'codehigh.bit 13
    PULSOUT lightoff, pulseout1 * codehigh.bit13 + pulseout0

    'codehigh.bit 12
    PULSOUT lightoff, pulseout1 * codehigh.bit12 + pulseout

    'codehigh.bit 11
    PULSOUT lightoff, pulseout1 * codehigh.bit11 + pulseout0

    'codehigh.bit 10
    PULSOUT lightoff, pulseout1 * codehigh.bit150+ pulseout0

    'codehigh.bit 9
    PULSOUT lightoff, pulseout1 * codehigh.bit9 + pulseout0

    'codehigh.bit 8
    PULSOUT lightoff, pulseout1 * codehigh.bit8 + pulseout0

    'codehigh.bit 7
    PULSOUT lightoff, pulseout1 * codehigh.bit7 + pulseout0

    'codehigh.bit 6
    PULSOUT lightoff, pulseout1 * codehigh.bit6 + pulseout0

    'codehigh.Bit 5
    PULSOUT lightoff, pulseout1 * codehigh.bit5 + pulseout0

    'codehigh.bit 4
    PULSOUT lightoff, pulseout1 * codehigh.bit4 + pulseout0

    'codehigh.bit 3
    PULSOUT lightoff, pulseout1 * codehigh.bit3 + pulseout0

    'codehigh.bit 2
    PULSOUT lightoff, pulseout1 * codehigh.bit2 + pulseout0

    'codehigh.bit 1
    PULSOUT lightoff, pulseout1 * codehigh.bit1 + pulseout0

    'codehigh.bit 0
    PULSOUT lightoff, pulseout1 * codehigh.bit0 + pulseout0

    'codelow.bit 15
    PULSOUT lightoff, pulseout1 * codehigh.bit15 + pulseout0

    'codelow.bit 14
    PULSOUT lightoff, pulseout1 * codehigh.bit14 + pulseout0

    'codelow.bit 13
    PULSOUT lightoff, pulseout1 * codehigh.bit13 + pulseout0

    'codelow.bit 12
    PULSOUT lightoff, pulseout1 * codehigh.bit12 + pulseout

    'codelow.bit 11
    PULSOUT lightoff, pulseout1 * codehigh.bit11 + pulseout0

    'codelow.bit 10
    PULSOUT lightoff, pulseout1 * codehigh.bit150+ pulseout0

    'codelow.bit 9
    PULSOUT lightoff, pulseout1 * codehigh.bit9 + pulseout0

    'codelow.bit 8
    PULSOUT lightoff, pulseout1 * codehigh.bit8 + pulseout0

    'codelow.bit 7
    PULSOUT lightoff, pulseout1 * codehigh.bit7 + pulseout0

    'codelow.bit 6
    PULSOUT lightoff, pulseout1 * codehigh.bit6 + pulseout0

    'codelow.Bit 5
    PULSOUT lightoff, pulseout1 * codehigh.bit5 + pulseout0

    'codelow.bit 4
    PULSOUT lightoff, pulseout1 * codehigh.bit4 + pulseout0

    'codelow.bit 3
    PULSOUT lightoff, pulseout1 * codehigh.bit3 + pulseout0

    'codelow.bit 2
    PULSOUT lightoff, pulseout1 * codehigh.bit2 + pulseout0

    'codelow.bit 1
    PULSOUT lightoff, pulseout1 * codehigh.bit1 + pulseout0

    'codelow.bit 0
    PULSOUT lightoff, pulseout1 * codehigh.bit0 + pulseout0


    'stop bit = 560 uSec
    PULSOUT lighton, 105 '105 should yields 572 uSec Last One
    LOW lightoff 'Turn transmitter off

    More of your code here:



    I hope this helps
Sign In or Register to comment.