Step by step on how to program a ATtiny85 microcontroller with Arduino Uno development board.
Then select Burn Bootloader. This will take the board you selected and look up the associated bootloader in the board.txt file. Next, it will find the bootloader in the bootloader folder and install it. Yes,now you have an Arduino Chip! You can use this for your next standalone Arduino Project, or to make your own little Arduino board. An Arduino Uno/Mega board has two Microcontroller of which one(16u2) is normally used for USB-Serial translation. But we can also use it as standalone AVR Microcontroller with (or without) USB functions as well.
- 284,359 views
- 86 comments
- 222 respects
Components and supplies
| × | 1 | |
| × | 1 | |
| × | 1 | |
| × | 1 |
About this project
I am working on a project which requires reading multiple sensor data on different locations. These require only few PWM pins so using multiple Arduino Uno would be expensive and unnecessary. So I decided to use ATtiny85 microcontroller in place of Arduino Uno development boards. ATtiny85 is a cheap and powerful alternate when u don't need too many PWM pins. Since ATtiny85 is just a microcontroller we need a Arduino Uno to program it. In this project I will explain how to do it. Below is the pin configuration of ATtiny85 and the datasheet can be found here http://www.atmel.com/images/atmel-2586-avr-8-bit-microcontroller-attiny25-attiny45-attiny85_datasheet.pdf.
Configuring Arduino Uno as a ISP (In-System Programming)
To program the ATtiny85 we need to first set Arduino Uno in ISP mode. Connect your Arduino Uno to the PC. Open Arduino IDE and open the ArduinoISP example file (File -> Examples -> ArduinoISP) and upload it.
Adding ATtiny85 Support to Arduino IDE
By default Arduino IDE doesn't support ATtiny85 so we should add ATtiny boards to Arduino IDE. Open File -> Preferences and in the Additional Boards Manager URLs give this url https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json.
After this is done open Tools -> Board -> Board Manager
After opening Board Manager scroll down the list where it says 'attiny by Davis A. Mellis'. Click on that and install it.
After installing now you would be able to see a new entry in the Board menu
Connecting ATtiny85 with Arduino Uno
Now with all the above things ready we will start programming the attiny85. Connect the arduino uno to attiny85 using breadboard as below.
Arduino Uno – ATtiny85
- 5V – Vcc
- Gnd – Gnd
- Pin 13 – Pin 2
- Pin 12 – Pin 1
- Pin 11 – Pin 0
- Pin 10 – Reset
Add a 10uF capacitor between RESET and GND in arduino. This is to avoid arduino from being auto reset when we upload the program to attiny85. If you are using a electrolytic capacitor make sure the anode goes in GND of uno.
Uploading program to ATtiny85
Now back to Arduino IDE. Select ATtiny under Tools -> Board. Then select ATtiny85 under Tools -> Processor. And select 8 MHz (internal) under Tools -> Clock.
Then make sure Arduino as ISP is selected under Tools -> Programmer
By default the ATtiny85 runs at 1MHz. To make it to run at 8MHz select Tools -> Burn Bootloader.
You will get the above message if burning bootloader was successful.
Now open the Blink example from arduino examples and change the pin number from 13 to 0 and upload.
You can see the above message if everything was successful. Now we have upload the blink program to ATtiny85 and now lets test it out.
Testing ATtiny85 Blink
Now its time to test. Remove all connections from Arduino and take a power source. Here I will use a button cell to power ATtiny85.
There it is the blink program running on a ATtiny85 with just a battery cell to power it. You can do many projects with low cost, low power and low space. Only your imagination is the limit here and the number of PWM pins of course.
Making it into a Shield
I converted the above circuit to a shield compatible with Arduino Uno.
(Note: Being a software developer this is my first ever project on electronics. Please give in your suggestions to help me do more.)
Code
Schematics
Author
Arjun Ganesan
![How To Install Boot Loader Arduino Uno Pin How To Install Boot Loader Arduino Uno Pin](http://farm8.staticflickr.com/7447/11147854045_8274abf39c_c.jpg)
- 3 projects
- 112 followers
Published on
June 21, 2015Write a comment
Members who respect this project
and 214 others
See similar projectsyou might like
Table of contents
Write a comment
Bootloader Development
What's a bootloader?
Microcontrollers are usually programmed through a programmer unless you have a piece of firmware in your microcontroller that allows installing new firmware without the need of an external programmer. This is called a bootloader.
Not using a bootloader
If you want to use the full program space (flash) of the chip or avoid the bootloader delay, you can burn your sketches using an external programmer.
Burning the Bootloader
To burn the bootloader, you'll need to buy an AVR-ISP (in-system programmer), USBtinyISP or build a ParallelProgrammer. The programmer should be connected to the ICSP pins (the 2 by 3 pin header) - make sure you plug it in the right way. The board must be powered by an external power supply or the USB port.
Make sure you have the right item selected in the Tools | Board menu. Then, just launch the appropriate command from the Tools > Burn Bootloader menu of the Arduino environment. Burning the bootloader may take 15 seconds or more, so be patient.
Bootloading an Arduino Mini
Here are some instructions on bootloading the Mini, thanks to Gian Pablo Vilamil.
It still doesn't work! (parallel programmer on Windows XP)
Windows XP may be polling your parallel port and disrupting the bootloader burning process. You'll need this registry patch:
See this forum thread for details.
Versions of the bootloader
There are different versions of the bootloader - both in order to work on different hardware and because it has changed over time.
The current bootloaders (i.e. the ones included in Arduino 0009) are almost identical for the Diecimila and NG (with ATmega168). They both run at 19200 baud and take up 2 KB of flash memory on the ATmega168. The only differences is the time the bootloader waits for a new program to arrive and the number of times it flashes the pin 13 LED when it starts. Because of the automatic reset on the Diecimila, its bootloader needs only wait a very short amount of time (less than a second) - to save time, it also flashes the pin 13 LED only once. The NG bootloader waits about 6-8 seconds and flashes the LED three times.
The bootloader that actually shipped on the Arduino NG is slightly different. It enables the internal pullup resistor on pin 6, and doesn't enable the internal pullup on the RX pin. Nor does it timeout upon receiving invalid data, so if you send data to it immediately after it resets, your sketch will never start.
The Arduino BT bootloader does some initial configuration of the bluetooth module.
The ATmega8 bootloader only takes up 1 KB of flash. It does not timeout when it receives invalid data, you need to make sure that no data is sent to the board during the 6-8 seconds when the bootloader is running.
Some ancient versions of the bootloader run at 9600 baud (instead of 19200). In order to successfully upload sketches to boards with this bootloader, you'll need to change the serial.download_rate in your preferences file to 9600.
Third parties have also worked on the bootloader. This page is link to some other bootloader development
How does it work?
The 'Burn Bootloader' commands in the Arduino environment use an open-source tool, avrdude. There are four steps: unlocking the bootloader section of the chip, setting the the fuses on the chip, uploading the bootloader code to the chip, and locking the bootloader section of the chip. These are controlled by a number of preferences in the Arduino preferences file.
For the ATmega8 bootloader, these are:
- bootloader.atmega8.programmer (default value: stk500) is the protocol used by the bootloader.
- bootloader.atmega8.unlock_bits (default value: 0xFF) is the value to write to the ATmega8 lock byte to unlock the bootloader section.
- bootloader.atmega8.high_fuses (default value: 0xca) is the value to write to the high byte of the ATmega8 fuses.
- bootloader.atmega8.low_fuses (default value: 0xdf) is the value to write to the low byte of the ATmega8 fuses.
- bootloader.atmega8.path (default value: bootloader) is the path (relative to the Arduino application directory) containing the precompiled bootloader.
- bootloader.atmega8.file (default value: ATmegaBOOT.hex) is the name of the file containing the precompiled bootloader code (in bootloader.path).
- bootloader.atmega8.lock_bits (default value: 0x0F) is the value to write to the ATmega8 lock byte to lock the bootloader section (so it doesn't get accidently overwritten when you upload a sketch).
For the ATmega168, these are (where <BOARD> is either 'diecimila' or 'ng'):
- bootloader.atmega168-<BOARD>.programmer (default value: avrispmkii) is the protocol used by the bootloader.
- bootloader.atmega168-<BOARD>.unlock_bits (default value: 0x3F) is the value to write to the ATmega168 lock byte to unlock the bootloader section.
- bootloader.atmega168-<BOARD>.extended_fuses (default value: 0x00) is the value to write to the high byte of the ATmega168 fuses.
- bootloader.atmega168-<BOARD>.high_fuses (default value: 0xdd) is the value to write to the high byte of the ATmega168 fuses.
- bootloader.atmega168-<BOARD>.low_fuses (default value: 0xff) is the value to write to the low byte of the ATmega168 fuses.
- bootloader.atmega168-<BOARD>.path (default value: bootloader168) is the path (relative to the Arduino application directory) containing the precompiled bootloader.
- bootloader.atmega168-<BOARD>.file (default value: ATmegaBOOT_168_<BOARD>.hex) is the name of the file containing the precompiled bootloader code (in bootloader.path).
- bootloader.atmega168-<BOARD>.lock_bits (default value: 0x0F) is the value to write to the ATmega168 lock byte to lock the bootloader section (so it doesn't get accidently overwritten when you upload a sketch).
Source Code
The AVR bootloader source code and SAMD bootloader source code are available.