Troyduino

Design Considerations

My first experience with microcontrollers and microcontroller development boards was with an Arduino Duemilanove. It is a great platform for learning the hows and whats of microcontrollers and systems design. Very quickly, however, I started hitting a few large barriers in my work:

  • I only had one Arduino board and my projects were getting more complex; requiring two or more controllers, or being installed for long periods of time
  • Buying another Arduino costed more than I wanted to spend
  • Because of the high cost of the boards, I didn't want to use them in projects that may put the board in harms way, like in an outdoor environment

I started thinking about how I could design my own board. A board that over came those obstacles and that was easy and cheap to produce. The "Troyduino" is my own Arduino shameless rip off inspired Atmel AVR development board. I did my best to maintain the ease of use and functionality of its Arduino namesake, while at the same time cutting the fat on features that I didn't require so I could bring down the overall cost and complexity. Things like fancy-pants USB transceivers were tossed out the window, as was the complicated Arduino pin footprint. I wanted my design to be more breadboard friendly with all the GPIO pins aligned in a row. In no time, I had come up with a short list of design criteria that I considered essential to my project:

  • Cheap as possible
  • Breadboard compatible
  • Part through hole A pure PTH design was dropped in favour of saving some PCB real estate so I could double up on my fab house's order size allotment

Schematic

Since my design was based on the Arduino framework, I knew I would be using an Atmel AVR controller as well as typical 5 V logic levels for the system. This lead to a pretty simple power supply design using only a standard linear regulator.

Power supply
("Right click > Open image in new tab" to view full size in most browsers.)

