As described in an earlier post, I'm designing a front panel for the circuits in CODE. After much delay (this is what happens when you have too many hobbies), I've got the first version ready. This post will describe the hardware. A subsequent post will describe the software -- both that which runs on my Mac and that which runs on the front panel's microcontroller.
At its simplest, the purpose of the front panel is to control outputs and monitor inputs. The PC sends commands to the front panel via RS-232, and receives responses the same way. So at the very least, we'll need a microcontroller and an RS-232 transceiver (a future version might switch to USB, but not this one). Everything else depends on the number of input and output lines.
The most complicated front panel in CODE calls for 27 output lines and 8 inputs. Even an ATMega644 can't handle that many (40 pins minus 7 for non-general-purpose pins, 4 for the ISP, and 4 for RS-232 leaves 25), so one way or the other we're using a latch for some of the inputs or outputs. As it happens, I fried my ATMega644, and ended up prototyping this circuit with an ATMega168. A '644 would've been a few dollars cheaper once latch and PCB size are taken into account, but it is what it is. Perhaps a subsequent version will use the '644 (or whatever the USB-enabled equivalent may be).
The ATMega168 has 28 pins. Subtract out the preassigned pins, those used for the ISP, the clock, and those used for RS-232 (I'm using RX/TX and RTS/CTS, though that too could be changed in a future version), and we have 13 pins. 13 pins is just enough to get us 27+8, assuming we use three SIPO latches and 3 direct lines for the output, and one PISO latch for the input. So that's what I've done.
Here's the schematic:
This was my first schematic drawn using Kicad, and I'm very happy with the way it turned out. I had to draw a couple of the symbols myself (the switch, to my surprise, and the barrel connector), but other than that it was pretty painless.
Having drawn the schematic, having gone through the Teho labs tutorial, and knowing that I'd be using the front panel again and again without wanting to monopolize the breadboard, I decided to go all the way to having a PCB fabricated.
The first step on that road, with Kicad, is footprint assignment. Eagle differs in this respect, as you pick your footprints when you lay out the schematic. I have to say I really prefer the Kicad approach here. When I'm putting together a schematic (especially for something I have no intention of turning into a PCB), I don't want to have to care about the footprint. Not at all. So anyway, picking footprints. Kicad was missing a few that I wanted, so I ended up making my own. That was much less painful than I had expected.
After footprint assigment, board layout. Here's where I discovered that I'm nowhere near as intelligent as the auto-router. Sigh. All that education -- for nothing. When I first laid out the board, I figured no way the auto-router could route this -- it's too complicated (I laugh at that now). So I routed it myself. A couple of hours later, I had it routed, but the last couple of traces had 3-4 vias each as they wended their way about the board. Oh all right, I'll try the auto-router. A few minutes later, it has the entire board routed, with no vias.
Here's the routed board, in all its glory:
In real life, though, the board won't be green -- it'll be purple. I decided to use Dorkbot PDX to make the PCB. They have reasonable prices and a reasonably short turnaround time. Shorter than the places which make the boards overseas, but more expensive. The price difference was low enough that I was happy to pay it to have the board made here. I can't wait for it to arrive.
[This post is continued in Front Panel Software]
Sunday, September 4, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment