How to program ATTiny85 with Arduino Uno (part 2)
This is the second part of the tutorial on how to program an AVR ATTiny85 chip with Arduino Uno. All the hard work has already been covered in Part 1, so make sure that you have completed the steps in that section before you continue!
By default, the ATtiny85 runs at 1 MHz. You need to do an extra step to configure the microcontroller to run at 8 MHz. This is a requirement for using some popular libraries (like Software Serial), as well as to take full advantage of your chip. Here is what you need to do:
- Make sure you have the ATTiny85 chip connected to the Arduino and ready for programming, as per the diagram in Part 1
- Open the Arduino IDE and go to “Tools” -> “Board” and select the option “ATTiny85 (internal 8 MHz clock)”.
- Go to “Tools” again and select the option “Burn Bootloader”.
- You should see a message saying “Done burning bootloader.” You may get an error “avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85”. You can ignore it for now.
Setting up ATTiny85 with servos
Unfortunately, the very useful Arduino Servo library does not work with the ATTiny85 chip. Luckily, we can use the good old SoftwareServo library instead. The ArduinoSoftware serial library needs to be updated to work with the Arduino version 1.0.1 and above as follows:
- Get the Arduino SoftwareServo library
- Open the file “SoftwareServo.h” from the library folder and change: