March 03, 2006

Introducing CadSoft Eagle Layout Editor

There are many software packages out there that you can use to design circuit boards. They include Albium Designer (formerly Protel), OrCAD, FreePCB and CadSoft's Eagle Layout Editor...

We'll use the freeware version of Eagle Light Edition. downloadable from their website for Windows, Mac OS X or Linux. There's a couple limitations on this freeware version, such as the size of board you can create, but you can cram a lot in that 100 x 80 mm!

This program seems very intimidating at first, mostly because it acts nothing like you expect a windows program to. Things you think should work don't work as you think they should!

When designing a PCB, we don't just start with a blank sheet of copper and start drawing the parts and wires we need. First we're going to draw out the circuit using Eagle's Schematic Editor. On this virtual sheet we'll place all the parts we're using and draw lines between the pins as needed. This is where we'll be recording what we figured out last time. By laying the circuit out here, we'll be able to arrange everything in a logical fashion, making it easy to think about how the circuit is working and make sure we have everything hooked up the way we want it.

Once we're done doing that and are sure we have everything perfect, we can jump to the next step, creating the layout of the circuit board. Just because we laid out the design a certain way on the schematic doesn't mean we have to use the same type of layout on the PCB! We want to layout our circuit board in an organized and tidy way. We want to use the shortest wires possible and avoid wires having to cross. Certain parts such as connectors, plugs or buttons might have to be in a particular physical location. The great thing about using a software package such as Eagle is that the computer can keep track of all the details and makse sure that the circuit board matches our schematic.

Download and install Eagle so that you can join us next time as we jump into the Schematic Editor. We'll learn a bit of how to work with Eagle and get our design on paper, arguably the most important step in this whole process.

Posted by Boone at 12:24 AM | Comments (2)

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 01:34 AM

March 01, 2006

The Laipac PG-31 GPS Module

So we're going to stick GPS on a Linksys wireless router. I guess we need the actual GPS chunk from someone somewhere. Many of the hand held GPS units you might be familiar with have a serial output, perhaps we could use that? Well we could, but there's some things to think about first...

The serial port on the router is not like the serial port on the back of your computer. Usually serial ports have 9 pins: ground, transmit, receive and a bunch of other hand-shaking pins. Computers talk binary, so they only know 2 digits, a high and a low. RS-232 voltage levels on your computer and computer peripherals go from -20 to +20 volts. The serial port on the router only knows 0 to 3.3 volts. So if you want to connect your router to your computer via serial, you'll need to do translating. Also, most GPS units designed to plug into your computer will be talking those same voltage levels. We can do this translating easy enough, there are some IC's that can do that for us. We'll do this one day, but for now, we'll try avoid that extra complexity for our project.

The cool thing about the serial ports on the router is that one of the pins supplies power at 3.3 volts. So if we can find a GPS module that runs off of 3.3 volts we can power it directly. Searching Google is the logical next step. Spark Fun Electronics has, among lots of other cool stuff, a couple different GPS modules. I'm going to go with the PG-31 from Laipac, a Canadian company. It's small and with the exception of the GPS antenna (sold seperately) I'm thinking we can fit it inside the router's case!

The PG-31 meets all our requirements:

  • Runs off of 3.3
  • Serial port communicates at voltages compatible with the router
  • Uses little power; I'm not sure how much the router can provide before crapping out, but you probably don't wanna run your TV off it!
  • It's pretty tiny!

The PG-31 needs a special tiny surface-mount connector to mate to. You solder this header to the circuit board and the module plugs right in!

Mmmmm, circuit board, right. We'll get there yet! Well we know what we want to do and what we want to do it with. Now we need to figure out how we'll do it - how it's gotta be hooked up.

Stay tuned!

Posted by Boone at 11:06 PM

Making a Linksys Router "Location Aware"

The best way to learn something is to do it. To do something you need a goal in mind. So what's something very simple yet very cool that we can try make? I have an idea... it involves a Linksys WRT-54G Wireless Router, OpenWRT custom firmware, and, let's see, how about GPS....

The WRT-54GL is one of several wireless routers on the market that runs Linux. Since Linux is licensed under the GPL, Linksys was obligated to release much of the source code in order to legally sell their routers. This opened the door for hackers (fine by Linksys, they're selling more routers!) to customize these great little machines. With a 200MHz CPU, 16 MB of RAM, 4 MB of flash, wireless and effectively 5 ethernet network interfaces, the possibilities are endless.

Included on the WRT54G are two serial ports. They're not normally used and don't usually have a way to connect to them, but they're there and waiting to be used! There's a million things that use serial connections, so that opens a bunch of possibilities! Let's pick one and run with it. Actually, since you're not typing, just I get to pick, so we're going to make our wireless router GPS enabled, or Location Aware. That way, we're not just nerds, but also hip and cutting edge.

Why do we want to do this? How about wardriving? We've got a computer that's "wirelessly enabled" and with the addition of GPS it could log the location of all the networks it finds! No need to drag your clunky old laptop along, just a sleek little wireless router is all you need! They run on 12V, so we should be able to run it off a cigarette lighter! Because of all the electrical motors, solenoids, alternator, etc, in a vehicle, the power at a cigarette lighter is very dirty and contains lots of nasty voltage spikes that could kill our unsuspecting router. But that's no problem, we'll learn how to make a simple circuit board that can solve that for us!

Or, for those not inclined to activities containing war in their name, how about time? One of the by-products of GPS is knowing exactly what time it is - down to the millionth of a second or so anyways. We could run a time server on the router that all the computers in the house or office can sync their clock to! Actually, I just found one you can buy for $380 USD. Our costs will be less than that and we'll be way cooler at the same time!

Posted by Boone at 10:21 PM

Playing Electrical Engineer for a day

Ever wanted to pretend you're an engineer? Thought what it must be like to design cool stuff and have it manafactured for you?

No?

Oh...

Well, too bad, I'm not stopping!

Everybody's seen those cool green circuit boards (PCB's) that are found in pretty much anything nowadays. Pop the cover off your computer case (if your computer even *has* a cover) and you'll be greated with a stack of them. Sometimes they'll be other colors, such as red or blue, but they'll all be peppered with a multitude of tiny bits and pieces and a couple of bigger chunks.

Very cool, but just another one of those marvelous things that highly trained engineers design and build - with there millions of dollars and labs bristling with the latest technology. "I wonder how they're made, must cost a fortune! They make millions of 'em though, that's how they get their money back."

But we live in the age of the internet, all the knowledge you could possibly want comes in over a couple wires that end in the glowing portal in front of you. It's actually quite possible to design and create these kinds of circuit boards yourself! In the following posts I hope to walk you through designing and bringing to life a simple circuit board. I'll let Google fill in the gaps, but I'm hoping to cover all the basics and give you enough information to "do-it-yourself." Comments welcome!

Posted by Boone at 09:38 PM