I added a serial port to my wireless router so it could monitor the weather. I know, I know... why does a router care what the weather is like? Well, it doesn't, but I do. Actually, I want to add a weather widget to this blog and upload it to weather underground". Correction! I've finished the weather station, and I'm not using the netgear router or weather underground. See this post for details. I haven't finished any of that yet, but it came in handy later when I bricked it! When they designed this AP, Netgear was nice enough to make it easy to open.All that you need to do is pull back the rubber feet and use a T-9 screwdriver. The little feet even stay captive during the process, mighty convenient.
The bottom plate comes right off, revealing the mainboard, which lifts out.
Unfortunately, I don't have a device without headers installed, but you can see them installed in the lower left corner. The single-row one is the serial port, the double-row is the JTAG. From the factory mine had solder blobs on the serial port. I had to use solder wick to remove it. Once the holes are cleaned out, installing the header is a snap.
Now that it's easy to attach to the port, we need to convert the 3.3v CMOS serial signal to true RS232. The typical way you do this is to use a RS232 transceiver. I had a SIPEX transceiver lying around, so I used that. Just follow the datasheet for whatever you use. The pinout for the serial port on the netgear is:
I've attached the approximate schematic that I used. There are a couple of important things to note, because the router uses 3.3v, and the RS232 transceiver uses 5v, we need to negotiate the difference. Referencing the transceiver's datasheet, the minimum voltage necessary for a '1′ is low enough that a 3.3v CMOS signal is sufficient, so we can just hook it up. The signal going toward the router, however should not exceed its VCC. To achieve this using a minimum of parts we use a pull-up resistor fed from the device's VCC and a diode biased toward the transceiver. This way, when the transceiver is outputting a '1′ the 5v is blocked, but while outputting a '0′ it will drop the voltage sufficiently enough for the router to see it as a logical low.
If you want the router to be the subordinate of the serial connection (like a modem) then reverse the TXD/RXD pins on the DB9 connector (pins 2&3). I specifically wanted the router to be the ordinate, to hook it up to other stuff.
To get the 5V necessary for the transceiver I tapped the 12V power from the wall adapter and fed it through a 7805.
In the above photo I'm using a NULL Modem cable because, remember, the router serial port was installed as if it's a computer.
It works! The photo above is the preboot console of the router. Notice that the MAC address is
FF:FF:FF:FF:FF:FF. I'm not just paranoid, this is one of the failure modes of these routers. The DD-WRT firmware overwrites some of the NVRAM in a weird way and this happens. It's pretty screwed, but at least with a serial port you can fix it :)