I found this Arduino shield on eBay, recently, that will allow you to program the ATTiny 24, 44, 84, 13, 2313, 4313, 25, 45, and 85 from an arduino.
It looks like this:
and I purchased it here:
Although I don’t find any reference to “ManRob ATTiny Programmer” anywhere on the web, that’s what I’ve been calling it since that is what is etched on the PCB.
I will show how I got this shield running and used it to program an ATTiny84 and an ATTiny85.
Installing the Shield
The shield connects to the arduino pretty simply. I align the pins labeled 13 and RST. Once connected to my arduino uno, the 2 top left pins of the shield (first unlabeled, second labeled Ref) do not have a socket to connect into. That does not cause any problems.
Setting up Arduino to be an ISP Programmer
The next step is to load a sketch into the arduino to allow it to act as an ISP programmer. Connect the arduino to your PC via USB as you normally would.
Start the Arduino IDE. Open the Arduino ISP sketch from the examples.
Take a look at the heartbeat function in this sketch. If there is a delay(20) in that function, change it to delay(40).
Select the appropriate board type and COM port for your arduino. Compile and upload the sketch to your arduino.
Here are some detailed instructions on doing this if you have trouble
Jump to the section titled Turning the Arduino into a Programmer.
Setup Arduino IDE to Allow Selection of ATTiny Boards
I did this for another project, so I’ll just point to that
(jump to the section titled Setup Arduino IDE)
The more official page for doing this is here:
When I did this this time, I placed the attiny directory in c:\users\documents\arduino\hardware and it worked fine.
Now when you start the arduino IDE and go to Tools | Boards, you will see a bunch of ATTiny boards.
Programming the ATTiny85 at 1MHZ
We are ready to write code to an ATTiny chip. I started with an ATTiny85, though the process is really the same for either the 84 or 85, but the test sketches are slightly different because the pins are different.
Load the blinky sketch from the arduino IDE examples. Change the LED pin from 13 to 0.
Now change the board to ATTiny85 (internal 1 MHz clock). Set the programmer to Arduino ISP. Compile and upload the sketch.
Note, when you upload the sketch you will get the message
please define PAGEL and BS2 signals in the configuration file for part ATtiny85
twice. This is OK.
Once the program starts executing on the ATTiny85 the test on the shield will start flashing at a 1 second interval.
Programming the ATTiny85 at 8MHz
It is possible to run the ATTiny85 at 8MHz using its internal clock. The primary reason for doing this seems to be to allow the ATTiny to make use of the SoftwareSerial Library. This library allows the ATTiny the ability to communicate serially without a UART chip. I may have to delve deeper into this in the future.
To use the 8MHz internal clock do the following (taken from http://highlowtech.org/?p=1695):
- In the Arduino IDE, set the board to ATTiny85 (Internal 8Mhz).
- Set programmer to Arduino as ISP.
- Click on Burn BootLoader in the Tools menu
This will quickly come back with the same two warnings described above. That is normal.
Note that this does not actually burn a bootloader onto the chip. It is just setting the appropriate fuse bits on the ATTiny85 to let it know it should use the 8MHz clock speed.
Now to program the ATTiny85 for an 8MHZ clock, simply select the board ATTiny85 (Internal 8MHz).
If you compile/upload the blink sketch now, the test light should still blink at a 1 second interval.
Inconsistent Clock Settings
For fun, I configured the ATTiny to use the 8MHz clock (burning the bootloader to set the fuse bits). I then compiled and uploaded the blink sketch using the 1MHz board.
No errors are received doing this; however, delay no longer works properly since the real clock doesn’t match the clock selected during compile. In this case, the test light was flashing way faster than once a second (my guess would be closer to 8X a second).
Programming the ATTiny84
Everything I wrote about the ATTiny85 applies to the ATTiny84 EXCEPT one: the test LED on the ATTiny Programmer shield is tied to pin 6, not 0. So to make the blink sketch work on you must change the pin to 6. Otherwise, I was able to do everything to the 84 the same way I did it to the 85, including adjusting the clock.