Skip to content

Instantly share code, notes, and snippets.

@kawashimaken
Last active July 14, 2025 01:26
Show Gist options
  • Select an option

  • Save kawashimaken/247b40d24ad4f3604516183d6abb6c02 to your computer and use it in GitHub Desktop.

Select an option

Save kawashimaken/247b40d24ad4f3604516183d6abb6c02 to your computer and use it in GitHub Desktop.

●Shared Steps

install drivers

https://github.com/digistump/DigistumpArduino/releases

Download Tool

Download the latest ARVDude program (for Windows, MacOS or Linux)

https://github.com/avrdudes/avrdude

For Windows user:

  • download avrdude-v8.1-windows-x64.zip
  • unzip to anywhere you like
  • open terminal at the current folder containing your ardude files (avrdude.ext)

Download bootloader

download t85_default.hex from github.com/micronucleus/micronucleus/tree/master/firmware/releases

Put the t85_default.hex file to the same folder of your avrdude folder

Connect Arduino with ATTiny85

Connect Arduino with Badge pins.

Arduino UNO              Badge(ATtiny85)
D10            <--- --->  RESET(PB5)
D11            <--- --->  MOSI(PB0)
D12            <--- --->  MISO(PB1)
D13            <--- --->  SCK(PB2)
GND            <--- --->  GND
5V             <--- --->  VCC

Also refer to this vedio for some connection details : https://www.youtube.com/watch?v=RlscDz5JCcI

Don't forget the 10uF capacitor between Arduino RESET and GND!

Prepare Arduino UNO

Use one Arduino UNO, as an ISP writer. (see the programming part) https://www.youtube.com/watch?v=B5HT5IKcprE&t=402s

  • Remove 10uF capacitor
  • Burning the Arduino ISP program to your Arduino UNO
  • Insert 10uF capacitor
  • Set the programmer to Arduino as ISP from your tool menu.

Find your com port

In my case it is COM10, change according to your environment in the following commands. Burn bootloader In command terminal (In my case, I use Windows)

●Pattern 1 : use the board just like a DigiSpark ATTiny85 board

use micronucleus bootloader, enable the usb to upload program (when operating at 5V)

burn the bootloader first

./avrdude -v -P COM10 -b 19200  -c arduino -p attiny85  -Uflash:w:t85_default.hex:i -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m  

(COM10, change this according to your environment)

remove the wires

Disconnect all the wires for the previous steps.

Steps are as shown in https://www.youtube.com/watch?v=m6aqmjp6AFM

Add board manager to Arduino IDE

Add the board support to the board manager in your Arduino IDE. add the following to your board manager URL in preference

http://drazzy.com/package_drazzy.com_index.json

Then install the board from the board manager "ATTinyCore"

for details, see https://www.youtube.com/watch?v=m6aqmjp6AFM

choose the board as ATTiny85(micronucleus/DigiSpark) , just use it as a DigiSpark ATTiny85 board

Flash program to your badge

Use USB to connect to your PC, and flash the above program.

  • disconnect the board, compile and upload

The program (or any other program):

// 
const int ledPins[] = {0, 1, 2, 3, 4};  // PB0〜PB4 に相当

void setup() {
  // 
  for (int i = 0; i < 5; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
}

void loop() {
  // 
  for (int i = 0; i < 5; i++) {
    digitalWrite(ledPins[i], HIGH);  // LED ON
    delay(200);
    digitalWrite(ledPins[i], LOW);   // LED OFF
    delay(200);
  }
}
  • get the prompt "Please plug in the device (will time out in 60 seconds) ..."
  • connect the badge to usb
  • start uploading the program
  • done!

●Pattern 2 : for 3V coin battery operation

Use an Arduino UNO to upload program via Arduino ISP.

When using this method, you need to upload your program this way, every time, since the bootloader is not functioning at this mode.

compile the program

  • compile your program just as you compile any other program at Arduino IDE

find the .hex file

  • find the .hex file. you can find the log like this, after compiling
Compiling core...
Using precompiled core: C:\Users\demo\AppData\Local\Temp\arduino_cache_671532\core\core_4ef166371ad89eca6e92285427e7dab3.a
Linking everything together...
"C:\\Users\\demo\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=attiny85 -o "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010/simple.ino.elf" "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010\\sketch\\simple.ino.cpp.o" "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010\\libraries\\tinyNeoPixel_Static\\tinyNeoPixel_Static.cpp.o" "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010/..\\arduino_cache_671532\\core\\core_4ef166371ad89eca6e92285427e7dab3.a" "-LC:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010" -lm
"C:\\Users\\demo\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010/simple.ino.elf" "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010/simple.ino.eep"
"C:\\Users\\demo\\Documents\\ArduinoData\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010/simple.ino.elf" "C:\\Users\\demo\\AppData\\Local\\Temp\\arduino_build_599010/simple.ino.hex"

notice there is a line with file extension .hex, this is the file you need. (simple.ino.hex)

burn the program

./avrdude -v -P COM10 -b 19200  -c arduino -p attiny85  -Uflash:w:your_program_compiled.hex:i -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m  

(COM10, change this according to your environment)

References

ATTiny85 datasheet: https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/Atmel-7598_Automotive-Microcontrollers-ATtiny25-45-85_Datasheet.pdf

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