Programming the Attiny

The Attiny is amazing! This teeny part can replace a whole Arduino board at a fraction of the cost and size. They are a little less user-friendly to program, so here are the steps I took.

BOM

  1. AVR Pocket Programmer
  2. Attiny85
  3. Laptop (OSX)
  4. .1 uF ceramic capacitor
  5. Breadboard, jumpers, resistors, LEDs, etc.

Process

  1. Wire the programmer to the Attiny. This process confused the heck outta me. See the image above; if you are looking at a 2×3 header on the PCB, use the layout at lower left. If you are looking at the bottom of the female plug on the end of the programming cable, use the layout at lower right. In both cases, note the orientation of the polarizing notch.
  2. Add a .1uF ceramic capacitor (code 104) between power and ground and as close to the chip as possible. I used to skip this step and paid for it with hours of troubleshooting!
  3. Install new board definitions in the Arduino IDE.
  4. Set the following in the Arduino IDE Tools menu:
    1. Board: Attiny 25/45/85
    2. Processor: Attiny85
    3. Clock: 1Mhz
    4. Port: Leave this alone. As I understand it, this programmer does not communicate via serial interface and will act like you don’t have anything plugged in.
    5. Programmer: USBTinyISP
  5. Make sure the ATTiny programmer is supplying power to the chip.
  6. Tools > Burn Bootloader. This only has to be done once, unless your future sketches need to run at a different speed. 8mhz seems to be well-supported.
  7. Upload blink and wire your LED using the following pin map.
  8. Note that if you use the same Sparkfun product I did, there appears to be a current leak to VIN whether you set the programmer to supply power or not.