Friday, February 18, 2011

TwinklePIC, part 5

Parts 1, 2, 3, and 4

So after making my first hand-wired prototype, I decided to make a printed-circuit-board version of the same. Why? Well, a PCB is a whole lot cleaner and more durable. It also is a whole lot faster to assemble (populate), because all you need to do is solder the components in place - all the wiring between components is contained in the board. The downside is the extra time to lay the circuits out on computer, the time to get the boards made, and the expense.

Strictly speaking, because this whole project is likely to be a one-off, I didn't need to go this far. I could have just boxed up the prototype board and called it good. Sometimes being an engineer is knowing when to do just that and move on. I do take pride in my work, though, even my at-home projects, and I wanted to produce a clean result. Part of this whole project was to flex some seldom-used skills, too, like circuit layout. Plus, there was (still is) the off chance that someone might see the results and say "Neat! Where can I get one?" in which case populating a PCB is a lot easier than hand-wiring another. One more aspect of it is that, if I ever wanted to share this project with the wider Maker community - open-source it - a complete design with PCB is much more attractive than a code listing and a half-assed circuit schematic.

Although I have access to some very powerful PCB layout programs at my office, the learning curve on them is steep. I have tinkered around with the free Eagle program before, and could use it on my laptop at home, so that's where I did the design. You start by creating a circuit schematic, then find or create PCB footprints for each component, then arrange the footprints on the board, then draw the traces to connect the pins together.

Being a perfectionist, I tend to tweak such things a lot more than is necessary. Also, because the place that makes my boards charges by the square inch, and because I'm a cheapskate, I strove to shrink the overall board size down, which requires more tweaking. I was able to get this design down to about 3 sq in, or about $7 ($10 with S&H). My Eagle library didn't have footprints for most of the components I used, so I had to create them. All-in-all, it was a huge time suck. But the results are nice:

Some notable additions I put on the board that were lacking from the hand-wired prototype. First, I added a USB-mini connector, so that I could power the thing from any USB source. I still have pins where I could wire in 3-5.5 V from, say, a battery, and a jumper that would allow me to select between sources. As a protective measure, no matter the power source, I added a 500 mA fuse. The white connector along the top edge is my ICSP (in-circuit serial programming) header, which lets me reprogram the chip while its still in the circuit. The layout of the resistors is such that one can, as I have done, solder in each resistor, or replace it with a resistory array chip, or replace that with a chip socket, which allows easy swapping of resistor values. Why would you want the resistors to have different values from each other? The resistor value, more or less, sets the maximum brightness for each channel. So if you wanted a create a constellation of "stars" with different magnitudes, you could do that without customizing the program on the chip.

Some may notice that I have stuck to the 0.1"-pitch thru-hole components. I didn't need to. In fact, I could have probably cut the PCB size in half by replacing the PIC, connector, and LED resistors with surface-mounted components. But I still like the flexibility that I have here with the larger components. Sticking the PIC in a chip socket, for instance, allows me to easily replace it if I blow one up.

I kept the same large connector so that I could interface to the existing LED cable I'd made. Another person could solder the LED leads directly to the board and skip the connector.

No comments: