Flash arduino bootloader on fresh Atmega168

I burned one of my MCU so I decided to figure out how to flash the arduino bootloader onto a new Atmega168 I had in stock.

1 Need

  • USBtiny ISP - programmer
  • 10 to 6 pins ribbon cable
  • an atmega168 MCU

2 Flash using arduino IDE

  • for the old IDE, change board in ~/.arduino/preferences to atmega168
  • for the new IDE, set board to "Arduino NG or older w/ Atmega168"
  • change programmer to UsbTinyISP
  • run flash bootloader
  • if it does not work, unplug/replug the board

3 Flash using command line

  • go to the bootloaders folder cd usr/share/arduino/hardware/arduino/bootloaders
  • flash using avrdude sudo avrdude -c usbtiny -p m168 -v -e -U flash:w:optiboot_atmega168.hex