To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 94
93  |  95
Subject: 
Re: Decoding the LEGO IR remote control
Newsgroups: 
lugnet.robotics.rcx
Date: 
Sat, 18 Sep 1999 23:28:02 GMT
Viewed: 
1377 times
  
Nick Taylor  <ntaylor@iname.com> wrote:
But I don't have clue as to how it is encoded on the IR beam.  When I
look at the demodulated output, I'm not smart enough to figure out their
encoding protocol ... even knowing what the encoded data should be!

The Lego IR protocol is pretty simple.  If you have demodulated output,
why not dump some samples here so we can see if they make sense?

The encoding is straight serial, but inverted - a pulse of light indicates
a zero or a low voltage on a serial line.  It runs at 2400 baud, odd
parity, one start bit, one stop bit.

I believe serial is normally high; the start bit is a drop to zero, the
first data bit follows one bit time later.  After the eighth data bit, a
ninth bit is added so that the xor of all eight data bits plus the ninth
bit (the parity bit) is odd.  The stop bit follows the parity bit and is
always high.  (I might have the levels of the start/stop bits reversed, my
apologies if this is the case; but I think I remembered correctly, since
the reason that zero/low is transmitted with light is so that the light is
normally off when the line is idle.

Okay, so given that description, and the fact that the serial is modulate
at 38kHz, you can figure out that there are going to be many short pulses
of light for each serial bit transmitted at 2400 baud.  You are probably
going to need some sort of circit to demodumate this, if the parts you have
don't do this already.  A capacitor might be all you need, but maybe you
will also need a diode or two or three or four, I don't know.

So given that the signal is just a serial signal, you should be able to
convert the IR into a byte stream.  But that byte stream does not simply
store the d2 xx yy bytes that were mentioned earlier.  It instead contains
a header, the d2 xx yy bytes, some extra complement bytes, and a checksum.

The exact encoding of Lego messages is:

55 ff 00 D1 D1' D2 D2' ... Dn Dn' C C'

D1 represents the first data byte; D1' is the complement (logical NOT) of
the first data byte.  D2 through Dn are additional data bytes, and D2'
through Dn' are additional complement bytes.  C is the least significant
byte of the sum of all data bytes, and C' is the complement of C.

A remote control messsage would then look like this:

55 ff 00 d2 2d xx xx' yy yy' C C'

Where xx, yy, C, and their complements depend on what button you pressed.

Given a properly demodulated input stream of bytes from the remote control,
you should now be able to extract xx and yy and figure out which buttons
were pressed given the description of the remote control message data
posted earlier.

P.S. Dave Baum did most of the work on the low-level serial byte encoding
(buad, parity, etc.); a good amount of this discussion is just a rehash of
a post he made a long while back regarding that topic.

-Kekoa



Message has 1 Reply:
  Re: Decoding the LEGO IR remote control
 
This LEGO IR remote control (#9738) is making me crazy!!!! Dave and Kekoa have posted in depth explanations of the remote's coding, but I must be awfully dense and am missing something somewhere. I've tried two approaches: First, I used both a (...) (25 years ago, 19-Sep-99, to lugnet.robotics.rcx)

Message is in Reply To:
  Re: Decoding the LEGO IR remote control
 
Hi All - - A couple of weeks ago I received my LEGO MindStorms #9738 remote control. It's really cool to be able to select, start, and stop programs ... override the motor controls ... send messages, etc. If fact, it's SO COOL that I want to be able (...) (25 years ago, 18-Sep-99, to lugnet.robotics.rcx)

11 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR