Freitag, 23. November 2012

Programming an ATtiny85


I recently decided that I wanted to use an ATtiny85 for a small project I have in mind. So I ordered a couple from DigiKey. Once I got them I realized that I only had a very vague Idea on how to go about programming them. 
I ended up following instruction from the brilliant people of the High-Low Tech group at MIT: http://hlt.media.mit.edu/?p=1695 

Some things I noticed:
- Their instructions do *not* work with Arduino 1.0.2.
- Dont forget to select the correct board *and* the correct programmer (selecting a programmer was new to me, its in the "tools" menu)
- Yes, the Capacitor is essential. I didn't have 10uF capacitor around the first time I tried it. I tried various wrok-arounds (multiple capacitors in paralel, larger values, smaller values) and nothing worked. (In retrospect, at one point I did get it to work without the suggested capacitor, however there was a different problem, but I was unable to fix it, as I assumed it was the cap. So my recommendation: Just get the capacitor and it'll save you trouble.

Also, use the suggested debugging LEDs. It makes it a lot easyer to understand what is happening.

Here is my setup:


Green LED tells me the ATmega is talking to the ATtiny:


Once I finally got it running I basically fell in love. This thing is sooo simple. It works like magic. No external oscillator, no nothing. It just works. I think in many situations, once you have the initial setup its easier to use than the Arduino. I realized I will want to program ATtinies more often, so I decided to make myself an ATtiny programming shield:


I used a protoshield which I piked up from the METALAB at some point and had lying around. I connected everything like so: 



In addition I added a yellow LED + Resistor on pin 9 (Heartbeat - tells me the programmer is working OK). I also added a red LED on pin 8 (Error) and a green one on pin 7 (communication). The small green LED you see next to the ATtiny is for double-checking if everythng works. Its connected to pin 0 of the ATtiny and is executing the 'blink' sketch which I just uploaded to the ATtiny.


Sorry about the shoddy fotography. If I find a decent camera I might upload some nicer images.

This was a fun project and well worth the time :-)


Keine Kommentare:

Kommentar veröffentlichen