As part of my ATTiny 85 learning adventure, I had to create some way to actually load code on to the 85 itself. My first go ’round was a breadboard monster. The thing I hate about bread boarding are the bloody wires. What a mess. Once I got my game working, I set out for a better way to program the chip. I could have bought one, but what’s the fun in that? As it turns out, it is simple to build, provided you have an Arduino UNO handy.
I decided to make a shield for the UNO. I wasn’t concerned with passing through all of the pins, so only the ones I needed are exposed. This is something I won’t do often, so I made no attempt to pretty it up either. The whole thing consists of an 8 pin socket, one six pin header and one ten pin header and a 10 uf capacitor. Oh, a small perf board to mount it all.
Wiring is tedious and made the same mistake as I did with the game (see my last post) as I got the four pins (5 to 8) reversed. I know, I know.
Mistake aside, it took about a half hour for me to wire it up.
One thing that was a bit problematic for me, as I have a vision impairment, was getting the pins lined up to the proper UNO pins for the headers. That took a few tries, but I got it.
The connections are below for using an UNO:
ATTiny 85 Pins (actual pin)
|Pin 13||pb2 (7)|
|Pin 12||pb1 (6)|
|Pin 11||pb0 (5)|
|Pin 10||reset pb5 (1)|
In the table above, the left is the Uno, the right is the ATTiny 85 socket. You need a 10uf cap between the Uno gnd and reset.
Before you can do anything with the Arduino IDE and the 85, you must first install the support…
By default Arduino IDE doesn’t support ATtiny85 so we should add ATtiny boards to Arduino IDE. Open File -> Preferences and in the Additional Boards Manager URLs give this url Arduino IDE Attiny support. Then, open Tools -> Board -> Board Manager, scroll down the list where it says “attiny by Davis A. Mellis”. Click toinstall it. Once installed, you can select ATtiny as the board type. You will also have to select chip type (45,85,etc.) Along with the processor, you will also need to specify the speed. 1 Mhz is the default, I used 8 Mhz for the code I downloaded for the game. Adjust to suit your needs.
You also need to upload the ‘ArduinoISP’ sketch to the UNO before programming the ATTiny 85. Once you upload this sketch, the UNO will pass along to the 85 what ever you send.
For my little handheld, I had to burn the bootloader first, then upload the game sketch. Don’t forget to set the Arduino IDE to ‘Programmer ‘Arduino as ISP’. Once the bootloader is burned to ATtiny, you are ready to upload your code.
You should be good to go. Here is a site (from Arduino) that goes into far greater detail.