ATtiny85 Arduino Board: How to Flash the Arduino Bootloader and Run A Simple Sketch

Figure 1: ATtiny85 next to a standard LED.

Figure 1: ATtiny85 next to a standard LED.

The ATtiny family unit is a series of tiny microcontrollers capable of utilizing many of the libraries available on the Arduino platform. The ATtiny85 is used here because of its small contour and widespread availability. Information technology is an eight-pin, eight-bit, AVR microcontroller that can run the Arduino bootloader with a few modifications. 1 user created an entire board amending that makes burning the bootloader even easier (come across below). Several tutorials exist on using the ATtiny with Arduino, and I will be using them as guides to provide an updated and simplified method for flashing the Arduino bootloader onto the ATtiny85 using an Arduino Uno (example 1: High-Low Tech [link]; example ii: J3 on Medium [link]). The ATiny85 datasheet can be constitute [here], but a few of its bones features include:

  • 10-fleck ADC

  • 4 Possible Analog Inputs

  • 6 Possible Digital Pins

  • 2.7-5.5V Tolerance

  • 5mA, i.2mA, 10uA Agile/Idle/Power Down Current Consumption (8MHz)

  • Serial Interface

  • Interrupt Capabilities

  • Internal Crystal Oscillators (1MHz, 8MHz)

A pinout of the ATtiny is shown below with common Arduino pin options:

Effigy 2: Pinout showing the capabilities of each pin on the ATtiny85 [source].

PARTS LIST:

  1. ATtiny85 - $6.fifty [Our Store]

  2. Arduino Uno - $xiii.00 [Our Store]

  3. Breadboard - $nine.99 (pack of 6) [Amazon]

  4. Electrolytic Capacitor (10uF) - $10.99 (pack of 200) [Amazon]

  5. Jumper Wires - $1.50 (10 pcs) [Our Store]

  6. LEDs - $7.95 (pack of 100) [Amazon]

Downloading and Installing Package for ATtiny

The outset affair needed to program the ATtiny as an Arduino is the ATtiny package from David A. Mellis (GitHub). Showtime, we need add the ATtiny package to the boards manager URL list:

boards_manager_link.png

Stride one: Add ATtiny URL

Add ATtiny Bundle link [hither] from David A. Mellis to Boards Manager

attiny_boards_manager.png

Step 2: Download from Boards Manager

Tools ->Board -> Boards Manager -> Type: 'attiny' -> Install

Preparing Arduino Uno to Burn Bootloader onto ATtiny85

At present that we have downloaded the ATtiny package, we can prepare the Arduino Uno board for In-System Programming (Isp). To practice this, we must first upload the 'ArduinoISP' sketch to the Uno lath (before wiring anything to it). This tin can exist washed the following way:

arduino_ISP.png

Step 3: Upload 'ArduinoISP' Sketch to Uno Lath

Examples -> ArduinoISP -> ArduinoISP -> Upload

Wiring and Burning Bootloader to ATtiny

The ATtiny85 should be wired to the Uno as follows:

The capacitor prevents the Uno from resetting when avrdude opens the series port as part of its auto-reset feature during each upload. The car-reset is disabled to allow the programmer to access the ArduinoISP sketch on the Uno board, which ultimately resets the ATtiny fuses and allows the board to be programmed via its serial port (Thanks to Gene Pavlovsky in the comments for pointing this out). Hither I use a 10uF capacitor. Before Burning the bootloader, be sure to configure the ATtiny85 to run with its 8MHz internal clock, and verify that the Developer being used is 'Arduino as Internet access provider':

arduino_as_ISP.png

Pace iv: Arduino every bit ISP

Choose 'Arduino as Internet service provider' as the programmer prior to burning the Arduino bootloader onto the ATtiny

select_attiny85_board.png

Footstep v: Select ATtiny85

attiny_board_properties.png

Stride 6: Verify Lath Properties

Clock: 'Internal 8 MHz', Processor: 'ATtiny85', Programmer: 'Arduino as ISP'

burn_attiny_bootloader.png

Footstep 7: Burn Bootloader!

ATtiny as Arduino Board

At this point, nosotros at present accept an 8MHz Arduino board with several output pins. The ATtiny85 can run on 2.7-5.5V without a regulator - so a 3.7V LiPo can power the board and brand a cheap, effective, slim Arduino board. The best way to verify that the ATtiny Arduino is working properly is to upload a simple sketch. I supplied a simple blink sketch hither to be used with pin 4 on the ATtiny. If you are able to upload the sketch to the ATtiny85 (using the Uno board and the 'Arduino as ISP' programmer and wiring) - so you lot have a fully-functional Arduino ATtiny85! From here, the possibilities are nearly identical to the ATmega328p, with the exception of fewer ports and some limitations. Withal, the ATtiny Arduino is fully capable of treatment analog read and writing, digital reading and writing, UART advice, power-downwards modes, SPI-interface, interrupt capabilities - many of the features of a standard Arduino board.

                      //ATtiny85 Blink Sketch for Testing Bootloader                      int                      led_pin                      =                      4;                      void                      setup() {   pinMode(led_pin,OUTPUT); }                      void                      loop(){   digitalWrite(led_pin,HIGH);   delay(1000);   digitalWrite(led_pin,LOW);   delay(yard); }                    

Conclusion

attiny85_conclusion.png

In this short tutorial I showed how to use an Arduino Uno to fire the Arduino bootloader onto an ATtiny85 to create a tiny, efficient, and capable electronics lath. Using an ATtiny with the Arduino bootloader opens up the world of micro-electronics to makers that are already familiar with the Arduino platform, simply want to migrate away from the ATmega328p lath. The ATtiny85 is tiny, but is versatile and powerful plenty to handle multiple digital and analog inputs and outputs, and able to apply many of the familiar libraries that are available to Arduino. The ATtiny is a great board to outset creating Internet of Things projects and other small, low-ability, embedded projects.

Electronics, Programming, Arduino

ATtiny85, ATtiny, Arduino, Arduino Uno, Arduino IDE, ATmega, microcontroller, ADC, Wink, Pinout, Bootloader, Blink