This method uses:
*All items above are available in our Arduino PICO Kit
1 x 100 Ohm resistor
Arduino 1.0 (or newest version)
Update the ArduinoISP Library with the latest version (instructions in readme).
Atmel AVR Studio
First you'll want to download the stuff above and install it. The order that it's listed above will be most appropriate.
Then set up your Arduino and breadboard with the chip and jumpers. You'll only need 3 of the LEDs here. They're used to give you the status of the programs you send to the ATTiny chip.
Once that's set up you should open your Arduino program and go to File > Examples > Arduino ISP. Click that and it should fill your screen with code. The preamble on the screen tells you what the LEDs on the breadboard to. The one attached to pin 9 is the Heartbeat, pin 10 the Error light and pin 7 the programming light, this will flicker when information is being sent.
You need to send this code to your Arduino. Hopefully you've done this before. If not don't worry, you just need to select your boardtype (Tools > Board) and serial port (Tools > Serial Port). If you don't know what port is being used go to my computer, right click and go to device manager > Ports and you should see one as labelled Arduino Uno (or whatever you're using). Click the arrow button on the Arduino programmer to upload this Sketch (that's what we call an Arduino program) to your Arduino board.
Hopefully the LED attached to the 9 pin will now start beating. We're ready to program. If not we need to start trouble shooting!
Now open your shiny new AVR Studio. Congratulations you are now a programmer. Start a new project and call it Blink, selecting the
"C Executable Project" Cut and Paste the code below.
CodeColon Select all
* Created: 28/02/2012 13:14:10
* Author: phenoptix
DDRB = 0x1F; /*all pins are outputs. DDRB = Port B Data Direction Register
The Hex code 0x1F translates in binary to 0001 1111 and in this case gives
the pins as shown in the datasheet as input or output. All are initially input
and set at 0. Looking at the datasheet for the ATTiny85 really helps in understanding*/
PORTB = 0x1F; // all LEDs on. Again the Hex defines the state of the Pins. PORTB = Port B Data Register
for(i = 30000; i > 0; i--); // short delay
PORTB = 0x00; // all LEDs off
for(i = 30000; i >0;i--); // another short delay
This is a C code that makes all pins on the ATTiny85 outputs then makes them flash. I had trouble getting any code to work at first and this was the only one I've thus far got working. http://www.dprg.org/tutorials/2011-02a/very-tiny-development.pdf
What Hex code is in binary
CodeColon Select all
I've included that as it helped me understand what I was doing on the chip. You may or may not be interested in learning but that's up to you.
With the code pasted in go to Build > Build Solution. Every time after this go to Build > Rebuild Solution. This will compile the code and give you the all important .hex file.
Now to AVRDude. Cool name eh? Go to the windows button > search and type cmd
This brings up the good old terminal. Now navigate to where your shiny new .hex file is. If you don't know how to navigate you type cd (change directory) and where you want to go. Alternatively you could copy and paste the .hex file into your user directory but you'll have to do this everytime you recompile your code.
Now we want to upload the .hex file using AVRDude. The command used to upload to the ATTiny85 was
CodeColon Select all
avrdude -c arduino -p t85 -P COM5 -b 9600 -U flash:w:Blink.hex
Bit of a note here. Without defining Baud rate it seems to identify the arduino AVR chip as the one to program rather than the ATTiny85. 9600 worked whilst I was writing this tutorial on an R2, however this has since stopped! Now 19200 works on my R3. Don't know why.
Type that and see if it uploads. If you get a message that finishes with avrdude done. Thank you. We may have just been successful.
Now we want to attach the other LED to the board. Like this
It should start to flash. If it does you can remove all the yellow, white and brown connectors so all you've got is power to the chip can you can see that it's flashing on its own.
If it doesn't we need to trouble shoot.
Datasheet for the ATTiny85 can be found here http://www.atmel.com/Images/doc2586.pdf
Some of the resources that helped me get to this stage are:
This is still a bit fragmented and bitty but I just wanted to publish it quickly and get it online so others can use. It's still a WIP and no doubt you'll have some problems replicating as I had many and at some points felt like giving up. It's the first part of the Larson / TinyCylon project and it's done. Whoop Whoop.