RCX FTDI IR "Tower"
Posted: 17 Mar 2011, 07:42
Not that most of you care much about RCX related stuff, but perhaps someone will benefit from this anyways
Ever since the beginning of my RCX collection, I have always programmed them with a Win98 computer. I like the stability and simplicity of Win98, but it has always been frustrating to not have internet on it, even though it sits right beside the main computer. One example of something I would wish to do, was copy a piece of code off of the internet, and paste it into the program I was building. In order to transfer files, I have to use a flash drive, and that gets annoying (and time consuming). So for a while now, I have obviously been wanting to program my RCX's with our Win7 computer. The problem was, there are no 64-bit drivers for the lego USB tower, and our computer doesn't have an RS-232 port. I know you can get USB to RS-232 adapters, but to get one guaranteed to work on a 64-bit system, you usually have to pay almost $20 US. I did however find and buy one that is guaranteed to work, for only about $3 US, but we'll see if it holds up to the sellers claim. It probably won't get here for a couple weeks or so, and I am just itching to program the RCX's with this computer. So in the meantime, I built a "tower" based on a SparkFun FTDI (yes, the 3.3v one, not 5v). It took me 13 or so hours to build/test/rebuild..., and now it works It took a lot of trial and error to get this to work. The first step was changing the FTDI COM port from the assigned 13 (or whatever it was) to a number that I can select in BCC. I decided to go with COM 2. Several of the concepts I used were based off of the Lego serial IR tower schematic; however, there is plenty of my own design in it. The only electronic tools I used, were an LED, and a serial terminal program on the computer (I may have used a multimeter once or twice). It sure would have been nice to have a scope or logic analyzer, but since I have neither, I did without. One problem I had, was getting "bad" messages because the TSOP was being over-saturated. Normally, you can just move the RCX back a little, and it's good to go, but the IR LED isn't being driven strong enough to have the RCX more than a few inches away. That is why I decided to put tape on the TSOP. It now works well within a few inches.
Some information:
LED must modulate at 38kHz when transmitting (solved using a 555).
The LED must be on for a 0 and off for a 1 (idle "1"). To invert the logic, I was using a 4049 (hex-inverter), but I needed a gate with two inputs (explained later), so I traded it for a 4001(NOR). The 4001 also provides the current for the IR LED, so the FTDI tx pin doesn't have to.
The TSOP signal MUST be disabled (not allowed to reach the FTDI rx pin) while transmitting (and for a very short time after). If it is able to receive, it would be like tying rx to tx in a half-duplex system (while transmitting). The IR from transmitting would go straight to the TSOP, and right into the rx buffer; NOT GOOD! I used a 555 in Monostable mode for timing to avoid this. Note, I had to add a transistor to drain the cap (thus resetting the timer), whenever it sent another 0 (LED on). I fed the 555 output and the TSOP output into one of the NOR gates, so only if both were low (not transmitting, and also receiving a signal), it would output a high. I then inverted the signal so it would be right (1 high, 0 low as according to TTL UART specs), and finally sent the signal to the rx pin on the FTDI.
Things with blinky lights are always better The TFDI board has blinkies for both tx AND rx
This is one of my first projects using IR or UART (at this level), and it seems to work really well now. I am impressed (with this somewhat pointless project) to say the least
Oh, and I didn't let any magic blue smoke out of the parts in the making of this
Things to do:
Ever since the beginning of my RCX collection, I have always programmed them with a Win98 computer. I like the stability and simplicity of Win98, but it has always been frustrating to not have internet on it, even though it sits right beside the main computer. One example of something I would wish to do, was copy a piece of code off of the internet, and paste it into the program I was building. In order to transfer files, I have to use a flash drive, and that gets annoying (and time consuming). So for a while now, I have obviously been wanting to program my RCX's with our Win7 computer. The problem was, there are no 64-bit drivers for the lego USB tower, and our computer doesn't have an RS-232 port. I know you can get USB to RS-232 adapters, but to get one guaranteed to work on a 64-bit system, you usually have to pay almost $20 US. I did however find and buy one that is guaranteed to work, for only about $3 US, but we'll see if it holds up to the sellers claim. It probably won't get here for a couple weeks or so, and I am just itching to program the RCX's with this computer. So in the meantime, I built a "tower" based on a SparkFun FTDI (yes, the 3.3v one, not 5v). It took me 13 or so hours to build/test/rebuild..., and now it works It took a lot of trial and error to get this to work. The first step was changing the FTDI COM port from the assigned 13 (or whatever it was) to a number that I can select in BCC. I decided to go with COM 2. Several of the concepts I used were based off of the Lego serial IR tower schematic; however, there is plenty of my own design in it. The only electronic tools I used, were an LED, and a serial terminal program on the computer (I may have used a multimeter once or twice). It sure would have been nice to have a scope or logic analyzer, but since I have neither, I did without. One problem I had, was getting "bad" messages because the TSOP was being over-saturated. Normally, you can just move the RCX back a little, and it's good to go, but the IR LED isn't being driven strong enough to have the RCX more than a few inches away. That is why I decided to put tape on the TSOP. It now works well within a few inches.
Some information:
LED must modulate at 38kHz when transmitting (solved using a 555).
The LED must be on for a 0 and off for a 1 (idle "1"). To invert the logic, I was using a 4049 (hex-inverter), but I needed a gate with two inputs (explained later), so I traded it for a 4001(NOR). The 4001 also provides the current for the IR LED, so the FTDI tx pin doesn't have to.
The TSOP signal MUST be disabled (not allowed to reach the FTDI rx pin) while transmitting (and for a very short time after). If it is able to receive, it would be like tying rx to tx in a half-duplex system (while transmitting). The IR from transmitting would go straight to the TSOP, and right into the rx buffer; NOT GOOD! I used a 555 in Monostable mode for timing to avoid this. Note, I had to add a transistor to drain the cap (thus resetting the timer), whenever it sent another 0 (LED on). I fed the 555 output and the TSOP output into one of the NOR gates, so only if both were low (not transmitting, and also receiving a signal), it would output a high. I then inverted the signal so it would be right (1 high, 0 low as according to TTL UART specs), and finally sent the signal to the rx pin on the FTDI.
Things with blinky lights are always better The TFDI board has blinkies for both tx AND rx
This is one of my first projects using IR or UART (at this level), and it seems to work really well now. I am impressed (with this somewhat pointless project) to say the least
Oh, and I didn't let any magic blue smoke out of the parts in the making of this
Things to do:
Rewire it.
Replace the two 555's with a 556.
Try to get a better 38kHz duty cycle (I think it is around either 43% or 57% now).
Try to get better tx range (a better duty cycle should help).
Try to make the rx disable more efficient/faster.
Possibly solder it onto a perfboard.
Last, but certainly not least, draw the schematic.