Need help on Lego USB Tower infrared format

I am the lead programmer on the Robosapien Dance Machine project; an open
source free program that lets Robosapien owners control their Robosapien
from their PC. Currently I am using a third party infrared device for the
infrared code transmission; which acts as a replacement for the Robosapien's
included infrared remote control.
I am also a Lego Mindstorm 2.0 owner and I would like to be able to use the
USB Tower to control the Robosapien (and later the serial tower).
I can read and write the USB tower just fine, however, my Robosapien never
responds to the codes I'm sending. I'm guessing this is because of a low
level format difference in the infrared data stream structure between the
Robosapien's remote control and what the Lego USB IR Tower is sending.
Do any of you have any tips or ideas on how I can get this to work?
I'm guessing I need to alter the low level format of what the USB Tower is
putting out, but I don't know how to do this.
I got the following Robosapien format information from this URL:
formatting link

----------------- Robosapien IR format
The IR Carrier is 39.2kHz. Data is modulated using a space coded signal with
8 data bits (data clock is 1200Hz, but actual data rate varies depending on
the data).
You can skip the IR and IR modulation by wiring directly into the main
PCBoard. This can be encoded easily by almost any small microprocessor. For
modulating the signals yourself, the signal looks something like this:
Timing based on 1/1200 second clock (~.833ms)
Signal is normally high (idle, no IR).
Start: signal goes low for 8/1200 sec.
Data bits: for each of 8 data bits, space encoded signal depending on bit
Sends the most significant data bit first
If the data bit is 0: signal goes high for 1/1200 sec, and low for
1/1200 sec.
If the data bit is 1: signal goes high for 4/1200 sec, and low for
1/1200 sec.
BTW: The first bit (msb) is always 1 (valid codes are from $80 to $FF)
When completed, signal goes high again.
No explicit stop bit. Minimal between signals is not known.
Reply to
Robert Oschler
Loading thread data ...
Ah, the problem is simple. It's hardware. The RCX uses 38kHz, so it cannot be seen by the 39.2 kHz system and vice versa. You will not be able to do anything about that unless you can change the basic modulator/demodulator frequency. I may be wrong, but I suspect that it is hard wired because the modules are made by the millions and dirt cheap that way. Just about every TV, VCR, DVD, etc. uses the 38kHz standard. Think of it like being on a different radio channel (except this is IR) and you have a pretty good idea of why it won't work.
Sir Charles W. Shults III, K. B. B. Xenotech Research 321-206-1840
Reply to
Sir Charles W. Shults III
1.2 kHz should not be enough of a difference to cause incompatibility in consumer IR. My guess is that the protocols (start bit, word length etc.) are different. The IR gurus can be found in the forums at
formatting link
formatting link
Please use the search functions before asking questions that have already been answered there.
OK so I did a little research...
No messages on lego or robosapien pop up on hifi-remote. has a bunch of stuff on lego including some ccf files that have the lego IR code for the Phillips Pronto remote. From loading and analyzing one of the ccf files I can tell you that the data structure (protocol) is VERY different.
From the OP it appears that the robosapien uses a very standard consumer IR format. The start bit is twice as long as a 1 and a 1 is four times as long as a 0. Standard consumer IR stuff.
For the lego stuff it uses a fairly complex protocol compared to the robosapien. The time base seems to be about the same at .8 ms but then it gets very different. It starts with 4 equal 1 count on off transitions then stays off for 2 counts then on for 1 then off for 10 counts then on for 9 counts then off for 2 counts. After all of this it appears ready to send data. I didn't get into decoding the data but it appears that both the on and off times vary.
Due to the large difference the easiest way is to use two transmitters. One for robosapien and one for lego.
Lego stuff:
formatting link
Best of luck!!!
Reply to
Lewis Gardner
It's unlikely that you can accomplish this unless you can control the IR output of the USB Tower at a lower level. You will need direct control of the duration of the IR bursts and periods of silence and it's unlikey you can reprogram the Lego hardware unless it offers a mode for low level control.
You might want to consider using something like USB-UIRT to control both the Lego and Robosapien.
formatting link
It's very easy to record the actual IR using an inexpensive IR receiver and a PC soundcard. I've documented this at...
formatting link

Reply to
Dave Houston
The software currently already supports Jon Rhees USB-UIRT, it is indeed an excellent unit. I am trying to save people a few dollars who already have an IR device like Mindstorm owners do.
I like that page you posted on learning IR and converting it to WAV data. Does anybody sell a pre-assembled version of the IR to sound circuit? I'm not the best breadboarder on the planet, and I'd like to experiment with that device.
Reply to
Robert Oschler
formatting link
Thanks for the links to the IR sites!
I have just been informed that the problem is a time-base problem as you pointed out. The Lego USB IR Tower outputs signal at 2400 baud and the Robosapien wants 1200 baud. So I guess the bits are too "thin". I can't find any documents showing a way to alter the IR tower baud rate, but I'll keep searching. It's a shame that the IR manufacturers never standardized like the UART people did.
Sad. So it looks like I'll be able to support Lego Mindstorms with the older serial towers, but not the newer USB towers. Talk about an "un-upgrade". Of course the USB towers don't need batteries and therefore are usable with a strong signal. But still, all they needed was a clock adjustment.
Reply to
Robert Oschler
You'll need low level access to the hardware. The Mindstorm communication protocol is considerably different and the hardware isn't going to recognize the Robosapien commands even if you use the same baud rate.
It's not currently being sold by anyone.
Reply to
Dave Houston
Since you already have the USB-UIRT you can learn the codes with it and save them as CCF hex codes.
Reply to
Dave Houston

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.