Week 3

Programming the Attiny with the Arduino

AATtiny85 is smallest microcontroller in ATMEL’s AVR family having less number of pins. It has 8 pins in total in which 6 pins are for programmable Input/Output. It was developed for low power applications such as (battery operated applications).
Before we can program the Attiny85 we need to set the Arduino Uni in ISP mode. In the picture below you can see how to do it.
Arduino IDE didn’t support ATtiny85 so we had to add ATtiny boards to Arduino IDE.
To do this go to File/Preferences and copy the following link:
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Then go to the Board manager and find the Attiny and install it. You can then see it in the end of the list.
The next step is to connect the Attiny to the Arduino using the breadboard. Keep in mind that you connect it correct. (HOW TO CONNECT)
Choose the correct processor, clock and programmer.
When everything is correct you have to Burn Bootloader.
The next step is to create your code. We coded the melody for our card and the blinking LED.
Open a new toneMelody window and delet everything that is already in there and paste your code.
Then change the pins for the LED and the speaker for those you are going to use.
I used the Melody of Jingle Bells. You can see the code here.
Connect your LED and your speaker to your Attiny to be able to see your result. I connected the LED to the pin 3 and the speaker to pin 4. Don’t forget to put a resistor for your LED!
Verify your code. If everything is fine, connect your Arduino to your computer and upload the code to the Attiny.
IMPORTANT! Do not upload it with the upload button. Otherwise you have to reconnect your Attiny and your Breadboard.
Upload it using this path: Sketch/Upload Using Programmer