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

IR control

roadrunner3groadrunner3g Posts: 36
edited 2004-12-30 13:26 in BASIC Stamp
tongue.gif
skull.gif
i am haveing problems with IR control!! i am trying to get a signal from· a legomindstorms ris 2.0 to receve a signal and send a signal to a BS2 chip?······· WHAT I NEED is a program to decifere an IR signal and give it a value, so i can write a program to work with the values from an unnone IR sorce!!
smhair.gif·smhair.gif

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-30 12:48
    Oh, don't we all need this kind of program?

    Your best bet is to write a simple BS2 program which reads the pulse-widths coming out of an IR decoder module.

    Any IR signal is a modulated 36 Khz to 42 Khz 'pulse'. When the 36Khz is there, the IR Decoder output goes low. When the 36Khz is not there, the IR Decoder output goes high.

    Then, vendors define certain pulse widths (0.6 and 1.2 mSec for the Sony protocol) to define a '1' and a '0' bit. Then, vendors combine the '1' and '0' bits into transmission packets.

    Lookup the Sony protocol, and the Phillips RC-5 protocol. These are two of the best documented protocols, and will get you started. For the RIS 2.0 protocol, you'll have to write several programs. The first will be to 'listen' and find the width of the first bit. This is NOT a trivial problem, or somebody would have solved it already.
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-30 13:26
    Hello again.

    Some more research turned up: http://www.crynwr.com/lego-robotics

    This site has some very nice RCX info and links. It turns out the RCX protocol is:

    The IR protocol associated with sending a "message" to the RCX is pretty simple. Bit encoding is 2400 bps, NRZ, 1 start, 8 data, odd parity, 1 stop bit. A '0' is coded as a 417us pulse of 38kHz IR, a '1' bit is 417us of nothing.

    At the packet level, all packets look like this:

    0x55 0xff 0x00 D1 ~D1 D2 ~D2 ... Dn ~Dn C ~C

    where D1...Dn are the message body, and C = D1 + D2 + ... Dn.

    The data for sending an IR message is F7 followed by the 8 bit
    "message". For example:

    55 ff 00 f7 08 12 ed 09 f6

    is a packet sending the message "0x12" to the RCX.

    -- So, you should be able to use 'FREQOUT' statements to an IR-LED to generate these signals. The 'odd' parity could be difficult -- but you can pre-figure that. You should be able to recieve with 'PULSIN' statements, from an IR-Decoder.

    P.S. just found: http://oase.uci.kun.nl/~mientki/Lego_Knex/Lego_electronica/IR_tower/IR_tower.htm


    Post Edited (allanlane5) : 12/30/2004 1:29:32 PM GMT
Sign In or Register to comment.