IT

attiny85 DIY Programmer

I needed to program few attiny85 chips and decided to use the Arduino Leonardo or Arduino Micro as serial programmers. So I came up with a mini shield that I could mount on either of the two and uses the ICSP header (+a reset pin) to do the job.

Inspiration was this post: https://petervanhoyweghen.wordpress.com/2012/09/16/arduinoisp-on-the-leonardo/ where Peter is actually using the ICSP header to do the attiny85 programmer. After a mini test on the breadboard, it was time to build it!

Results:

Schematics:

schematic_bb

Details:

  1. An LED is included (with its resistor) so that I could verify the any chip works (by flashing Blink).
  2. To successfully flash the chip, an ArduinoISP needs to be flashed onto the Arduino Leonardo / Micro beforehand (so they become a serial programmer).
  3. The RESET pin has to be connected to PIN 10 of Arduino Leonardo or to the Arduino Micro (so that ArduinoISP knows how to reset the attiny85). The shield has the RESET pin laid out so that it inserts into PIN10 of Leonardo directly, but on an Arduino Micro you have to use a wire to hook it up to PIN10 of Micro.
  4. An additional set of “cores” is required for Arduino IDE, so that it recognizes the attiny85 chip. Please see below.

Getting Arduino IDE to see the attiny85 “cores” was not straightforward on Arduino IDE 1.6.5. Just unpacking the attiny-master.zip file into the <ArduinoIDE>\hardware folder did not make the IDE pick up them up. After comparing with the existing <ArduinoIDE>\hardware\arduino\avr\variants\ I decided to try and manually create the folder structure. It now looks like this: <ArduinoIDE>\hardware\attiny\avr\variants\.

Before start using the “cores” and flash the attiny85 chip, the ArduinoISP (provided within the examples of Arduino IDE) has to be flashed to the Leonardo (or Micro) so that they become a serial programmer. Also, another change is still required, described in the previous post (Step 1) so that Arduino IDE uses the correct protocol when talking with the Leonardo / Micro.

If everything is setup correctly, just before flashing the blink code (below, uses PIN4 of attiny85 for the LED), the menu should look like this:

menu_arduino

  • Board -> ATtiny25/45/85
  • Processor -> ATtiny85
  • Clock -> Internal 1 MHz Make sure you don’t select External !
  • Programmer -> Arduino as ISP (Micro/Leonardo)

The second problem was surface mounting the components. Since the ICSP female header had to be soldered, it meant that the copper side of the shield would be on top. To get the chip holder, I put a dab of solder and then soldered the rest. To support the LED again I have soldered just a bit one of the legs – but another idea I’ve been told was to try to use toothpicks. Might have worked just as well.

Few more photos from the build process (photos taken with the mobile phone):

Blink.ino (uses PIN4 on the attiny85 for the led):

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 4 (on attiny85 is D 4, PB4) as an output.
    pinMode(4, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
    digitalWrite(4, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(4, LOW); // turn the LED off by making the voltage LOW
    delay(1000); // wait for a second
}

If everything works correctly, once the Blink is flashed, the LED on the programmer shield should blink every second.

Leave a Reply