RCX FTDI IR "Tower"

Discussion specific to the intelligent brick, sensors, motors, and more.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

RCX FTDI IR "Tower"

Post by mattallen37 »

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 :D
IMG_0134.jpg
IMG_0146.jpg
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 8-) The TFDI board has blinkies for both tx AND rx :geek:

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 :ugeek:

Oh, and I didn't let any magic blue smoke out of the parts in the making of this :lol:

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.
Feel free to ask questions and make suggestions.
Last edited by mattallen37 on 18 Mar 2011, 04:18, edited 1 time in total.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
philoo
Posts: 76
Joined: 29 Sep 2010, 09:04
Location: Paris, France
Contact:

Re: RCX FTDI IR "Tower"

Post by philoo »

Neat hack, congratulations!
Perhaps you could have used a transistor to drive the IR Led, avoiding the need for inverter, and allowing much higher current in the LED (-> longer range)
Philo
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX FTDI IR "Tower"

Post by mattallen37 »

Great idea. I will probably try some ideas, including your suggestion after I get up (I'm planning on going to bed before long). I needed to invert the signal anyhow, and needed an OR or NOR gate for the rx blocking, so I just used the same IC. I think that upping the voltage might also help. Right now, it is running on the 3.3v FTDI supply, but I have a computer power supply on the computer desk at all times (and running when I'm sitting at the desk) that I can use to power the LED(s?).

Do you have any idea what wavelength the RCX LEDs are? I took the TSOP and two LEDs (only using one for this project) out of a broken RCX, but I only have 1 more broken RCX to get parts from. I have several 940nm LEDs. Do you think those will work as well as the RCX LEDs?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX FTDI IR "Tower"

Post by mattallen37 »

I just looked up the TSOP 1138 datasheet, and it's rated for 950nm. However, on the graph, it appears that it is almost as sensitive to 940nm.

Edit: 100% OT, but I just had to laugh when I saw this at the bottom of the datasheet "Ozone Depleting Substances Policy Statement...Vishay Semiconductor GmbH can certify that our semiconductors are not manufactured with ozone depleting substances and do not contain such substances." :lol:
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
philoo
Posts: 76
Joined: 29 Sep 2010, 09:04
Location: Paris, France
Contact:

Re: RCX FTDI IR "Tower"

Post by philoo »

Yes, receivers have a rather large radiation bandwidth, so most common IR leds should work fine. There are two main classes, those around 870nm, and those around 940. Of course the later better fit the receiver.

About voltage, yes, 3.3V is a bit short if you mounted two leds in series (their dropout is about 1.5V each). The best solution is probably to power them from USB 5V supply which can deliver up to 500mA.

If you have RCX2, this old stuff may be interesting to you: http://news.lugnet.com/robotics/rcx/?n=2003
Philo
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX FTDI IR "Tower"

Post by mattallen37 »

Ok, that's Nice to know. thanks.

The dropout? You mean forward voltage, or something else? Normally, and LED's forward voltage is more like 2.7v or so (non IR LEDs). Good to know though. I will use a multimeter to get the current to a "good" level.

Yes, I do have RCX2.0's. I actually have all three versions. IIRC, I read (a long time ago) that one of the RCX's used a TSOP based on 76 kHz. I think I read it was the 2.0, but that is what I got the TSOP 1138 from. Anyhow, if an RCX really does have a 76kHz TSOP in it, it probably wouldn't have as good of receiving reception. FYI The RCX I am using for testing this is a 1.0 WPJ (using the jack to power it at 9+ volts).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX FTDI IR "Tower"

Post by mattallen37 »

Guess what!!! I realized that I forgot to add the diode to the astable 555 circuit. As a result, I was getting about 25.8 kHz instead of 38 kHz. That could be a big part of why it had such short range :) I am working on rebuilding the circuit, and plan to use the diode this time ;) Hopefully I will be able to get better range.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX FTDI IR "Tower"

Post by mattallen37 »

Okay, so I rebuilt the entire thing, and remembered the diode this time. I also added a 2n2222 transistor for the LED. The other side, cathode, is driven by the 556, and obviously should be fine, as I think it can sink 200ma. I also took off the tape I had put on. I got great results :D

When the RCX is in short range, it is the limiting factor. It allows for up to somewhere around 60-70cm range (pointing directly at each other).

When the RCX is in long range, the IR "tower" is the limiting factor; allowing up to about 1 meter.

I still haven't tried changing the voltage, or adding more LEDs. I haven't even tried squeezing the last bit of power out of the LED the way it is now.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
nxtreme
Posts: 246
Joined: 29 Sep 2010, 03:53
Location: 192.168.1.2

Re: RCX FTDI IR "Tower"

Post by nxtreme »

As you probably know, some IR LEDs can be pulsed at up to one amp if done for very short periods of time, usually around 10 us on and 70 us off. If you're sure that the LED won't be on for more than 1-2 ms at a time, you could probably decrease the resistor value enough to let about 50 mA through the LED. And, if I understand things correctly, the LED will be modulated at 38KHz all the time, so on time shouldn't be a big deal. It looks great, I may just have to get myself an RCX!
One King to rule them all, One King to find them,
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: RCX FTDI IR "Tower"

Post by mattallen37 »

Okay.

Here is a quote from a page I use as reference.
Dave Baum wrote:The IR protocol associated with sending a "message" to the RCX is pretty
simple. Bit encoding is 2400 baud, 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
That pretty much says it all. It will always be modulated at 38kHz, and around 50% duty cycle.

I connected the LED to direct power (no modulation), and chose a resistor that allowed something like 43ma through (22 ohm). When modulated, my multimeter reads 14.7 ma (DC). This provides about 4 feet of range (direct).

Edit: And yes, you definitely should get an RCX (or two). The stuff is very cheap (an entire set for about $100, or around $60 for all the main electric parts), and you can build very small robots with them (compared to the NXT). The RCX resources are decent, and execution of code seems pretty fast. Just don't compare it to the NXT, and you will probably be quite surprised by it's performance. Also, don't program it with the retail software, it is much more limiting for the RCX than even NXT-G for the NXT.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests