Arduino and ATtiny

Lets play with the ATtiny! An IC from the family of Atmel’s AVR microcontroller. This will be a start to the many exciting projects to come, as microcontrollers are, without a doubt, amazing little things. Tricky to program, but are versatile, powerful and extremely tiny. We will start by showing how to use the Arduino to load programs onto the ATtiny.

The Arduino we have uses an ATmega 328 AVR microcontroller to provide a great and easy to use, hardware and software platform. But for projects that require compactness, low-cost and stand-alone characteristics, a microcontroller is the way to go. Unlike Arduino that comes with a USB port for “plug-and-play” capabilities, the ATtiny is just an IC by itself. It requires a piece of programmer hardware with USB port to interface with the laptop. Fortunately, the Arduino can be configured as an ISP (in-system programmer) to load programs onto the ATtiny. In fact, the ATtiny 44/45/84/85 can all be programmed with the Arduino (Atmega 328). However, there are some limitations to be noted:

  1. Number of I/O pins: The Atmega 328 is a 28 pin chip, the ATtiny 45 and 85 are 8 pin chips, and the ATtiny 44 and 84 are 14 pin chips. Therefore, this can limit the complexity of the hardware.
  2. Flash Memory: The Atmega 328 has 32 KB, the ATtiny 45 has 4 kB, and the ATtiny 85 has 8 KB. Therefore, this can limit the size of the software.
  3. RAM: The Atmega 328 has 2 KB, the ATtiny 45 has 256 bytes, and the ATtiny 85 has 512 bytes. Therefore, this can limit the size of the data received.
  4. Arduino Functions Available: There are only a limited commands supported, see here.

step1_a

step2_b

Schematic:

Step2_a.jpg

  • The diagram provided is only an initial circuit illustration. Additional components (i.e.: capacitor and LED) will be appended.
  • 10 uF capacitor: between reset and ground pin of the Arduino. This prevents resetting, which starts the bootloader. The capacitor ensures the Arduino IDE talks to the ArduinoISP, not the bootloader, during the upload of sketches.
  • LED and resistor: between ATtiny pin 0 and ground.

Config Arduino as ISP:

  1. Make sure the correct Arduino and COM port are correctly selected, and indicated on the display in the bottom right of the Arduino window.
  2. Arduino > File > Example > Open Arduino as ISP sketch > Upload sketch.
  3. Place filter capacitor between Arduino Reset pin and ground pin.
  4. Download the attiny45_85.zip files here.
  5. Arduino > File > Preferences > Change sketchbook location to where the downloaded ATtiny files will be saved.
  6. In the sketchbook folder > Create new folder called Hardware > Unzip attiny45_85.zip.
  7. Close and restart Arduino.
  8. Arduino > Tools > Board > ATtiny 85 > Clock: Internal 8 MHz > Arduino as ISP .
  9. Place resistor and LED at ATtiny pin 0 to ground.
  10. Arduino > Example > Basics > Blink > Change all Pin 13 to Pin 0 > Upload.
  11. The LED should blink at the rate it is set at.

Testing:

The Arduino is now ready to program the ATtiny. The ATtiny is used to blink 2 single LEDS

step4_b