I was in need of learning how to program ATtiny microcontrollers and more specifically ATtiny85 for a project work using Arduino IDE. There are different programmer boards available to program ATtiny85 chips in the market. Among those different methods, one nice way of doing it is using an Arduino board as an ISP (in-system programming) device. After doing some searches on the web, I tried it yesterday. I'm writing down the steps I followed to program an ATtiny85 chip with a simple LED blink program using Arduino as ISP. I tried it on an Ubuntu 12.04 LTS system and used an Arduino Uno board as the supporting hardware for the ISP programming task.
Turn the Arduino board into an ISP programmer:
(1) I used Arduino IDE 1.0.5 version since 1.0 version which I had initially didn't work as I expected. Arduino IDE 1.0.5 version can be downloaded from the link and start it.
(2) Open the ArduinoISP program from the Examples and program it into an Arduino Uno board. Now our Arduino Uno board is ready as an ISP programmer.
Programming ATtiny using Arduino board:
(1) Download the master branch of this attiny project as a ZIP file from GitHub which is available in this link. I forked it for my future use which is available in this link.
(2) Create a new directory called hardware inside my sketchbook directory inside home directory.
(3) Unzip the downloaded attiny project ZIP file and copy the attiny directory into the hardware directory which we just created inside sketchbook.
(4) Start Arduino IDE and goto the Tool->Board menu where we should see the ATtiny chips now appear as boards.
(5) Connect Arduino Uno board with the ATtiny85 chip through a breadboard as shown in the following figure. We need a 10uF capacitor in addition to the breadboard and jumper wires to complete this task. Pay close attention to the correct pin connectivity.
(Image source: http://highlowtech.org/?p=1706) |
(6) Open the Blink example which is available in the Arduino IDE and change the blinking pin from 13 to 0. Select the ATtiny85 board and Arduino as ISP options from the Tools menu. Now program the Blink application. When we say Pin 0 in Arduino IDE, what we actually mean is the physical pin 5 on ATtiny85 MCU. Refer to the following figure to understand the pin numbering convention between Arduino boards and ATtiny85 MCUs.
(7) After programming the Blink application, connect an LED in series with a resister (I used a 1kΩ resister) between the ATtiny85 MCU's physical pin 5 and GND to see it blinking by the program running on ATtiny85 chip.
References:
[1] http://highlowtech.org/?p=1706
[2] http://highlowtech.org/?p=1695
[3] http://www.instructables.com/id/Program-an-ATtiny-with-Arduino/?ALLSTEPS
Click on image to enlarge. (image source: http://www.pighixxx.com/) |
(7) After programming the Blink application, connect an LED in series with a resister (I used a 1kΩ resister) between the ATtiny85 MCU's physical pin 5 and GND to see it blinking by the program running on ATtiny85 chip.
References:
[1] http://highlowtech.org/?p=1706
[2] http://highlowtech.org/?p=1695
[3] http://www.instructables.com/id/Program-an-ATtiny-with-Arduino/?ALLSTEPS
No comments:
Post a Comment