Skip to content

Instantly share code, notes, and snippets.

@MarcosYonamine963
Last active January 5, 2024 17:04
Show Gist options
  • Save MarcosYonamine963/b8ca19667ada640c18193f8fc0057c47 to your computer and use it in GitHub Desktop.
Save MarcosYonamine963/b8ca19667ada640c18193f8fc0057c47 to your computer and use it in GitHub Desktop.
Flash ATtiny with Arduino

ATtiny85 Board Pinout

a

Chip Pin PB Func ADC Digital PWM ExtI USB
1 PB5 Reset ADC1 D5 (A0) - - -
2 PB3 Xtal1 ADC3 D3 (A3) - - USB+
3 PB4 Xtal2 ADC2 D4 (A2) PWM4 - USB-
4 - GND - - - - -
5 PB0 MOSI/SDA D0 PWM0 - -
6 PB1 MISO D1 PWM1 - -
7 PB2 SCL/SCK D2 (A1) - INT0 -
8 - VCC - - - - -

Configure Arduino IDE

  • Open Arduino IDE, go to File > Preferences

In Additional Board Manager URLs, Copy/Paste this:

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

Click OK.

  • Go to Tools > Board > Boards Manager

Search and install attiny by David A. Mellis

Upload ArduinoISP on Arduino UNO, Mega, Nano or other compatible

  • On Arduino IDE, go to: File > Examples > 11.ArduinoISP > ArduinoISP

  • Go to Tools and configure Board, Processor and Port.

For example, I'm using Arduino Mega, Processor ATmega2560, Port ACM0 (linux).

Upload the sketch.

Setup wiring

  • Capacitor on Arduino

Connect a 10uF Capacitor between Reset and GND on the Arduino

  • ATtiny and Arduino wiring
Arduino Function ATtiny Chip pin ATtiny PB
10 Reset 1 PB5
11 MOSI 5 PB0
12 MISO 6 PB1
13 SCK 7 PB2
VCC VCC 8 5V or VIN
GND GND 4 GND

Flash ATtiny using Arduino as ISP

  • Open a sketch for ATtiny.

Ex: Go to File > Examples > 01.Basics > Blink

Then, on Tools, configure Board, Processor and the port must be the same as connected Arduino.

  • Select Tools > Programmer > Arduino as ISP

  • To flash on ATtiny, go to Sketch > Upload Using Programmer

Datasheet

AtTiny85 Datasheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment