Programming an ATtiny Processor the Arduino Way

This is a tutorial about programming an Atmel ATtiny processor using the Arduino IDE and an Arduino compatible board as a programmer.  Before trying to program an ATtiny processor, you should first be comfortable programming your Arduino board.  You should be comfortable working through any of the tutorials available from these sites…

Configure the IDE

This section describes how to prepare the Arduino IDE for programming ATtiny processors.

Which Core

In order to program ATtiny processors, a “core” must be added to the Arduino IDE.  A core is a collection of source files that implements the Arduino (Wiring) API.  The core used in this tutorial is available here… http://code.google.com/p/arduino-tiny/.

Locating the Sketchbook Directory

The Arduino IDE always stores sketches (programs) in the same directory.  This directory is called the sketchbook directory.  The core is installed in the hardware directory under the sketchbook directory.  If you do not know the location of the sketchbook directory it can be determined by…

  • Start the Arduino IDE
  • Click the menu item File then Preferences
  • The sketchbook directory is the first item on the dialog box.  Make note of this location.
  • Click Cancel to close the Preferences dialog box

Ensure the Arduino IDE is not running.  The IDE must be restarted to recognize the new core so it may as well not be running while the core is installed.

Navigate to the Arduino Tiny site and download the latest version.  Cores from the Arduiny Tiny site are always a ZIP file whose name has the pattern arduino-tiny-0100-0015.zip.  The first number (0100) corresponds to the IDE version and the second number (0015) is the core revision.  The Download the latest version for Arduino link on the homepage always leads to the latest version.

Using your favourite file-system explorer, navigate to the sketchbook directory.  If the hardware sub-directory does not exist, create it.

Connections

To program a target processor, connect MISO to MISO, MOSI to MOSI, SCK to SCK, and SS (on the programmer) to RESET (on the target). Refer to the target processor’s datasheet for details or use the table below if an Arduino Uno is being used as the programmer.

The following make the circuit more stable and are highly recommended…

  • 0.1 uF bypass capacitor from VCC to GND as close to the target as possible
  • 10K ohm pull-up resistor from RESET to VCC

 

Leave a Reply