Introduction

The Linksys WRT54GL is a great router. It runs a version of Linux and is very hackable. Since it's open source, a number of third-party firmware versions have sprung up which add signficant functionality beyond what the stock firmware provided. In addition to the software improvements, several hardware modifications can also be done to this router. Two of the most popular are to add dual serial ports as well as an SD card. After these modifications, the router can be used to control external electronics (like in my wifi robot project), and the SD card can be used to add gigabytes of storage capability.

Dual Serial Port Mod

Since the soldering in this mod is not very difficult, this is a good mod to attempt if you're just starting out in electronics and are looking to get some soldering experience. The electronics part is not too difficult, but the result can be very useful to control external electronics or just to have a serial console. There are mechanical case modifications that are required as well, which makes this mod a bit more tricky than just a soldering project.

1. 2. 3.

Disaasembly
1. Remove the 'void warranty' sticker!
2. Unscrew the two wifi antennas. The front blue faceplate snaps apart from the black body. It takes some force to seperate them, but they will come apart. Place your thumbs on the blue legs while holding the black body and push on on the blue faceplate to seperate them.
3. After the casing has been removed, remove the screws holding the circuit board to the plastic bottom so that the router PCB is free.

Soldering to the JP2 Header

Locate the JP2 header. The header pinout is as follows:

Pin 1: 3.3V

Pin 2: 3.3V

Pin 3: Tx (ttyS1)

Pin 4: Tx (ttyS0)

Pin 5: Rx (ttyS1)

Pin 6: Rx (ttyS0)

Pin 7: NC

Pin 8: NC

Pin 9: GND

Pin 10: GND

Electrical Modifications

The router uses 3.3V/GND for it's serial line voltage levels. We need to use a line level convertor that converts the 3.3V/GND to the +/-12V standard for RS232 serial communication. Technically, the right chip to use for this project is a MAX3232, however I've used both the MAX232 and MAX233 chips and they work fine as well. You could use any one of these 3 chips. Currently (January 2010), on Digikey.com, a MAX3232 is $4.19 USD in a DIP package, a MAX232 is $3.31 USD, and a MAX233 is $7.45. The MAX233 is nice because no external capacitors are required (1 decoupling cap is recommended). There are a few variations of these chips, so check the datasheet for your specific part to confirm pin numbers and capacitor values.

Maxim has a great samples program. I've been able to get free samples from them for all of these parts. Just remember, use their parts when your widgets go in to production. =)

OR

Using the schematic diagrams above as a reference, solder the wires to router PCB and wire up the circuit on a breadboard first (very important!). I recommend using wires about 20 cm (~8") in length from the router to your circuit and wires of length 10cm (~4") from the serial connectors to your circuit so you later you'll be able to open and close the router easily without stretching the wires.

At this point you'll want to skip ahead to the software section, install X-WRT and test out your serial ports. It's fine to power the router while it is out of the case, but make sure there are no metal bits lying on your work surface that could short out the board. After confirming that both serial ports are functioning correctly, clean up your wiring and solder your circuit to a prototyping board. I find that twisting related pairs of wires cleans things up considerably. Zip-ties are another option.

Mechanical Modiciations

If you don't have the correct tools to cut nice holes out of plastic, I've found that using the side of a drill bit (in a drill) works well as a make-shift cutting tool for cutting these holes. The DB9 connectors will (just) fit through the hole, so you can solder the wires before installing the connectors. For attaching the connectors to the router case I grabbed some screw connectors from an old video card, a lock washer, and a #4-40 nut. Using the video card screw connectors allows you to properly screw in serial cables to your DB9 connectors.

To secure the circuit, I bolted it to the top of the router. There's plenty of room for both the router PCB and the new serial circuit. After the connectors are installed, it's a good idea to label the connectors TTS/1 and Console (or TTS/0).

Software

The process described here will test both serial ports using X-WRT, a Linux distribution for the WRT54GL that has a nice web interface. Follow the instructions for installing the openwrt-wrt54g-squashfs.bin image on to your WRT54GL. The exact firmware image is used is here. These serial ports should work fine in other distrbutions as well, but X-WRT is the only one I'm going to cover here.

After installing the firmware image, access the web interface (by default: http://192.168.1.1/). The first screen will ask you to set a new password. Set this password and remember it!

To test TTYS/0 (console):
1. Connect a serial cable from the console DB9 connector to your PC.
2. Open a hypterminal connection using the settings shown (or use whatever terminal software you'd like).
(115200, 8N1)
3. Reboot the router.
4. You should see a bunch of kernel messages. Hit enter at the terminal and you should see a screen that looks like the one below.

(click for larger image)

To test TTS/1:
1. Connect a null modem cable between the TTS/1 DB9 connector and your PC.
2. Open a hypterminal connection using the settings shown (or use whatever terminal software you'd like).
(9600, 8N1)
3. SSH in to the router (username 'root' and the password you set earlier) (Putty is a good SSH client for Windows).
4. Enter the command:
#
echo "Hello World!" > /dev/tts/1
5. Confirm that you see 'Hello World!'
on your serial console (in hyperterminal) as shown below.

(click for larger image)

SD Card Mod

It's only a matter of soldering a few more wires to add an SD card to your router. For this mod, my preferred method of attaching the SD card is to buy a micro sd card with an adapter kit and solder wires to the sd card adapter. I've considered other ways of interfacing the sd card, but I've found that this is the cheapest and easiest. Also, the micro sd card is removable, so you can use it in other devices as well. I've read that cards up to 2GB can be used. I haven't tried to use anything larger. This sd card mod will work for other distributions as well (like DD-WRT), but X-WRT is the only distrubtion I'm going to cover here.

This is a completely seperate mod from the dual serial port mod, so can be done without first adding serial ports. However, to test the sd card, X-WRT will need to be installed as described in the dual serial port mod software section.

Start by tinning (adding a small ammount of solder to) the contacts on the sd card. For the wires, I used about 20cm (~8") from an old IDE cable. Tin the stranded wires on both ends. Solder the wires to the sd card adapter. Since both surfaces are tinned, this should be relatively easy. Don't use an excessive ammount of heat or the sd card adapter may be damaged.

We will be using pins 1 -7. Solder the wires from the sd card on to the router pcb as described and pictured below.

SD Card

WRT54GL Connection

Pin 1

Right leg of LEDC7 (see picture below) (GPIO7)

Pin 2

Right side of LEDC11 (see picture below) (GPIO2)

Pin 3

JP1 Pin 4 (see picture below) (GND)

Pin 4

JP2 Pin 2 (not pictured) (3.3V)

Pin 5

Right side of LEDC10 (see picture below) (GPIO3)

Pin 6

JP1 Pin 6 (see picture below) (GND)

Pin 7

Right leg of SW3 (see picture below) (GPIO4)

After the electrical connections are made, skip ahead to the software section and test the SD card installation. If the SD card responds as expected, it can now be mechanically mounted permanently.

Mechanical Modifications

You can mount the sd card wherever you'd like, but I prefer above the Linksys name on the front of the router. Take note that where you choose to mount the sd card does not interfere with the router PCB when the router is put back together.

I used a dremel to cut the slot for the sd card and I used a drill bit as a cutting tool to clean up the edges of the slot. After making sure the sd card fit through, I glued it in place using hot glue.

Software

The process described here will test the sd card and automatically mount it in X-WRT. Depending on how your network is configured, you may need to modify network settings (using the web gui) to allow the router to connect to the internet. If from the router, you can 'ping www.google.com' and get a response, then you're good to go.

Note: you'll have to SSH (using putty or other SSH client software) in to the router. In the following instructions, the # sign indicates a command that you'll need to type at the terminal. Make sure the micro SD card is first inserted in to the sd card adapter.

If you don't see similar output to what is shown above, or see FATAL error messages, then the SD card cannot be read which indicates a wiring problem.

The next few steps involve editting text files. If you don't know how to use vi to edit text files, google it, or check out this tutorial. There's a bit of a learning curve if you've never used it before.