Introduction: Mint Tin AVR Programmer/Prototyper
A lot of the projects I make are more about having fun and doing something weird and different than about being practical. With this project, I built a tool that really streamlined things as far as programming microcontrollers goes, and it enabled me to do more fun and weird things more quickly and easily than I would have been able to do without it.
Now, if you've done stuff with the Arduino you've probably had some old timer mumble something about '...in my day...AVR...C...' and if you tune in to the mumbling you will learn that, for example, code for a simple project can fit on a nice little ATTiny chip which will run you a buck or two (a 'buck' being a US dollar for readers in the rest of the world). So it is in fact worth the trouble to spend a bit of time working out the details of programming them using a programmer (~$20, or you can use an Arduino to program them, or you can, of course, make your own) and the AVR toolchain. There are some nice Instructables on the topic, like this one:
Program an ATTiny with Arduino
There are some frustrations you will encounter, though . A big one is having to connect everything using a mess of wires every time you want to program a chip. Another is, if you keep pushing a chip into a breadboard and pulling it out, you're begging for the legs to get damaged. There has to be a better way! And there is...
Step 1: Materials: Meet the ZIF Socket
The key element here is the ZIF (Zero Insertion Force) socket. You put that chip in there and push the lever down, and it grabs the legs nice and snug. You can do this a million times without getting the legs all twisted up, but you don't have to, because we're also going to have female headers you can plug jumpers into while you're prototyping - just like with the Arduino. This project doesn't require many parts - that's part of the beauty of it.
Materials you will need:
- A ZIF socket big enough to accommodate a 20 pin chip (like this: https://solarbotics.com/product/42050/?gclid=CNr8-...).
- Female headers (like these: https://www.sparkfun.com/products/115 or these: https://www.pololu.com/category/50/0.1-2.54-mm-fem... or these: https://www.adafruit.com/products/598)
- Male headers (like these: https://www.adafruit.com/products/3009 or these: https://www.sparkfun.com/products/116 or these: https://www.pololu.com/product/965)
- Double sided tape
- A mint tin of some sort (Altoids are traditional, but given my Vermont family connections, I'm partial to VerMints, and given my Linux loyalties and caffeine addiction, Penguin Mints are also good. I used a Celestial Seasonings tin here. I am not an employee of any of these companies, btw).
- Some wire
Tools you will need:
- Soldering iron and solder
- Wire cutters
- Band saw or other tool to cut the PCB to size
- A Marker
- A multimeter (in case you need to check connections)
Step 2: Populate Board With Components
First off, cut the PCB to a size that will fit in the tin (about 2" x 2 3/4").
Next, solder the components to the board:
- Put the ZIF toward the bottom, and leave room at the top of the board for the socket to plug your programmer into.
- Cut some female headers, 2 pieces of length equal to the size of the ZIF board. Solder those so they run along each side of the ZIF socket, and connect them to the corresponding row in the ZIF socket.
- Cut 2 3-pin-long male headers. solder them above the ZIF socket in a 3 vertical by 2 pin horizontal configuration (this is assuming you have a 2x3 socket on your programmer, but make sure! There are also 2x5 and 1x6 configurations. Diagrams in the next step will clarify things.)
- IMPORTANT: using a marker, place a dot, or arrow, or something to indicate proper orientation of the programmer socket! In my case I drew a 'C', and the open part of the C was where the notch (the thing on the same side as my fingers in the picture above) should face. Don't feel like you have to do the exact same thing if another symbol or diagram works better for you.
Step 3: Connect the Components
I primarily use variants of the ATTiny85 (25, 45, 85, etc) and ATTiny2313 (2313, 4313, etc) in my projects. The SPI interface involves these pins:
- MISO (Master In, Slave Out)
- MOSI (Master Out, Slave In)
- Reset (Reset)
- SCK (Serial Clock)
- VCC (Voltage, typically 5V but check your datasheet)
- GND (Ground)
With the exception of ground, these pins are in the same location on both chip. See the pinout diagrams above for specifics.
If you'd like to read more about the SPI interface, John Boxall did a nice write up on the SPI bus on his Tronixstuff blog: http://tronixstuff.com/2011/05/13/tutorial-arduino...
My programmer (this one, for reference: https://www.sparkfun.com/products/9825) has the ISP6PIN connector in the diagram above, so that's why in the previous step I said solder a 2x3 connector to your PCB. If you have a different connector, the diagrams should be sufficient to guide you.
Cut 7 wires of appropriate length and connect them as follows. Orientation is super important, so always insert your chip with the dimple on top (facing the programmer connector socket), and use the above diagrams to guide you:
- Programmer VCC to ATTiny VCC
- Programmer SCK to ATTiny SCK
- Programmer MISO to ATTiny MISO
- Programmer MOSI to ATTiny MOSI
- Programmer Reset to ATTiny Reset
- Programmer GND to ATTiny85 GND, but also...
- Programmer GND to ATTiny2313 GND
If you have any troubles, you can always use your multimeter to ensure your connections are good.
Step 4: Put It in the Box
Using double sided tape, attach the PCB to the bottom of the mint tin. You now have an Arduino-ish programmer/prototyping tool you can use to program very inexpensive ATTiny chips to put in the final version of your projects. Enjoy!
BTW, I'd like to give a special shout-out to Bloominglabs, Bloomington, IN's Hackerspace. We're in the Makerspace contest here on Instructables this month. If you live in Southern Indiana, come out and visit us on public nights, every Wednesday at 7pm.
We have a be nice policy.
Please be positive and constructive.