Arduino AVR Progamming Shield

download Arduino AVR Progamming Shield

of 12

Transcript of Arduino AVR Progamming Shield

  • 8/10/2019 Arduino AVR Progamming Shield

    1/12

  • 8/10/2019 Arduino AVR Progamming Shield

    2/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

    Intro: Arduino AVR Progamming ShieldDo 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 mucheasier.

    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 ofadvantages. 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 orderpremium. You will also be helping us develop and share other projects!

    Step 1: Gather the PartsTo 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.25eaAdafruit 382 $3.00Sparkfun 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.35eaDigikey 609-2842-ND $0.90Digikey 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):

    http://oshpark.com/shared_projects/pDuEewUMhttps://www.tindie.com/products/MakersBox/avr-programming-arduino-shield/http://wyolum.com/http://makersbox.blogspot.com/2013/12/anatomy-of-small-open-source-hardware.html
  • 8/10/2019 Arduino AVR Progamming Shield

    3/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

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

    Optional (for Optiboot or Adaloader):

    (1) x Piezo BuzzerPS1240Adafruit 160 $1.50Digikey 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 IronWe 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 onthe table, the parts stay in place. Picture numbers correspond to the step numbers:

    Three 330-ohm resistors1.Tactile button2.LEDs:3.

    Long lead is positive. Look for the "+" on the PCB.1.Green -> Heartbeat, Red -> Error, Yellow -> Programming2.

    Solder one lead first, check it is seated correctly, and then solder other lead.4.Capacitor (short lead is negative, look for the "-" on the PCB.5.(2x3) headers:6.

    Use the ribbon crimp connector to hold the header in place.1.Crystal (no polarity, but put the value facing out).7.

    ZIFF connector:8. Solder one pin on each opposite side, check the seating, and then finish.1.Shield headers:9.

    It is easiest to place them in an Arduino first to hold them in alignment.1.

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

    http://www.sparkfun.com/tutorials/213https://www.tindie.com/products/MakersBox/avr-programming-arduino-shield/
  • 8/10/2019 Arduino AVR Progamming Shield

    4/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

  • 8/10/2019 Arduino AVR Progamming Shield

    5/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

  • 8/10/2019 Arduino AVR Progamming Shield

    6/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

    Step 3: Jumper and OptionsThe 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 enough1.pressure to make it lock. Do not use pliers. Use something flat to press down on it.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.2.Crimp the remaining side on and tr im the excess.3.

    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.

    http://learn.adafruit.com/standalone-avr-chip-programmerhttp://learn.adafruit.com/arduino-tips-tricks-and-techniques/arduinoisp
  • 8/10/2019 Arduino AVR Progamming Shield

    7/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

  • 8/10/2019 Arduino AVR Progamming Shield

    8/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

    Step 4: Setup Arduino and IDEIf you want to program anything other than the standard bootloaders, you will need to add the appropriate "cores" to the Arduino software:

    For a "Breadboard Arduino", which is an Atmega328 running on its internal crystal at 8 MHz, you must install the fi les from "Breadboard.zip" at1.http://arduino.cc/en/Tutorial/ArduinoToBreadboard into the "hardware" folder in your Arduino "sketchbook" folder.For Attiny chips, there are several cores available:2.

    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()1.command if you want to play sounds on a piezo speaker.If you want to program the Attiny2313, you can use the Attiny core.2.

    Setting the settings:

    The stock Arduino software comes with the "ArduinoISP" sketch in the "Examples" section. This sketch must be uploaded without the shield in place since th1.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).

    With the sketch uploaded, install the shield. You should see the green heart LED begin it 's pulsing.2. In the IDE, select "Tools" -> "Programmer" -> "Arduino as ISP".3.Select the target chip type using "Tools" -> "Boards".4.Place the jumper cable between the "ISP" header and the correct header for the chip type.5.

    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 onlyonce to a new chip.

    Place the chip in the ZIFF socket, all the way to the left, with Pin 1 in the lower-left corner.1.With the correct "board" selected for the target chip, select "Tools" -> "Burn Bootloader".2.

    For an Atmega chip going in to a UNO or breadboard, this wil l set the fuses and upload the correct bootloader.1.For an Attiny, this just sets the fuses. For us, this primarily concerns chip speed.2.

    Upload a Sketch:

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

    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 TroubleTroubleshooting:

    Go back and check the following:

    "Tools" -> "Serial Port" -> Correct port selected.1.ArduinoISP sketch uploaded and green heartbeat beating.2.

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

    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.

    https://github.com/damellis/attiny/https://code.google.com/p/arduino-tiny/http://arduino.cc/en/Tutorial/ArduinoToBreadboard
  • 8/10/2019 Arduino AVR Progamming Shield

    9/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

    Step 6: Some notes on Attiny coresPAGEL 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 ATtiny84avrdude: 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
    //// +-\/-+// 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. Mellisattiny84-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)

    https://github.com/damellis/attiny/,
  • 8/10/2019 Arduino AVR Progamming Shield

    10/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

    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 BoardDeveloping 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 onArduino, 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);}

  • 8/10/2019 Arduino AVR Progamming Shield

    11/12

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/

    Related Instructables

    How to use

    Arduino ISPShield 2.0(video) bymantaspats

    Turn YourArduino Into anISP by mr_mac3

    Using theArduino Uno toprogramATTINY84-20PUby tsant

    ATtinyProgrammingShield forArduino byPlusea

    Chipper Board -ATtinyProgrammingShield byHammock Boy

    How to fix deadatmega andattiny avr chipsby manekinen

    Advertisements

    Comments

    7 comments Add Comment

    Jamesk9 says: Apr 19, 2014. 10:24 AM REPThank you MakersBox!

    Jamesk9 says: Apr 9, 2014. 1:28 PM REPI opted for the kit, everything arrived promptly and was assembeled in about 20 mins.. Thanks Ken!

    MakersBox says: Apr 9, 2014. 2:08 PM REPLook out! The're in the wild!

    Super. Let us know what you make with it!

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/MakersBox/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/MakersBox/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/Jamesk9/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/Jamesk9/?utm_source=pdf&utm_campaign=commentshttp://cdn.instructables.com/FDR/BOAV/HU6RZHGH/FDRBOAVHU6RZHGH.LARGE.jpghttp://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/Jamesk9/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/Jamesk9/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#commentshttp://www.instructables.com/member/manekinen/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-fix-dead-atmega-and-attiny-avr-chips/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-fix-dead-atmega-and-attiny-avr-chips/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-fix-dead-atmega-and-attiny-avr-chips/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-fix-dead-atmega-and-attiny-avr-chips/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/Hammock%20Boy/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Chipper-Board-ATtiny-Programming-Shield/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Chipper-Board-ATtiny-Programming-Shield/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Chipper-Board-ATtiny-Programming-Shield/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Chipper-Board-ATtiny-Programming-Shield/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Chipper-Board-ATtiny-Programming-Shield/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/Plusea/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/ATtiny-Programming-Shield-for-Arduino-1/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/ATtiny-Programming-Shield-for-Arduino-1/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/ATtiny-Programming-Shield-for-Arduino-1/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/ATtiny-Programming-Shield-for-Arduino-1/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/ATtiny-Programming-Shield-for-Arduino-1/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/tsant/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Using-the-Arduino-Uno-to-program-ATTINY84-20PU/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/mr_mac3/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Turn-Your-Arduino-Into-an-ISP/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Turn-Your-Arduino-Into-an-ISP/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Turn-Your-Arduino-Into-an-ISP/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/Turn-Your-Arduino-Into-an-ISP/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/member/mantaspats/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-use-Arduino-ISP-Shield-20/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-use-Arduino-ISP-Shield-20/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-use-Arduino-ISP-Shield-20/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-use-Arduino-ISP-Shield-20/?utm_source=pdf&utm_campaign=relatedhttp://www.instructables.com/id/How-to-use-Arduino-ISP-Shield-20/?utm_source=pdf&utm_campaign=related
  • 8/10/2019 Arduino AVR Progamming Shield

    12/12

    h bl d d h ld

    mikes50 says: Apr 8, 2014. 12:09 PM REPare all the arduino uno commands and libraries compatible with the attiny? if so i am gonna make it r ight away.

    MakersBox says: Apr 8, 2014. 1:21 PM REPNot all, but most of the basic commands (from http://highlowtech.org/?p=1695):pinMode()digitalWrite()digitalRead()analogRead()analogWrite()shiftOut()

    pulseIn()millis()micros()delay()delayMicroseconds()

    Here is an example of one of my Attiny projects: http://youtu.be/9hu26QAcnC0?t=1m25s

    mikes50 says: Apr 8, 2014. 8:56 PM REPwell, thats good enough. i will be making it and will be posting the pictures soon. awesome project. you got my vote!

    Jamesk9 says: Apr 3, 2014. 7:32 PM REPLooks 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.

    http://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/Jamesk9/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/Jamesk9/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/mikes50/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/mikes50/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/MakersBox/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/MakersBox/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/id/Arduino-AVR-Progamming-Shield/?utm_source=pdf&utm_campaign=comments#DISCUSShttp://www.instructables.com/member/mikes50/?utm_source=pdf&utm_campaign=commentshttp://www.instructables.com/member/mikes50/?utm_source=pdf&utm_campaign=comments