In this post, we’ll cover step-by-step how to add a SD cardslot to your Linksys WRT54G running DD-WRT and how to configure it in the DD-WRT UI. Granted, this has been done a lot already, however there is a significant lack of information on how to do it on the older V2’s. Read more for the complete step-by-step guide.
One of the advantages to using alternative firmware on “stock” devices is that it allows you to unlock the full potential of your hardware. Using the latest version of DD-WRT, you can now enable esternal storage on your WRT54G to add to the default image. With additional storage for your router, the possibilities are endless.
PLEASE NOTE: The pictures and information for adding the SD cardslot is only applicable to the Version 2 of the Linksys router. Attempting to do this on newer routers using this guide may result in damage to the router, the SD card or both. You can not hold me liable for any damage, so please read first and do some research before you crack the case open. The 15 minutes you may spend now may save you some blue smoke later.
- SD card slot – I stole one out of a 4 in one card reader from a failed hacking attempt from another project.
- SD card – Use a cheap one to verify it’s working first, then use whatever size you want.
- A piece of PCB – I used a piece of board that I had left over from another project, but this one from Radio Shack works well too.
- Jumper Wire – If you have multiple colors, this would be beneficial in keeping the lines straight for wiring.
- Small nuts and bolts
- Fine Tip soldering iron
- Dremel cutting tool
- (Optional) Razor Knife or X-acto Knife set
First thing’s first. This howto only covers the process of adding the card slot to the router and configuring DD-WRT. It does not cover installing DD-WRT on the router or which router is best for the process. The process of installing DD-WRT is very very well documented as well as the router’s specs for supported devices over at the DD-WRT Wiki.
Getting to know the SD card
The SD card pinout shown above indicates that although the card has 9 pins, we will only be using 7 of them. Unlike most devices, the indented pin is not pin 1, but is pin 9, with pin 1 next to it. Here’s a quick reference showing what each pin is and what it does:
- Pin 1 – Chip Select – When this is brought high, the SD card is “turned on” and allows it to receive data or send data in sync with the CLK pin (pin 5)
- Pin 2 – Data In – This pin is used to receive data from the WRT54G for writing or for commands
- Pin 3 – Vss (GND) – This is a ground pin and is tied to Pin 6 for one less wire to deal with. It is important that both pins be brought together.
- Pin 4 – VCC (or +5VDC) – This pin supplies power to the SD card.
- Pin 5 – CLK – This is the clock line that the WRT sends to the SD card. This pin synchronizes the data coming in or going out of the WRT54G so that the SD card has the proper timing to read and write data.
- Pin 6 – Vss (GND) – This pin is also ground.
- Pin 7 – DO – This pin is data out to the WRT54G
- Pin 8 – Not Connected for this project.
- Pin 9 – Also not connected for this project.
We will be using some connections in the WRT54G called GPIOs to connect the various pins of the SD card to the WRT54G’s hardware. These GPIO pins are already used for other functions, but with the driver built into DD-WRT, we can use them to also control the SD card.
Step 1: Prepare the SD Card slot:
In this picture, I felt it necessary to scrape off the PCB solder pads under the SD card itself. This is where the X-acto knife kit comes in handy. The two solder “dots” in between the screw holes is for anchoring the tabs of the SD card slot and is recommended for making the card slot resistant to damage from repeated inserts and extracts.
Wire the rest of the wires to their respective pins on the SD card slot. When all is said and done, you should have 6 wires. At this point, we’re done with the card slot and we’re ready to start soldering to the WRT54G.
Step 2: Making connections
If you haven’t done so already, go ahead and take the WRT54G apart.
- Start by unplugging the WRT54G’s power and network cables.
- Unscrew both of the antennas and set aside
- Grab the grey part of the WRT54G in one hand and the blue part in your other hand.
- Pull the two halves apart and set the blue part aside.
- Slide the top cover away from the bottom half of the WRT54G.
Now for the hard part. There are six locations that need to be wired up in order for this to work properly. We’ll start off with the easy one. Pin 1 (CS) goes to the + side of the DMZ LED. In this orientation, the component side of the PCB faces away from you, essentially you’re looking up from the bottom.
In this picture, we will be using the In Circuit Programmer port for pin 4 and pins 3,6. The Pin 4 (+5V) goes to the pin 1 on the ICP port, while the pins 3,6 (GND) goes to pin 10 of the ICP port. Orient the router so that the two antennas point up and away from you and that the component side faces you. The ICP port is an unpopulated 10 pin header located in the lower right hand quadrant of the router’s circuit board.
The next three leads are the most important AND the most difficult. You can click on the image to get a larger view if you need it.
With the same orientation discussed as before, just south of the ADMtek chip is where the last three pins go. This is the hardest part of the build as you must attach to a resistor network that itself is very tiny. It took me several attempts and I had to superglue the wires down so that they wouldn’t move (not shown in this shot).
Here is an EXTREME close up of the resistor network (still same orientation). This is a 4 resistor chip, with 2 rows of 4 pins each. Pin 1 is the upper left hand corner and is wired to DI (pin 2) of the SD card. Pin 6 (second from the left on the lower side of the resistor network) goes to the CLK (pin 5) of the SD card, while pin 7 of the resistor network is wired to DO (pin 7) of the SD card.
Step 3: Box it up!
Now that you’ve gotten the card set up, it’s time to put it together. Now, there are many a howto that have a million and one locations to mount the card slot. I wanted something that didn’t look kludged together or didn’t have the cardslot sticking out of some random location. I instead chose the back of the WRT, just above the ethernet ports.
I made my cut just above the Ethernet ports and secured the PCB to the top cover. The bolts holding the PCB in place were just short enough to clear the RJ45 connection block so no additional work was necessary.
One more shot of the completed mod, the only thing I would like to have done is found countersunk bolts. Unfortunately, I was limited to what I had on hand at the time. All in all, it’s a very clean modification.
Step 4: Configure DD-WRT
Now all that’s left to do is to configure DD-WRT. Before we begin, make sure that you have cleared out the SD card of any data you want prior to working with it. Once we get the card working, the router will format the card with an EXT3 filesystem, erasing anything already on the card.
Go ahead and hook up the router to power and network. Don’t stick the SD card in just yet, first we have to configure DD-WRT for the card. Click on “Managment” and scroll down to the “MMC/SD card support”. Enable it if it’s not already enabled and set the GPIO pins detect to “Manual”.
- DI (Data In) – GPIO 5
- DO (Data Out) – GPIO 3
- CLK (Clock) – GPIO 4
- CS (Chip Select) – GPIO 7
Scroll down, and hit “Save Settings”. The screen will fade out then fade back in. Once the screen fades back in, disconnect the power from the WRT and insert your SD card. Power on the router and you should notice that the DMZ LED starts flashing intermittently. This is good news.
Log back into the DD-WRT admin panel and hopefully, if everything is correct, you will see values filled in for Total/Free Size. If you do, then congratulations. you’re done! You can login via Telnet to the router and see that it’s mounted and ready to roll.
From here, you can now compile things on a Linux box, save them to your SD card and then use your SD card to launch your programs on the WRT itself. Just remember to mount and umount the card and you won’t have to worry about corrupting the filesystem on the card.
Thanks goes out to the DD-WRT user community for making this possible and thanks goes to the original person that hacked out GPIO SD-card support into the kernel running on DD-WRT.