The power supply is being fed from a standard DC jack with a terminal voltage of anything from 6.25 V - 12 V. The lower limit is set by the 5 V regulation voltage and internal 1.25 V reference. The upper limit, efficiency aside, is only set by how much power the IC can dissipate with a normal current draw on it. (Until, of course, you hit the IC's inherent break down potential.) For over-current protection, I used a Positive Thermal Coefficient (PTC) Polyfuse. This device has an asymptotic-like current-resistance curve. As the device approaches it's rated current limit, it begins warming up. At that critical limit, the resistance of the crystalline structure jumps by orders of magnitude effectively pinching off device current and acting as a circuit breaker. When the load is removed, the polyfuse cools and returns to its former low-impedance state. I also included a solder jumper to bypass this protection in the event that I needed to draw high current and was dealing with the consequences. Finally, a simple 5 V linear regulator IC, an LM7805CV, drops the line voltage from the input down to a very clean 5 V level. The capacitors on the IC provide stability to avoid self-oscillatory conditions as well as helping to stabilize the rail from noise and transient brown-out. With power taken care of, the next step to address is that of the heart of the board itself. Since the Troyduino is using a very robust microcontroller, the ATMEGA328P, there really wasn't that much to worry about when designing the logic portion of the board.

Microcontroller circuit diagram

The foremost design consideration of the Troyduino is the In Circuit Serial Programming (ICSP) interface used to program the controller in-place rather than having to remove the IC for programming out-board. The ICSP is compatible with any AVR-style programmer. The AVR is held in an operational mode by tying the active-low RESET pin high. Reset is both user controlled with the push of the NO push button, but it also software controlled via the ICSP header. The system is driven by a quartz crystal oscillator at a frequency of 16.000 MHz. The crystal is supported by two small value capacitors matched to the crystal itself. In this case, the crystals I bought required something around 16 pF load capacitance to operate ideally. From the crystal's point of view, the two caps are in series with one another so their total capacitance is found via the reciprocal of the sum of their reciprocals, or for two 22 pF caps, a resulting 11 pF. Adding this to an average estimate for the stray capacitance of the PCB brings it up to about the rated 16 pF. When the GPIO pins switch low to high, the gate capacitance needs to charge up. When they switch high-low, that same charge needs to be dissipated. In both cases, the supply rail can suffer noise from the in-rush or out-rush of current from the GPIO pins. Since the board will be making use of the AVR's Analog to Digital converter, I wanted to ensure that the supply rail for the analog comparator was extra-clean for maximum accuracy. I fed the AVcc and AReference pins from a low-pass Pi section filter to help squeeze out any noise from the supply rail. This led to a complete, and fairly simple, schematic for the Troyduino's power and logic circuits.

Complete schematic

Layout

Laying out a PCB can be a challenging and puzzling task, doubly so when you are confined to a small PCB or other design constraints. PCB layout showing only silkscreen part outlines In my design, I had no use for the Arduino's seemingly esoteric pin footprint so I decided to go with a simple straight header for all the AVR's IO and power pins. The intention is to use a 0.1" pin pitch male header soldered on the underside so that the Troyduino can be plugged into a breadboard for rapid prototyping. However, because the pads are exposed on both sides, you can also use a topside header of any sort. (In the assembly section, I do just this seeing as I was out of male headers at the time!) The PCB fabrication house I use charges by a set unit area, that is to say, you can purchase an allotment of space such as 100 mm by 50 mm and use as much or little of that as you want. Obviously, I wanted to choose the smallest space I could design within to maximize the value of the service. I ended up partially scrapping my completely PTH design in favour of a slightly more SMD one with the passives and caps going to 0805 packages. I ended up going with that exact size allotment so to maximize its use, I squashed each board down to one half the width. This bookmark-like PCB shape let me fit two copies of my board onto each unit of PCB I paid for. I got twice as many board that way! PCB layout showing everything Routing the board was a challenge within the tight confines of the 100 mm by 50 mm board size. I also wanted to maintain at least a 10/10 mil trace/spacing rule across the board so that I could reuse the same design at nearly any fab house in the future. Since this board is all about pinching pennies, production goes where the deals are. To make it just a bit more complicated, I eliminated as many vias as possible. I've made PCBs by hand in the past and the only real huge pain for a two sided board was the plated through hole vias. Knocking as many of those out as I could helped keep it possible to hand make small runs of the Troyduino if necessary. PCBs back from the fab house After they were manufactured by the fab house, I received back a stack of PCBs ready to be populated and tested. Even produced at a low coast, the boards were great quality. 100% e-tested at the factory, and a cursory look over them by eye didn't turn up any defects either. Even the tiny silkscreen came out clean even though I ran it right at the house's bottom limit.

Assembly

Assembling a board is not a complicated task, but remembering a few simply guidelines certainly makes the work much easier.

  • Just like baking, make sure you have everything you need before you start.
  • Start from the centre of the board with the smallest components. Work outwards and repeat for larger components.
  • Don't forget IC sockets! It's easy to do so when you're in the groove and moving fast.
  • Be tolerant of temperature critical devices. Don't cook your parts.

The first thing I always do is dry-fit all my big parts in place. In the layout phase I always make print outs of the PCB and check footprints and dimensions, but it's always good practice to do a sanity check with the real deal. Checking to see if all the large components fit Being new as I was to SMD devices, I was glad that I played it safe and went for 0805 packages instead of the smaller 0603. The "larger" 2 mm by 1.25 mm devices were small enough as it was. Any smaller and I likely would have needed some magnification to assemble the board. Tiny 0805 resistor soldered in

(Subtext: the value of a good quality camera and macro lens.)

Here is one 0805 resistor soldered on the underside of the board. Provided the adequate tools, the soldering job can be pretty fun and goes by fast. After the assembly was complete I tested the board's GPIO and analog capabilities with a program uploaded via the ICSP system. Here is the present revision of the Troyduino beside the last revision. Notable differences include the change from glass fuse to PTC polyfuse, the former ridiculous form factor, and new SMD usage. I'm going to miss this ship; she went before her time.

Resources

Following is all the resources used for this project under their respective licences. All materials are released under Creative Commons or GPL licenses. The idea is that I stood on the shoulders of giants to see this far, and I hope that this work may help someone else out in the future. At the very least, I hope it sparks a curious mind.