loading

Do you need a quick and easy way to program AVR chips. Did you know you can use your Arduino and the Arduino IDE? This Arduino shield makes the process much easier.

You can:

  • Burn a bootloader onto a replacement Atmega328 for your UNO.
  • Make a stand-alone Atmega328 breadboard project.
  • Use inexpensive Attiny chips for smaller projects.
  • Reprogram a chip in an existing circuit with an ISP header.

This shield lets you:

  • Quickly setup to program chips.
  • Program a variety of chips easily:
    • 8, 14, and 20 pin Attinys.
    • 28 pin Atmega168 or Atmega328.
  • Quickly see if a sketch is working on pin D3.
  • Use on a Arduino Mega (with optional jumpers).
  • Create a stand-alone programmer.

There are a lot of AVR programming shields available. That is why we call this one "Yet Another Programming Shield", or YAPS for short. We think ours has a lot of advantages. If you want to learn more about how we developed it, check out http://makersbox.blogspot.com/2013/12/anatomy-of-small-open-source-hardware.html

This project was recipient of a 2013 Innovation Grant from Wyolum which helped us get it to the kit stage.

The kit is available on Tindie.com. Purchasing the kit will save you the time and expense of ordering from several different vendors and avoid the minimum PCB order premium. You will also be helping us develop and share other projects!

Step 1: Gather the Parts

To start, check to see you have everything:

Bill of Materials:

  • PCB available at OSH Park ($20.70 for three copies).
  • (1) x 28-pin DIP ZIF socket
    • EMSL 9220005 $2.25ea
    • Adafruit 382 $3.00
    • Sparkfun ZIF PRT-09175 $2.95
  • (1) x 6-pin DIL ribbon cable
    • $2.50 (EMSL) 3" - or-
    • 2 x Ribbon Crimp Connector - 6-pin (2x3, Female)
      • Sparkfun PRT-10651 $0.35ea
      • Digikey 609-2842-ND $0.90
      • Digikey 609-2841-ND $0.82
  • (4) x 2x3 male header (or order extra 36 pos. straight header) Digikey 609-3218-ND $0.26
  • (3) x 3mm leds (Green, Yellow, Red) yellow
    • Digikey 1080-1106-ND $0.33 green,
    • Digikey 1080-1115-ND $0.33 red,
    • Digikey 1080-1123-ND $0.33 yellow
  • (3) x 330-ohm resistors (Digikey 330QBK-ND)
  • (1) x 10 uF cap (Digikey P975-ND)
  • (1) x 16-Mhz resonator (Digikey X908-ND)
  • (1) x straight header (Digikey S1011EC-40-ND, $0.67) [0.120" tail]
  • (1) x tactile button (Digikey SW402-ND $0.42)

Optional (for Arduino Mega):

  • (1) x 2x2 female header Digikey A26452-ND $1.25
  • Four male jumpers

Optional (for Optiboot or Adaloader):

  • (1) x Piezo Buzzer
    • PS1240Adafruit 160 $1.50
    • Digikey 445-2525-1-ND $0.73
Remember, I've done all the hard work if you just want to buy the kit at Tindie.com

Step 2: Gentlement, Start Your Iron

We are going to assume you have some kit-building experience. If you need some help soldering, head over to http://www.sparkfun.com/tutorials/213 to brush up.

The order of assembly is largely a matter of preference. If you don't have a helper or a vice, I generally go from lowest height to tallest so when the board is reversed on the table, the parts stay in place. Picture numbers correspond to the step numbers:

  1. Three 330-ohm resistors
  2. Tactile button
  3. LEDs:
    1. Long lead is positive. Look for the "+" on the PCB.
    2. Green -> Heartbeat, Red -> Error, Yellow -> Programming
  4. Solder one lead first, check it is seated correctly, and then solder other lead.
  5. Capacitor (short lead is negative, look for the "-" on the PCB.
  6. (2x3) headers:
    1. Use the ribbon crimp connector to hold the header in place.
  7. Crystal (no polarity, but put the value facing out).
  8. ZIFF connector:
    1. Solder one pin on each opposite side, check the seating, and then finish.
  9. Shield headers:
    1. It is easiest to place them in an Arduino first to hold them in alignment.

Inspect the board for missing, bridged, or incomplete solder joints. Solder bridges can be fixed using solder braid or a solder-sucker.

Step 3: Jumper and Options

  1. The jumper cable is creating by placing one end of the six-strand cable in between the upper and lower parts of the crimp connector and then applying enough pressure to make it lock. Do not use pliers. Use something flat to press down on it.
  2. With one crimp connector in place, put the jumper on the ISP header and check the length you need to reach the far Attiny85 header.
  3. Crimp the remaining side on and trim the excess.

Arduino Mega:

This shield will work with the mega, but needs a 2x2 female header added in the lower right corner and four jumper wires to connect with Mega pins 50 - 53.

Adafruit's Sketches:

Adafruit has modified ArduinoISP to give audible indication of programming status. You can add a piezo speaker to the underside of the board.

Adafruit has also modified the Optiboot sketch which will allow you to upload a bootloader or firmware to just about any AVR chip. This process can be done stand-alone, and is very quick if you have a lot of chips to program.

Step 4: Setup Arduino and IDE

If you want to program anything other than the standard bootloaders, you will need to add the appropriate "cores" to the Arduino software:

  1. For a "Breadboard Arduino", which is an Atmega328 running on its internal crystal at 8 MHz, you must install the files from "Breadboard.zip" at http://arduino.cc/en/Tutorial/ArduinoToBreadboard into the "hardware" folder in your Arduino "sketchbook" folder.
  2. For Attiny chips, there are several cores available:
    1. I like Arduino-Tiny core based on work by David A. Mellis, René Bohne, R. Wiersma, Alessandro Saporetti, and Brian Cook because it supports the tone() command if you want to play sounds on a piezo speaker.
    2. If you want to program the Attiny2313, you can use the Attiny core.

 

Setting the settings:

  1. The stock Arduino software comes with the "ArduinoISP" sketch in the "Examples" section. This sketch must be uploaded without the shield in place since the shield has a capacitor to over-ride the reset signal (or you could use a manual reset before upload, like in the old-old days).
  2. With the sketch uploaded, install the shield. You should see the green heart LED begin it's pulsing.
  3. In the IDE, select "Tools" -> "Programmer" -> "Arduino as ISP".
  4. Select the target chip type using "Tools" -> "Boards".
  5. Place the jumper cable between the "ISP" header and the correct header for the chip type.

 

Feel the burn:

Setting fuses is a scary and confusing topic if you look in to it much. Don't bother. They are basically setting that tell the chip how to behave and have to be done only once to a new chip.

  1. Place the chip in the ZIFF socket, all the way to the left, with Pin 1 in the lower-left corner.
  2. With the correct "board" selected for the target chip, select "Tools" -> "Burn Bootloader".
    1. For an Atmega chip going in to a UNO or breadboard, this will set the fuses and upload the correct bootloader.
    2. For an Attiny, this just sets the fuses. For us, this primarily concerns chip speed.

 

Upload a Sketch:

  1. Load the sketch for the target chip. Start with the basic blink "File" -> "Examples" -> "01.Basics" -> "Blink".
  2. Change the "led" variable from "13" to "3".
  3. Click the upload icon, or "File" -> "Upload".
  4. You should see the yellow LED flash and get an "Upload Complete" message.
  5. If all is well, the target chip should start blinking the yellow LED (attached to D3).

If all is well, pat your self on the back and start planning your next project. If not, move to the next step to do some trouble shooting.

Step 5: Shoot the Trouble

Troubleshooting:

Go back and check the following:

  1. "Tools" -> "Serial Port" -> Correct port selected.
  2. ArduinoISP sketch uploaded and green heartbeat beating.
    1. Sometimes the sketch will hang and need a reset.
  3. "Tools" -> "Programmer" -> "Arduino as ISP".
  4. "Tools" -> "Boards" -> target chip selected.
  5. Jumper cable set to correct target ship type.
  6. Target chip in the correct position with pin 1 to the lower left.

We've tried hard to make this as easy and trouble free as possible, but it is still a pretty advance topic as far as life in Arduino Land goes.

  • Have faith you can figure it out.
  • Run through the steps again.
  • Google it.
  • Then ask for help.

Step 6: Some Notes on Attiny Cores

PAGEL and BS2 Warnings:

AVRdude, which is the underlying software for talking to AVR chips generates the following warnings for Attinys:

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny84 
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny84

These warnings can be ignored.


Digital and Analog Pin Numbers:

If you want to engage pullup resistors, and then read an analog value, you need two pin numbers which may or may not match. Take a look at the Attiny85:

// ATMEL ATTINY45 / ARDUINO<br>//
//                           +-\/-+
//  Ain0       (D  5)  PB5  1|    |8   VCC
//  Ain3       (D  3)  PB3  2|    |7   PB2  (D  2)  INT0  Ain1
//  Ain2       (D  4)  PB4  3|    |6   PB1  (D  1)        pwm1
//                     GND  4|    |5   PB0  (D  0)        pwm0
//                           +----+

Note that A3 and D3 are the same, but if you want to engage the internal pull-up resistor on PB2 (physical pin 7), you need the following:

pinMode(2, INPUT);
digitalWrite(2, HIGH); int val = analogRead(1);

A bit confusing. Let me know if you figure out a better way to handle this!


Attiny84 Pin numbers:

Depending on the core you use, the pin numbers are different!

/*
“tiny” CORE, aka  https://code.google.com/p/arduino-tiny/:
Arduino-Tiny is based on work by David A. Mellis, René Bohne, R. Wiersma, Alessandro Saporetti, and Brian Cook. “attiny84at8.name=ATtiny84 @ 8 MHz (internal oscillator; BOD disabled)” ATMEL ATTINY84 / ARDUINO +-\/-+ VCC 1| |14 GND (D 0) PB0 2| |13 AREF (D 10) A0 (D 1) PB1 3| |12 PA1 (D 9) A1 PB3 4| |11 PA2 (D 8) A2 PWM INT0 (D 2) PB2 5| |10 PA3 (D 7) A3 PWM A7 (D 3) PA7 6| |9 PA4 (D 6) A4 PWM A6 (D 4) PA6 7| |8 PA5 (D 5) A5 PWM */
/*
“attiny” CORE aka  https://github.com/damellis/attiny/,  David A. Mellis
“attiny84-8.name=ATtiny84 (internal 8 MHz clock)” 
ATMEL ATTINY84 / ARDUINO
                           +-\/-+
                     VCC  1|    |14  GND
             (D 10)  PB0  2|    |13  AREF (D  0)
             (D  9)  PB1  3|    |12  PA1  (D  1) 
                     PB3  4|    |11  PA2  (D  2) 
  PWM  INT0  (D  8)  PB2  5|    |10  PA3  (D  3) 
  PWM        (D  7)  PA7  6|    |9   PA4  (D  4) 
  PWM        (D  6)  PA6  7|    |8   PA5  (D  5)        PWM
*/

Step 7: Developing Attiny Sketches on Arduino Board

Developing a sketch for an Attiny can be a bit challenging because it is hard to figure out what is occurring on the chip. With Arduino, you can use Serial.print() to get debugging information easily on the console. Since the actual processing under the AVR hood is very similar, shouldn't you be able to write and test something on Arduino, and then upload it to an Attiny?

Yes! Take a look at the following Blink example, which will compile and run for either an Attiny84, Attiny85, or Arduino:

// Use preproccessor commands to determine board type and pin assignments
#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny84__)
  #define ARDUINO 0
  #define led 3
#else 
  #define ARDUINO 1
  #define led 13
#endif

void setup() {                
  pinMode(led, OUTPUT);     
  #if ARDUINO
    Serial.println("I'm an ARDUINO!");
  #endif
}

void loop() {
  digitalWrite(led, HIGH);   
  #if ARDUINO
    Serial.println("LED ON");
  #endif
  delay(1000);               
  digitalWrite(led, LOW);    
  #if ARDUINO
    Serial.println("LED OFF");
  #endif
  delay(1000);               
}
<p>Hi </p><p>I just received my shield. I am able to burn bootloader successfully for ATMega328P-PU , but unable to upload blink sketch to it</p><p>Here is the error i am getting. Can anyone help please??</p><p>Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB<br><br>Sketch uses 1,066 bytes (3%) of program storage space. Maximum is 30,720 bytes.<br>Global variables use 9 bytes of dynamic memory.<br>avrdude: stk500_recv(): programmer is not responding<br>avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xeb<br>avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x1c<br>avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x1c<br>Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.</p>
<p>Thanks guys!</p>
<p>Hey guys, I just purchased this kit with the intentions of being able to easily set fuses. Then I read: &quot;Setting fuses is a scary and confusing topic if you look in to it much. Don't bother.&quot;, which has me a little disappointed.</p><p>Can you please explain to me what would be the best way to get fuse-changing capabilities?</p><p>(In the past I've changed fuses using AVRdude, but I was hoping to have fuses changed all in one go when I burn the bootloader)</p><p>Thanks for all the great work.</p>
<p>AVRdude can be used with the programming shield using the command line. </p><p>With the Arduino IDE, using the &quot;burn bootloader&quot; option, it will automatically set the fuse for the targeted board.</p><p>Let me know if you have a specific chip or options you are going after.</p>
<p>Thanks for the response.</p><p>I spent all day trying to figure this out. (boot-loading w/ my desired fuse values all in one go).</p><p>I ended up using the adaLoader from adafruit, because their code could be modified to allow me to change the fuses, as explained here:</p><p><a href="https://learn.adafruit.com/standalone-avr-chip-programmer?view=all#changing-the-code" rel="nofollow">https://learn.adafruit.com/standalone-avr-chip-pro...</a></p><p>Changing the &quot;pre program fuses&quot; in the images.cpp was easy enough, and since I was testing this bootloader option on the same atmega328P that the adaLoader example uses, I didn't have to modify any of the HEX (for different chips... like I would have to do if I wanted to boot onto the ATtiny's).</p><p>.</p><p>The downside to using the adaLoader seems to be:</p><p>1. You need to flash the host arduino (the arduino under the YAPS shield) for each different model chip or fuse-changes that you want.</p><p>2. You also need to modify the images.cpp code for each different model chip / fuse change. (which means you need to get the ideal HEX for each model chip, format the HEX in the same way as shown in images.cpp, and you need to know the signature bytes of the model chip, and then update the pageBuffer[x] size accordingly. (lots of work, but end result would allow wicked-fast boot-loading that doesn't require a computer for a particular model chip)</p><p>.</p><p>If I wanted to use the method explained in this Instructable, (use the Arduino IDE to burn) then it seems in order to get desired fuse-settings in the same burn-opteration, I would need to (for example) modify the ATmegaBOOT_168_atmega328_pro_8MHz.hex file to burn the fuse values I want. I'm just lost as to where in the HEX file I could find/replace the fuse values. (any idea?)</p><p>.</p><p>I'm not familiar with using AVRdude (it took me much too long just to figure out how to use AVRdude to change fuse settings).</p>
<p>It is important to realize that the bootloader (or &quot;hex&quot;) file is for using the Arduino IDE and typically involves the Atmega 168/328 family chips and allows uploading the compiled sketch (which is also a hex file) through the IDE via USB. The process of burning a bootloader through the IDE both sets the fuses and uploads the bootloader program to the chip.</p><p>For Attiny family chips (Attiny 84, 85), there is no bootloader (unless we start talking about Micronucleus). Using the &quot;burn bootloader&quot; function only sets fuses. The Arduino IDE actually provides an empty &quot;dummy&quot; hex file to allow a similar process as the Atmegas. </p><p>When you &quot;upload using programmer&quot;, the IDE sketch like &quot;blink.ino&quot;, for example, the hex file is directly uploaded to the chip (erasing the bootloader if it exists).</p><p> So, in summary, the programming shield can:</p><p>- Place an UNO bootloader on a chip.</p><p>- Set Attiny fuses (brownout, clockspeed, etc.)</p><p>- Load a sketch directly (without a bootloader).</p><p>If you are trying to do something like put a bootloader on a 328P instead of a 328P-PU try using https://github.com/WestfW/OptiLoader which is like Adafruit's stand-alone loader, but detects the difference.</p>
<p>I ended up asking the question on the Arduino Forum: <a href="http://forum.arduino.cc/index.php?topic=344902.new#new" rel="nofollow">http://forum.arduino.cc/index.php?topic=344902.new...</a></p><p>(in case any future visitors wanted to see if I found a solution)</p>
<p>Thank you MakersBox!</p>
<p>I opted for the kit, everything arrived promptly and was assembeled in about 20 mins.. Thanks Ken!</p>
Look out! The're in the wild!<br><br>Super. Let us know what you make with it!
are all the arduino uno commands and libraries compatible with the attiny? if so i am gonna make it right away.
Not all, but most of the basic commands (from http://highlowtech.org/?p=1695):<br> pinMode()<br> digitalWrite()<br> digitalRead()<br> analogRead()<br> analogWrite()<br> shiftOut()<br> pulseIn()<br> millis()<br> micros()<br> delay()<br> delayMicroseconds()<br> <br> Here is an example of one of my Attiny projects:&nbsp;http://youtu.be/9hu26QAcnC0?t=1m25s
well, thats good enough. i will be making it and will be posting the pictures soon. awesome project. you got my vote!
<p>Looks like a lot of hard work went into this, cant wait to try it out! Its not just another programming shield, its a lot more.</p>

About This Instructable

8,396views

72favorites

License:

More by MakersBox:Compact Fidget Spinner Easy Joule Thief Soldering Project Using an Arduino Drawing Robot with Hour of Code Tutorials 
Add instructable to: