The ATtiny85 is a very small size, high-performance 8-bit microcontroller which you can get for about $2 in ebay (DIP-8 package). It combines 8KB ISP flash memory, 512B EEPROM, 512B SRAM, 6 general purpose I/O lines and can operate at a frequency up to 20Mhz. You can find the full datasheet here. And you can even use the Arduino IDE to program it.
Its pinout is shown below:
In order to program (flash) it you can use any external programmer, like an Arduino UNO board, or, in our case, a bus pirate.
You can connect the ATtiny to the bus pirate like so:
|Bus Pirate signal||ATtiny signal||ATtiny Pin|
|+5V or +3.3V||VCC||8|
We could optionally test the setup using avrdude:
avrdude -p t85 -c buspirate -P /dev/ttyUSB0 -v
it should output detailed information regarding the detected AVR, like the available memory, the fuses configuration, etc.
In order to program the ATtiny using the Arduino IDE, we have to do the following steps.
First of all, Arduino IDE doesn’t support ATtiny85 by default, so we will have to add the ATtiny boards to the Arduino IDE, from the repo of David Mellis. Open File -> Preferences and in the “Additional Boards Manager URLs” field paste this URL: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json. After that, open Tools -> Board -> Board Manager, locate the “attiny by Davis A. Mellis” entry in the list and install it. Now you should be able to see the “ATtiny microcontrollers” options in the Board menu (under Tools).
Finally, we can set up the board and the programmer in the Arduino IDE:
Tools -> Board -> Attiny 25/45/85
Tools -> Processor -> Attiny85
Tools -> Clock -> Internal 8 mhz
Tools -> Programmer -> BusPirate as ISP
Tools -> Port -> the bus pirate port (in my case it was COM18
By default the ATtiny85 runs at 1MHz. To make it to run at 8MHz we would have to burn a new bootloader. Select Tools -> Burn Bootloader.
We can now write, verify and upload our sketch as we would normally do.