It has been said that a wise man learns from his mistakes; however a wiser man learns from the mistakes of others. I often tell people that the School of Hard Knocks has the highest tuition, but turns out the best graduates. Well, I have some doozies, and we will take a look at some of them every now and then. Hopefully, you can learn from some of my mistakes and not have to make all of them yourself.
I want to show you the layout of my first effort on the new Tiny2313 Experimenter’s System:
Purty, ain’t she? This PCB provides a microcontroller, three LEDs, two push-buttons, a pot (variable resistor), a speaker, a photo-transistor and a thermistor. Additionally, there is a diode to protect against connecting the battery backwards, and (with a 4-cell AA battery) the voltage drop will not take controller below it’s operating specs. Also, notice that the LEDs have both ends available, so the student can learn that an LED can be connected to common ground (for an active high signal) or a common high (for an active low signal.)
This took several hours, first getting the layout correct and then the connections for the programmer cable. I was especially proud of the idea of providing the option to draw power from a battery or from the programmer. In addition, there are plenty of access points for ground and power available for the experimenter’s use. All in all, pretty good – or so I thought at first.
Notice the trouble yet? No, well, here is another view:
Sorry about the quality of the photos here. Anyway, if you have not noticed the troubles, take a look at where the speaker mounts, near the left side of the board. The 2-pin female header mounts directly in front of the speaker port. This is just to the right of the pot and just in front of the push-buttons. Here is what I noticed only after I started mounting components: the speaker sticks straight up out of the board, and will block the push-buttons and crowd out the pot! There are also a couple of other less prominent errors in this board: several of the components will not fit into their holes (the push-button’s ground pin does not line up with the hole for it – too close to the lead pins.) and some of the components are too close to their female headers – you cannot get both in at the same time.
Answer: build a mock-up protoboard:
What I did here is to print out a picture of the PCB (my CAD program allows a photo-view of the board, if yours does not, just print out the artwork.) Take the printout from your CAD program and cut out about an inch beyond each edge of the board. Take that paper and glue it onto a slightly larger-sized piece of foam board (you can get foam board in Wal-Mart in the office supplies section, or most office supplies, or crafts, stores.) I used a cheap Elmer’s glue stick, but you can use any glue, just be careful that the glue does not wrinkle the paper – excess liquid glue can make the paper wrinkle. Next take a safety pin and poke a hole through the skin of the foam board at every through-hole, and component-hole, in the printout. Finally, insert one of each component into the foam board, right where it should go on the PCB. This way, you can make sure that everything fits and also get a feel for the overall layout of the board.
You may notice that I made several changes in my experimenter’s system PCB layout. I opened up the spacing for the push-buttons, moved the speaker to the rear of the board, and added a couple of servo ports. Also, since the 2312 is, how should I put this? Analog-challenged, maybe? I removed the pot (that freed up the room for the servo ports.) I also moved the ground and +V rows of pins and moved them over to the right-side of the board, and also added a single pin for each set of holes. This provides for a 1×10 header plus an additional pin that can be used to provide power to an optional solderless breadboard.
One other change that you may have noticed is that I changed the 6-pin programming port over to the more standard 10-pin STK500-compatible port. In searching for suppliers, most of the 6-pin programmers that I found were more than the cost of the 10-pin programmers. The choice was pretty clear, I could either change the programmer port on my board, or I could purchase the 10-pin programmers along with a 10-pin to 6-pin adapter. So…
Alas, in changing the programming port, I also introduced another bug. Take a look at the left side of the left-most push-button. You will notice that the trace for the MISO signal from the programmer port to the Tiny2313 chip actually touches the component hole for the female header. I need to move the SCK trace down a bit to make room for the MISO trace to avoid the component holes there.
One additional change, that I am considering: since the 2313 does not have a real ADC (Analog to Digital Converter) on-board, analog input goes into an analog comparator. This only compares the voltage of the analog input and gives a single-bit input to say whether the one input is above or below another analog input. If I create a small (say 4-bit) resistor ladder for a DAC (Digital to Analog Convertor), then the output from that could be fed back into one leg of the analog comparator to then test the analog input and thus compute the voltage of the unknown analog input. That seems to be the way to go for the next version. Any thoughts from you?