Archive

Posts Tagged ‘board layout’

ZephyrEye Rev2: Board Layout in Eagle

5 March 2010 3 comments

An update on Rev2 status:  The schematic is looking pretty good, albeit there are probably still some errors that will seep up to the surface.  I’ve started on the board layout, which will also help uncover any schematic errors.  Today I’d like to go through the process I usually use to layout circuit boards in EagleCAD.

In case anyone was wondering if I was kidding about the cat and laser pointer thing, here’s a great chance to find out.  Download the schematic by itself, open it in EagleCAD, and click the “Board” button (5th from the left on the toolbar), and try laying out the board.  Make sure and give yourself some time (a day or two without sleep should do it), and dig in!

So here are the steps I use when laying out a board.  After the schematic has been reviewed several times (preferably by someone capable and also familiar with the project, not just by yourself), click the “Board” button (location described above).  What Eagle does here is it takes all of your components and puts them next to a random outline.

From here, let’s just go down the list.  Note that this is just what I do for boards like this.  It gets the job done very quick, with decent quality, but others do things different and may agree or disagree with this approach – I’d love to hear what others do in the comments!

  1. Draw a circuit board outline
  2. Group components into proper areas
  3. Manually route critical traces
  4. Autoroute remaining traces
  5. Manually fix autorouter mistakes (sometimes, the autorouter makes no sense!)
  6. Run Design Rule Checks against the board
  7. Redo steps 3 through 6 if necessary
  8. Send design to the boardhouse

1) Draw a circuit board outline.

If you don’t care what size your circuit board is, this is a very easy step.  Take the default, and shrink or expand it as you get closer to finishing step two.  Chances are, however, you should make careful considerations about your intended enclosure(s) for the circuit board.  Don’t skip this step lightly, or you’ll pay for it exponentially down the road.  Case in point: ZephyrEye Rev1, from the side as shown below.  Originally I thought I would use a different case, but it was too bulky and looked horrible.  But it didn’t exactly fit in my backup case, either:  I had to cut out the side just to get it to fit.

This is what happens when you don't think carefully about enclosures ahead of time ...The result: Ugliness.

I’ve downloaded the manufacturer’s datasheet for the enclosure, and following it’s recommendation outlined the board to maximize the PCB surface area – I’m going to need it all to get it all the features packed into this tiny little enclosure.  Either modify the existing outline, or draw using wires on the “Dimension” layer 20.  The board house will router your PCB following this outline.

Another item I always forget (and actually just remembered while writing this), is mounting holes.  Some people use vias connected to ground, while others use drill holes.  I usually prefer vias, because you can set the diameter of the copper around the via and avoid routing other traces within range of the head of the screw.  It also lets you ground your circuit board to the enclosure, which is common with metal enclosures.

2) Group components into proper areas.

For most components this is pretty straightforward.  Put all the schematic elements in the same area: an IC, supporting passives, and related supporting circuitry.  But you’ll also need to take into account any special needs of that part of the circuit:

  • Sensitivity to noise
    • The digital compass would potentially have issues if placed near the transmitter, or near any high current wires due to the magnetic field around a current-carrying wire.
  • Proximity to the edge
    • The GPS circuit needs to be near the edge because it has an antenna.  You can’t trace antenna wires very far without serious signal degradation, so it gets a special spot.
    • Most components that need to be near the edge are there because they need to match up with enclosure features – measure these things out carefully when necessary.
  • Proximity to other chips it needs to communicate with
    • If you can, put inter-communicating chips near each other.  There’s considerable flexibility on this point, depending on the protocol, the speeds they communicate at, and sensitive areas that these signals must avoid.
    • Example: If you were routing wires carrying USB 2.0 at 480MHz, it would be bad news for both other chips on the board as well as your USB signal integrity if these were long.  In fact, at this high of speed, there are very specific routing guidelines that must be followed.
  • Speeds of signals that will travel on the signal wire
    • Crystal wires should always be very short.  Once you get a signal that will be up in the megahertz range, the shorter it can be the less noise you’ll get at other locations on the board.  The trace carrying the signal can act as an antenna if it is too long.
  • Analog signals need special consideration.
    • Usually, you’ll want to avoid routing communication wires (RS232, SPI, or I2C) near analog wires.  These communication wires will put noise into your analog signals, causing headaches and very weird errors when debugging the board.
    • Antenna signals are analog of the most sensitive kind, and usually need to be a specific width if they travel very far.  You may also need to “impedance match” the trace to avoid distorting the signal.

That’s not an exhaustive list, and not detailed by any stretch of the imagination.  Google for more details on any above item you fear a board you’re laying out may have issues with.  Datasheets will have very specific layout requirements as well, many have a PCB layout guide for the chip.  Lastly, check for reference designs.  These are great to follow because you know they have been proven.

Prior to routing, all the components should be grouped into logical areas.

You’ll notice the schematic is already outlined in this way.  For example, the digital compass (HMC5843) should be placed somewhere within the outline that will be away from high-current lines (e.g., lines which may induce magnetism and noise).  I picked a corner away from everything else for this guy.  It was pretty easy to look at the schematic and see that I needed to pull in C31, C34, C40, R11, and R19.  Quickly looking at the air wires, I put them in an order that seemed like would work once the traces were routed.  Then I did more or less the same for the remaining component “groups”.

Notice the surface mount components are on top as much as possible – this makes it easier to assemble, particularly for pick & place machines and/or if you are going to bake it in a reflow oven.

3) Connect Vcc, GND, and critical traces

Vcc and ground traces go first.  Usually, I go for a ground plane on top.  Some people do Vcc planes on the bottom – I’m not a big fan of this, but I have done it.  Make sure the traces are wide enough to carry the current they need to (this calculator may come in handy) – in general, they are but it’s better to make wires that carry a lot of current be thicker anyway, no sense having a bunch of fuses around the board.  I estimated my max current delivered to this board to be less than 250 mA, but I still use .024″ traces for VBAT, and 0.16 for a few of the VCC traces.

For a few of the components, you’ll also want to trace things out before you let the autorouter have its way.  You can also quarantine areas as off-limits to the autorouter for sensitive areas.  For example, the GPS circuit is pretty sensitive, especially with regards to the RF ground plane and the antenna trace.  I routed this area up ahead of time.  To make sure  areas like this aren’t touched, you can then place polygons on the top and bottom restrict, keepout, and vRestrict (for vias) layers to manage the autorouter.

4) Autoroute remaining traces

This step has a few tricky items that can make the difference between a successful autoroute and a complete failure autoroute.  Pay close attention to the setup!  Here are the steps I used:

  • Save before you start! You will NOT be allowed to use “Undo” commands after you start the autorouter.  I usually save a separate copy before I start just to be safe.
  • Make sure your design rules are set up correctly as the autorouter follows these rules while routing traces.  Use the toolbar or click “Edit -> Design Rules…” to open the DRC dialog.  Set up the rules to follow your intended board house’s manufacturing guidelines and minimum tolerances (check their website).  Here are the ones I modified from the default:
    • Clearance Tab:
      • I set all clearances to 8 mils.
    • Distances Tab:
      • Copper/Dimension: This is the minimum distance between any copper (whether a trace, polygon, or component) and the board outline on the dimension layer 20.  I set it to 10 mils.  If you route traces too close to the edge of the board, they may get cut or damaged.
      • Drill/Hole: Distance from anything to a hole on the board.  Set to 8 mils.
    • Sizes:
      • Minimum Width:  This is the minimum width of a trace, and the autorouter will use this for everything.  10 mils is a good minimum if you have plenty of space – I used 8 mils.
      • Minimum Drill: This is the smallest drill size available from your board house.  20 mils for me.
    • The rest of the defaults generally work fine for me, but make sure you’ve met all your board house requirements before continuing.
    • Click “Apply” and then either “Check” or “Cancel”.  It’s a good idea to check your work so far to make sure you pass off a clean board to the autorouter.
  • Now click on the “Tools -> Auto…” (or use the toolbar) to open the Autorouter Setup dialog box.  Make the following changes according to your design needs:
    • Routing Grid: Here’s the deal.  The larger the grid size, the less time it takes.  But the autorouter will only consider trace joints and intersections every 50 mils.  So for surface mount components pins at, say, .5mm pitch (pin centers are .5mm apart), the autorouter will fail to connect most pins.  It will also have issues in congested routing areas.  On the other hand, using a 1 mil grid will take forever.  I used 2 mil routing grid – It took about 30 minutes.
    • Change Top and Bottom preferred routing directions if desired.  I haven’t found this to make a big difference in actual implementation, just make sure you don’t pick two parallel directions unless you want issues.
    • To be honest, I’ve never bothered playing around with rest of the settings, or the optimization settings.  I’m sure there are some advantages that can be made here, but I’ve never dove in.  Feel free to comment if you know how to change these to some advantage!

The Rev2 Main Board after being autorouted and cleaned up. Notice a few parts have moved a little to allow better routing, but not many.

Once everything is set up, save again and then hit the “OK” button.  Alternately, if you only want the autorouter to work on a particular subset of traces, use the select button and then hit the green stoplight button on the toolbar to go.  Be forewarned that the autorouter will ripup and retrace ONLY its own traces, and traces there prior to beginning the autoroute will remain untouched.  This can be a problem, especially if you have cut off certain sections of the board with traces on both the top and bottom, or have routed so close to surface mount pins the autorouter cannot place  a via to get around it.

In situations like this, and sometimes just due to trace density, sometimes the autorouter just can’t find a path for all the traces.  These will be left as airwires for you to manually route…

5) Manually fix autorouter mistakes

The Autorouter makes as much sense sometimes...

Sometimes, the autorouter just doesn’t make any sense.  I couldn’t help but post this picture – it’s a classic.

But seriously, sometimes the autorouter just does ridiculous things.  Traces have random and startling paths, take weird angles, overshoot and then overcorrect, etc.  Check through the history of the Rev2 cad files for examples.  You’ll want to shorten most of these traces if you can, take out the weird angles, and fix any traces that went through places they shouldn’t have.

And the autorouter generally uses a LOT of vias.  Vias can actually cost you extra if you use too many from some board houses, because they take extra time to drill and plate in the manufacturing process.  So minimizing vias is important.  You can usually clean a few off manually with a little effort.

It took about 30 minutes to finish the autoroute, because my routing grid was so small.  Before the first optimization step, it had around 320 vias.  Youch!  By the end, however, it was down to around 170.  Go optimizer!

It also left about 7 traces for me to finish by hand.  Most of them were because the ground plane polygon had “fallen apart”, meaning there were so many traces that parts of the ground plane had become separated and were not longer interconnected.  Many were fixed by pushing and pulling vias and traces around.  On a few, though, I had to place vias and bottom side traces that jump under traces that cut up the ground plane to make the connection.

6) Run Design Rule Checks against the board

This step is CRITICAL!  Don’t even consider sending the board off without checking your board against the design rules.  Since you’ve already got the DRC rules setup, just hit the “Design Rule Check” button on the toolbar to run it.  It’s pretty straightforward: Anywhere you have traces that are too close or overlap, parts off the boundary, or drill holes that go through traces or components, you’ll get an error that you’ll have to fix by hand.

This isn’t too bad usually, but in densely routed areas can sometimes be a little tricky.  Just use your elbows, push things out, and make some room.

7) Redo steps 3 through 6 if necessary

Well, as hard as all this has been, you may find something that needs changing.  Say you forgot a critical component, or left off a significant number of traces.  Sometimes you can add these things in after the fact, sometimes this is as practical as putting Jabba the Hutt on Jenny Craig.

If you have to, don’t resist starting over.  The command to get this to happen quickly can be typed into the command bar: “ripup ! ;”.  This will ripup everything, so if there were certain traces you wanted to keep the alternative is selecting the traces to leave alone one signal at a time by leaving off the semicolon, then hitting the green stoplight to execute the command.

If you’re happy with the board, then congratulations!  The next step is to get someone to review your board layout.  A fresh set of eyes makes all the difference.  But don’t be disappointed if, even after several reviews, it comes back with a few hardware bugs.  Have Xacto knife and patch wire ready ;)

8) Send board to boardhouse.

There are a lot of boardhouses, each with different pros and cons.  Here’s a list of other houses I’ve heard good things about:

  • Personally, I use PCBExpress because of proximity – They do small, low-feature two layer boards for pretty cheap, and they ship ground for free.  Since they are also located in Oregon, I get them in two days.  They also accept Eagle files directly – no need to generate Gerbers.
  • I’ve heard good things about Advanced Circuits.
  • BatchPCB is related to SparkFun.  This one is pretty cheap @ $2.50/sq in (plus setup fee), but takes a while to get your boards back.  Time flexibility = lower cost boards.

All of the above have Internet order options.  Just upload your file, answer a few questions (usually about layers), pay for it, and you’re done.  Usually, this is when I put together my final bill of materials and get the parts ordered so they arrive about the same time as the board.

Well, that just about covers it.  I’m sure I forgot something, so as usual feel free to remind me or ask questions in the comments.

ZephyrEye Rev2: Call for Schematic Reviewers

24 February 2010 3 comments

There are a few inevitable truths in this world.  Taxes will rise, Wookies shed all over the furniture, Luke and Leia are related, and there is no such thing as a perfect first draft schematic.

The Rev2 circuit is nearly complete.  It looks AMAZING if I do say so myself.  That’s the problem, though:  I’m inundated with excitement and therefore am unable to find things that are wrong because I don’t want to find any reason that might delay getting the circuit boards back as soon as possible.

I’m calling out for a few extra set of eyes to look over the schematic   If anyone could please go to the Google code, download the Eagle CAD files and take a look, I’d really appreciate it.  If you want to make changes, let me know so I can arrange for them to be merged back in properly.  Even if you’ve never looked at schematics before, take a look and as always, feel free to ask what’s going on in the comments.

This is also a great chance to give suggestions on functionality.  I should add, it may be your LAST chance!  Please give some comments if you think you might ever build one, if nothing else just to say you think it works for what you’d like to use it for.

If you’re not familiar with CAD schematics and circuit board layouts, it might be interesting to look at the history of the .sch and .brd files in the Google Code repository.  By looking at older revisions, you can see the steps taken along the way chronologically.  I commit changes at least at the end of almost every day I work on the project.

The current Bill of Materials can also be found at this Google Docs spreadsheet.  It includes estimated pricing – it currently comes in at just under $200.  A little bit higher than I was hoping, but about the same cost as Rev1 and Chuck Norris (adverbicized) packed with new extra features!

The schematic is hopefully organized well enough for someone not intimately familiar with this project to try and understand one section of the schematic at a time.  The capacitive touch schematic is separate, because it will be a separate board.  The way it works is you put copper pads on the board, glue it to the inside of your enclosure, and it senses you touching it on the outside of the enclosure.  Pretty nifty, and a great way to avoid milling the enclosure.

Please post comments below, or add to the Google Groups discussion page.

ZephyrEye: Rev1 vs Rev2

11 February 2010 7 comments

OK folks, I’ve received quite a few requests so here’s what’s up with the circuit boards I have available.  They are Revision 1, and have some hardware bugs (all of which can be corrected with a scalpel, soldering iron, and a fair amount of skill).  I’d like to go through the rundown once here so everyone understands what’s up.

The plan is to get started with Revision 2 soon.  There are quite a few feature improvements that would make the ZephyrEye work a lot better, and I’d like to list them.  I’m not trying to talk anyone out of a Rev1 board, I will gladly send them (without charge but unpopulated) to anyone until I run out, but I would like to avoid anyone having false expectations of what it can do.  That being said, it will probably be at least a few months before Revision 2 is ready.

If you are thinking about building a ZephyrEye, please use this post to consider your options.  Remember, it really can’t do much of anything by itself – it only tracks other ZephyrEyes, so think in pairs.  And Rev2 is very unlikely to be backwards compatible with Rev1.

Revision 1

I feel kind of like I’m hanging out my dirty laundry, these are some pretty silly mistakes:

  • LCD connector is missing two traces, which requires hand soldering wires to this connector.
  • Traces ran too close under the LCD connector, so installing the connector requires bending the pins down at an angle and soldering them without the connector having full flush contact with the board.  This bug proudly brought to you by the autorouter.
  • An extra voltage regulator needs to get patched in for the XBee, which outdid the current supply capabilities of the original regulator.

Hardware that is still untested:

  • Microphone to ADC
  • ADC channel for voltage monitoring
  • Charging indicator from LiPoly chip

State of Software:

  • Has a bootloader for easy, wireless program updates
  • Can do simple system setup
  • Can play King of the Hill, but currently limited to 2 players (I currently only have two ZephyrEyes to play with ;)
  • Still has a few bugs, graphic artifacts, etc.
  • Still needs other games programmed into it.

I only have unpopulated circuit boards (e.g., bare as the day they were born), so it’s up to you to have the tools, AVR programmer, XBees, GPS module, and pretty much every other part if you are considering putting one of these together.  Alternately, if enough people request it and are interested, I might put together some kits.  Email me or leave a comment if interested.

Revision 2

On top of the features Revision 1 already has, I would like to add the following features.  Note that some of these are crucial to be successful in playing paintball with a ZephyrEye.

  • Clear epoxy filled case that can take direct paintball impact and other abuse
  • Capacitive touch buttons, which would enable the above feature.  These would replace the tact switch buttons for the menu, zoom, and power buttons.
  • Digital compass for heading compensation.  This way the “radar” is oriented the direction you’re facing, rather than just pointing north, which is a little confusing if you aren’t a well-oriented person.
  • Helical GPS antenna, for better reception when near other objects (like your arm, body, or hopper)
  • GPS module (or chipset) with higher sensitivity and output frequency (> 1Hz)
  • Swap out the Series 1 XBee for either a 900MHz XBee or a MeshNetics ZigBit module, which have longer range and more complete, ZigBee compliant firmware.
  • If possible, an optional external ZigBee antenna for better transmissions in, say, densely forested or urban arenas.
  • Use the newer, faster XMega256.  More peripherals, and runs at a blazing 32MHz.  She’s fast enough for you, old man.

Make sure and post comments here or join the Google Code project if you’d like to have input on what Version 2 will be able to do.

Edit: I’ve also just created a Google Group for project development discussions.  If you think you’d ever be interested in using a ZephyrEye, for paintball or other, please join the group and put your thoughts up.  Revision 2 hardware development will begin in earnest soon, so now is the time to ask for features.  I’m torn between adding a can-opener or laser pointer … surely your ideas are better.

ZephyrEye: Schematics

26 January 2010 Leave a comment

So here’s the start of the design section of the project.  I’m releasing this project and related information under the BSD license.  I’m not into the viral type of Open Source licenses, but if you make a buck let me know about it cuz I’d l0ve to hear about it.  And maybe you can buy me some draft root beer … and if it’s a lot of money, maybe a Tesla

I thought I’d put one of the many logos I made for it here.  Amazing what a guy with a hamster wheel in place of right brain functionality can do with a few GiMP filters…  Well, maybe not as amazing as I think, considering I am the one with the hamster wheel brain.

Before I dive in too deeply, lemme run over the development cycle that will ensue now that I’ve got my spec:

  • Draw up a schematic
  • Lay out a circuit board (e.g., place drawings of the parts on a printed circuit board document and draw metal wires between all of the parts that need to be there).
  • Break piggy bank.
  • Send the circuit board to a “board house” to get it fabricated.
  • Purchase parts needed from online electronic component suppliers like DigiKey, SparkFun, and Mouser.
  • Assemble the parts.
  • Write the code.
  • Field test the result at various steps along the way.

I’m definitely a bottom-up developer, meaning I take the skills and parts I know well and attack the given problem with those first, and only add in new skills/parts as my existing skills/parts set prove unsatisfactory.  I’ve tried to break this habit, but it gets really cool results really fast and it’s hard to part with that (at the expense of a most likely higher quality project that might be achieved using a top-down approach).

I’ll hit you with a brief overview on the parts that I picked, and then I’ll show the schematic at the bottom:

MCU:

  • ATMega128 from Atmel
  • 128KB Flash program space, 4KB RAM
  • 54 I/O pins
  • 8 ADC channels, for power monitoring and microphone reading
  • Clocked at 8MHz and powered at 3.3V (because all cool components run at 3.3V ;)
  • It’s one of the easiest microcontrollers to use these days, and ridiculously capable.
  • Programmed in BASCOM-AVR.  More on that later …

GPS:

  • EM-406 GPS module from SparkFun.
  • 20 channel (e.g., can track up to 20 satellites simultaneously)
  • 5m accuracy
  • Small and works pretty standalone
  • Connects through a UART to the Mega128

LCD:

  • Color LCD Nokia Knock-Off from SparkFun.
  • 128×128 Pixels
  • 4096 possible colors, but only 256 at a time in the palette
  • Not that great, but it does the job about as good as an old cell phone LCD display would

Wireless Transceiver:

  • Digi XBee Pro, also available from SparkFun among many other vendors
  • 1 mile line of sight range, 300yd urban range
  • Easy as pie.  And like Jack Handy says, “If you get the chance to choose between regular heaven and pie heaven, choose pie heaven.  It might be a joke, but if not, mmm boy!”  Mmm, XBee!
  • Flexible addressing and self-healing mesh networking capabilities

FRAM:

  • FM24C64 chip from Ramtron.  I’ve only found it from Mouser.
  • 64KB of high-speed, non-volatile RAM.
  • Cheap (~$3.50)
  • Used to store field and game information, along with user settings
  • Every project with small non-volatile needs should use one of these.  They’re fantastic.

Battery:

  • 1100 mAh Lithium Polymer battery from SparkFun.
  • MAX1555 Li-Ion battery charger.
  • This is a pretty good and easy to use combination, and I’ve had great luck with the crazy easy to use charging circuit in the MAX1555 datasheet.

Those are at least the main parts that drive all the primary functionality of the system.   Drum roll ….

….

Schematic time!  I use EagleCAD from CadSoft (http://www.cadsoftusa.com) for drawing schematics and laying out PCBs.  They have a free version for non-commercial use, which is great for open source and hobby stuff.  SparkFun releases EagleCAD libraries for almost all the parts they sell, which kicks development speed up to .5 past lightspeed.  Eagle is also cross-platform compatible, for all you fellow penguins out there.

ZephyrEye Schematic

Sorry for the under-impressive image on this page.  Click through to zoom in for readability.  You’ll notice I organize my schematics by net names rather than running crazy lines all over the page.  Please don’t ever make schematics like that.  Every time you make a rats nest out of nets running all over the page, a devil gets his horns.  Just don’t do it.

Instead, label the crap out of EVERYTHING.  It’s best to not leave any nets with a default net name (e.g, N$42).  You’ll notice that it’s usually fairly easy to follow the document this way, especially when you’re using a printout, PDF, or some lame JPEG on a blog instead of Eagle to view the schematic.

Rant time’s up.  Anyways, I know I messed a few things up.  I’ll make an errata list if I can remember what they are …  Also, it’s OK if you don’t have a clue what’s going on.  I’ll explain most of the connections in later posts, especially once I start talking about the software (because that’s where the pin functionalities and inter-IC signals really get defined).

Also, you may have noticed I like SparkFun (woot!).  They’ve got some great stuff that hobbyists normally can’t source, like the GPS module, LCD display, and lithium ion batteries.  They also have a lot of great tutorials for beginners, for everything from Arduino to basic soldering.  Shameless plug: buy stuff from them.  Every time you place an order, a devil gets his horns removed.  (No, I don’t work for them … that’s a pipe dream …)

Next time, on Brad’s Projects: Board Layout!  Yay!