Saturday, January 4, 2014

Setting up the software for using Arduino as the In System Programmer (ISP) to download program onto ATtiny85

Setting up the software for using Arduino as the In System Programmer (ISP) to download program onto ATtiny85

Step0: Install ATTiny Cores
NOTE: This Tutorial assumes Arduino v1.0.x and above has been installed on the computer.
Go to this URL and download this file:  
Extract this file and copy the entire folder to the “hardware” folder of your Arduino installation directory. Note: The following screen is mine and might differ from yours.
Restart the Arduino IDE programming environment. 
Verify the new cores (ATtinyXX series) loaded in Arduino IDE.
Note that there are also other core files for a variety of ATtiny chips loaded e.g ATting85. This page is a good starting point for interfacing with a wide range of the ATtiny or ATtiny85 using the Arduino.

Click on Tools , Board to verify the variety of ATtiny chips.

Programming the ATtinyXX chip with Arduino as the ISP
Note: This is a 1 + N step. Step 1 requires setting up the Arduino as the ISP for the first time progamming of an ATtiny. Step N has to be repeated every time to program an ATtiny. The ATtiny chip has to be placed on the ATtinyXX ISP shield, and then connected to the Arduino. The program will then be downloaded to ATtiny instead of Arduino.

Step1: Setting up Arduino as the ISP
  1. Connect usb cable to Arduino
  2. Go to Tools->Board and make sure Arduino Uno is selected.
  3. Make sure that the correct serial port is selected.
  4. Go to Tools->Programmer -> Arduino as ISP
  5. Go to Examples -> ArduinoISP
  6. Click  to upload the ISP program to the Arduino
  7. Now your arduino is ready to be used to program it's poor cousin, the ATtiny85.

Step N part1: ATtinyXX chip is inserted into ATtinyXX ISP shield; shield is then connected to the Arduino.
  1. Confirm USB cable is unplugged from Arduino when inserting the ISP shield
  2. Align ATtiny85 DIP8 package chip to ATtiny85 ISP shield
  3. Insert ATtiny85 chip firmly onto the ISP shield
  4. Align ISP shield to Arduino
  5. Insert ISP shield firmly onto Arduino
Question: What is the model of the ATtiny chip in the picture above?
Note: ATtiny45/85-PU is 20MHz (with external clock). refer to the datasheet at References.

Click here for highres picture

Step N part 2: Download your programming code to ATtiny85
  1. Confirm chip, shield, and Arduino is plugged into USB.
  2. Select the corresponding code of choice (e.g *.ino) file to be programmed onto the ATtiny85 chip by clicking File-> Open.
  3. Go to Tools -> Board and make sure this time you choose ATtiny85(internal 1 MHz clock)
  4. Click  to upload the program.
  5. Upon success, you should see the message below. Ignore the warnings. The ATtiny chip has been programmed.
  6. Observe the output of the operational ATtiny85 programmed with the code specified.

NOTE: by default ATtiny85 comes with 1MHz clock internal. This clock can be modified to 8MHz internal by the selecting option "Burn Bootloader" while selecting the option "ATtiny85(internal 8MHz clock)". Subsequent programming of ATtiny85 need to choose the board option "ATtiny85(internal 8MHz clock)"

Addendum: Old version of Arduino, e.g Arduino 0022

New ATtiny cores eg ATtiny85 on Arduino 0022

Select ATtiny45-20PU as the board (requires external oscilator to function at 20MHz)

Download RGB LED code to ATtiny45

No comments: