ATtiny85 Programming with Arduino : LED Blink tutorial

If you are new to the ATtiny85 microcontroller, here's a quick guide to get you started blinking a LED with ATtiny85.

Required Tools:

  • ATtiny85 Microcontroller
  • Arduino Uno (as ISP Programmer)
  • Breadboard and Jumper Wires
  • USBasp Programmer (Optional)
  • Arduino IDE

Programming Steps:

1. Setup Arduino IDE:

Install the ATtiny85 board package by navigating to File > Preferences, and adding the following URL to Additional Board Manager URLs:

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
  • Go to Tools > Board > Board Manager and search for ATtiny. Install the package.
2. Upload Bootloader (Optional):
  • Connect the ATtiny85 to the Arduino Uno for programming as shown in the circuit diagram below.

 

Programming ATtiny85 with Arduino Uno
ATtiny85 Pin | Arduino Uno Pin
-------------|-------------
1 (RESET)    | 10
5 (MOSI)     | 11
6 (MISO)     | 12
7 (SCK)      | 13

Don't forget to connect the ATtiny85 ground to Arduino Uno ground, and the ATtiny85 Vcc to Arduino Uno Vcc.

  •  Select Arduino as ISP from Tools > Programmer.
  • Choose the ATtiny85 board and 8 MHz internal clock.
  • Click Burn Bootloader to prepare the chip.

3. Write and Upload Code:

  • Use the Arduino IDE to write your code.
  • Select the appropriate board settings.
  • Upload the code using the Arduino as ISP setup.

Here's a simple example code to blink an LED connected to the ATtiny85:

void setup() {
pinMode(0, OUTPUT); // Set pin 0 as output
}

void loop() {
digitalWrite(0, HIGH); // Turn LED on
delay(1000); // Wait for 1 second
digitalWrite(0, LOW); // Turn LED off
delay(1000); // Wait for 1 second
}

Conclusion

The ATtiny85's combination of affordability, versatility, and community support makes it a go-to choice for many electronics projects. Whether you're a beginner looking to learn about microcontrollers or an experienced maker building complex systems, the ATtiny85 offers a robust platform to explore and create innovative solutions.

If you have any specific questions or need further information about the ATtiny85, feel free to ask!

Post a Comment

Previous Post Next Post