loading

Sometimes an Arduino just isn't fit for the job. In times when you need something smaller, simpler, and cheaper, it's best to use an AVR microcontroller. Atmel has a line of Attiny chips that come in various sizes, depending on your needs. The great thing is that they can be programmed using an Arduino as an In-Serial Programmer (ISP) using the already-familiar Arduino IDE.

You Can Program:

  • Attiny25/45/85 (6 I/O lines)
  • Attiny24/44/84 (12 I/O lines)
  • Attiny4313/2313 (15 I/O lines)

Step 1: Prerequisites and Materials

Materials:

  • Arduino Uno
  • ATtiny chip (DIP)
  • Solderless Breadboard
  • Jumper Wires (at least 6)
  • 10uF Capacitor
  • LED (optional)
  • 220 Ohm Resistor (optional)

You should also have the latest version of the Arduino IDE installed. You can download that here.

Step 2: Download Core Files

Download the core files from: https://code.google.com/p/arduino-tiny/

Then extract the zip file to the Hardware folder of your Arduino file system. If you do not have a Hardware folder, create one. Inside you should see files such as "bootloaders", "cores", "license", and a text document called "Prospective boards". Create a new text document and name it "boards". Copy and paste everything in "Prospective boards to your new "boards" document.

Restart the Arduino IDE. Open Tools > Board and you should see a list of new options such as "ATtiny85 @ 8MHz". If you do not, go back to make sure you followed all the steps correctly.

Plug in your Arduino and upload the File > Examples > ArduinoISP sketch. Now you are ready to go!

Step 3: Hook Up the Circuit

Unplug your Arduino and place your Attiny on the breadboard as shown above. Connect jumper wires from your Arduino to the breadboard in the following configuration:

Pin 10 ⟹ RESET
Pin 11 ⟹ MOSI
Pin 12 ⟹ MISO
Pin 13 ⟹ SCK
5V ⟹ VCC
GND ⟹ GND

You may have to look up the pinout of your particular Attiny to locate the RESET, MOSI, MISO, and SCK pins.

Finally, put a 10uF capacitor between GND and RESET of your Arduino (remember to observe polarity). This keeps the Arduino from auto-reseting.

Step 4: Programming

Plug in your Arduino and open the sketch that you want to upload. Select the Attiny that you are using at 1MHz under Tools > Boards. For example, if you are using an ATtiny85, select "ATtiny85 @ 1MHz".

Then select "Arduino as ISP" under Tools > Programmer.

Now you can upload your sketch!

Note: When you upload your sketch, you should get two errors
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
This is normal, so don't worry.

Step 5: Blink Test

To see if everything is up and running smoothly, it's a good idea to give your Attiny a quick test.

Open the "Blink" sketch under File > Examples > Basics. Set the "led" variable to equal 1, and upload the modified sketch to your Attiny.

Once the sketch has finished uploading, you can remove the jumper wires and the Arduino. Attach an LED to pin 1 of your Attiny, with a current limiting resistor. Note that the I/O pin numbers are different than the DIP package pin numbers, and you may have to look up a pinout of your particular Attiny.

Power up the circuit with a pair of AA or AAA batteries. You should see the LED blink on and off every second.

Congratulations! Now you know how to program Attiny chips and implement them in simple projects.

This is the best way to reduce all kind of Arduino projects.
<p>Now that's a cool idea! </p>

About This Instructable

3,329views

64favorites

License:

Bio: Hi! I'm a high-school student who loves building robots, creating circuits, making gadgets, and anything Arduino. I'm also quite fond of geckos.
More by GeckoDiode:Space Invaders Desktop Clock DIY Automatic Shower Timer Program ATtiny Chips with Arduino 
Add instructable to: