Skip to content

Instantly share code, notes, and snippets.

@ij96
Created November 17, 2019 19:22
Show Gist options
  • Save ij96/804e731bd31dbb95b2b043e93c79ceab to your computer and use it in GitHub Desktop.
Save ij96/804e731bd31dbb95b2b043e93c79ceab to your computer and use it in GitHub Desktop.
Instruction on how to program ATtiny85 via Arduino

How to: program ATtiny85 via Arduino

Configure Arduino as ISP

  • connect Arduino to the PC.
  • open Arduino IDE.
  • open the ArduinoISP example file (File > Examples > ArduinoISP).
  • note: if using Arduino Mega, modify the following lines from:
#define RESET       10
#define PIN_MOSI    11
#define PIN_MISO    12
#define PIN_SCK     13

to:

#define RESET       53
#define PIN_MOSI    51
#define PIN_MISO    50
#define PIN_SCK     52
  • upload sketch.

Add ATtiny board to Arduino IDE

  • go to File > Preferences.
  • in the Additional Boards Manager URLs, add:
http://drazzy.com/package_drazzy.com_index.json
  • go to Tools > Board > Boards Manager.
  • search and install ATTinyCore.

Connect ATtiny to Arduino

  • connect according to the table below:
ATtiny85 pin Arduino Uno pin Arduino Mega pin
VCC 5V 5V
GND GND GND
RESET 10 (SS) 53 (SS)
PIN 0 / MOSI 11 (MOSI) 51 (MOSI)
PIN 1 / MISO 12 (MISO) 50 (MISO)
PIN 2 / SCK 13 (SCK) 52 (SCK)
  • add a 10uF capacitor between RESET and GND on Arduino, to avoid auto-reset while uploading program to ATtiny85.

Upload program to ATtiny85

  • go to Tools > Board.
  • configure as follows:
Board: "AtTiny25/45/85"
Processor: "AtTiny85"
Clock: "Internal 1 MHz"
Programmer: "Arduino as ISP"
  • burn bootloader (Tools > Burn bootloader)
  • upload the following program:
int led = 0;
void setup() {
  pinMode(led, OUTPUT);
}
void loop() {
  digitalWrite(led, HIGH);
  delay(1000);
  digitalWrite(led, LOW);
  delay(1000);
}

Test Blink program

  • remove all connections except for VCC and GND.
  • add a LED between ATtiny pin 0 and GND.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment