Tuesday 23 May 2017

Training Tuesday #4 Progarm an attiny

welcome to this Training Tuesday this week I thought I would share how to program an AT tiny using an Arduino board hopefully  you will find this helpful .

Getting started 

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



By default the Arduino IDE does not support the ATtiny85 it's required to add support for the Attiny85 to the Arduino Board Manager:
From the Arduino IDE Go to Arduino->Preferences then scroll down to Additional Board Managers URLs
Copy & paste the following (if you already have a board manager URL just add a comma before pasting)


https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
Press ok  at

the bottom then restart the Arduino IDE

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.


prep the Arduino


what we want is to be able to program the ATtiny85 from the Arduino IDE which requires to burn the bootloader to the ATtiny85 we will need to prep the Arduino fist by uploading the ISP sketch to it.

In the Arduino IDE select File-->Examples--> 11. Arduino ISP-->ArduinoISP

the ISP sketch should open and upload it to your Arduino 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.  if burning bootloader was successful you will see a message on the screen.

Now open the Blink example from arduino examples and change the pin number from 13 to 0 and upload.

Now its time to test. Remove all connections from Arduino and take a power source. Here I will use a 3volt battery holder to power ATtiny85

There it is the blink program running on a ATtiny85 with just a battery to power it. You can do many projects with low cost, low power and low space. Only your imagination is the limit here.

hope you found this helpful see you tomorrow for What's in the postbox
Dobby


No comments:

Post a Comment

dobby repairs

Hi everyone I know that I haven't posted on here for quite some time  I probably won't be posting on here again for a while but I wa...

Total Pageviews