Hacking the WRT54G(L) Serial Port

or "How to Get Your Router to Talk to Your Arduino"

Two weeks ago was another De Anza electronics swap meet, so my father and I went for a day of digging through boxes of junk trying to find something actually worth money.  I hit the jackpot with a WRT54Gv2, which was before LinkSys switched that line over to VxWorks and started the WRT54GL line to continue the Linux-based line.

As the saying goes - If it's electronic, we can hack it.  If it runs Linux, it's really easy.

The WRT54 motherboard breaks out two 115k 3.3V serial ports.  A classic first hack is to solder on headers, and install a daughter board with a RS232 driver, and a DB-9 port on the outside of the case.  I'm thinking about eventually doing this, but for my first experiment, I kept the serial port at TTL levels and fed it into my Arduino to print on an HD44780 LCD screen.

Video:
 
 Errata: I'm talking about volts at the end.  The Arduino runs at 5 [volts].
Note that the Arduino board is just there as a convenient 5V power supply for the ATMega on the breadboard (which is running Arduino software, and is therefore still technically an Arduino-based platform).

The WRT54G runs at 3.3V, which means its serial port runs at the same.  Ideally, I would have the AVR running at 3V as well, but none of my LCD screens would run at 3V, so I VERY CAREFULLY kept the two systems at different voltages.  Since I am only passing information from the WRT54G to the Arduino, the difference between a 3V high and a 5V high signal is insignificant.  Going the other direction would require a voltage divider at the very least to keep the 5V from the AVR from doing very unfriendly things to the WRT mobo.

Specs:
WRT54Gv2 running Tomato 1.28
The serial port 0-out is JP1-pin 4 and runs at (115200, 8, N, 1)
I used pin 10 on the same jumper as a ground reference
The serial ports are /dev/tts/0 and /dev/tts/1, and can be treated just like every other file in *nix.
The demo command I demonstrated in the video was:
# echo "This is a test message" > /dev/tts/0
Source code running on Arduino.

Popular Posts