March 02, 2006

The WRT54G - PG-31 Hook up

So we've got our wireless router with ripped off cover and warranty voided in one hand. In the other hand we've got our PG-31 GPS module. How do we make them sing and dance and make lovely music together? It's shockingly easy actually...

To access the serial ports on the WRT54G you need to solder a 10-pin male header onto your router. Sound scary? It's really quite easy and hard to screw up. Pop it in, apply some heat, gob some solder in the general vicinity and it should work. Check out Rod Whitby's page for more information on the serial ports on the router. Step #3 and on deal with adding the translator that allows the router to speak to RS-232 computers/devices (remember that -12/+12 voltage thing?) Since our GPS speaks the same 3 volt dialect as the router, we don't need all that complication right now.

So what are these pins for? What do they do? This was on the link I just gave you, but here it is repeated:

Pins #1 & 2: 3.3V power source
Pins #9 & 10: Ground
Pins #7 & 8 aren't connected to anything

The remaining pins are the fun ones! Remember, there are two serial ports, and we need one wire for each direction.

Pins #4 & 6 are for the first serial port, known as ttyS0 in linux land.
Pins #3 & 5 are for the second serial port, known as ttyS1

Pins #3 & 4 are the Tx (transmit) pins. These are the pins the router sends data out on.
Pins #5 & 6 are the Rx (receive) pins. The router listens for data on these pins.

Since the OpenWRT firmware puts a console on the first serial port, we're gonna use the 2nd one since it's completely unused.

So let's use pins 1, 3, 5 and 9. +3V, Tx, Rx, GND. Only four wires... this shouldn't be so hard! Since the PG-31 is suited to this project so well we can hook everything directly up, with no other components or tricks in between. It's just a matter of what pins on the GPS module we hook up to.

We look at the datasheet to find out the details. (That datasheet is for the TF30, but we know it's very similiar to the PG-31 and has the same pin-out. ) Let's see, there's 20 pins! Well, we're just going to use a couple, we can leave the other ones unconnected. You might notice that the GPS module also has two serial ports, but we only need to use one, "A." The other one is for feeding the GPS data to help it increase the accuracy. Overkill, we're not trying to fly an airliner here!

The following pins are interesting to us:


  • Pin #1: VCC - this is where we supply 3.3V to power the GPS module. I think we'll staple this one to pin #1 on the router; quite logical
  • Pins #11 & #20 are both listed as GROUND. We'll hook them both up to pin #9 on the Linksys. You always want to hook up all the ground pins of electronic components to make sure things work like they should.
  • Pin #2: TXa - the pin where all the data we want comes out! So go ahead and hook that up to pin #3 on the router. Right.?!? Hang on! That's where the router is gonna send data as well; a recipe for a head-on collision! We want the Tx of the GPS to connect to the Rx pin of the router.
  • Pin #3: RXa - We can skip this one actually. The GPS will continue to spit out data as soon as it's powered up. There's no need to send data to the GPS typically. It'll work fine without the Tx from the router going to the Rx of the GPS. So hooking up this pin is optional, but let's tie it to pin #3 on the router.

That wasn't so hard! Well, actually hooking these things up with wires is gonna be a bit tough. You can do it by soldering wires directly to the bits, but it's tough! But that's why we're gonna design a sleek circuit board to do it nicely.

It's almost time to start designing our circuit board! We know all the parts we're going to use and we know how they need to be connected to each other.

We'll get started on that next time.

Posted by Boone at March 2, 2006 01:34 AM