Apr 04

Bootloading an ATmega88 for Arduino [w/ code]

Just wanted to put up a small tut on how to put an Arduino bootloader on an ATmega88.

I very roughly followed: 
http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard (Although they make it way too complicated)
And ATMEL's datasheet for ATmega88 is also very good to have open at all times: 

First, put everything on a breadboard: (This took me a while... Thanks D.Mellis and M.Feldmeier!!)

(Fritzing is awesome)


  • when programming with the AVR ISP mkII, disconnect the LED because it shorts to ground.
  • Make sure you remember the pullup resistor on the RESET so that the signal is pulled nice and high (Thanks B.Melton!),
  • and also the 0.1uF capacitor for the USB FTDI programmer so that the short burst of RESET becomes a good long signal so the chip will be happy.

Now, we need to understand the fuses on the chip so it will:

  • Fire the bootloader after RESET (BOOTRST fuse)
  • Set the bootloader section size to 1024 words (2048 bytes), because the compiled bootloader is ~1400 bytes (BOOTSZ0 & BOOTSZ1)
  • Enable SPI programming, of course, we don't want to brick the chip (SPIEN)
  • Set the clock to the internal 8Mhz clock, since wee don't use an external one

To get values for the fuses: http://www.engbedded.com/fusecalc/

I ended up using:

EFUSE = 0x00
LFUSE = 0xe2
HFUSE = 0xdf

Rewriting and burning the bootloader

Next step is to write the bootloader code. I borrowed Arduino 1.0's ATmegaBOOT_168.c, which has all the setup already in there, but it doesn't support ATmega88... some changes were needed.

But you guys can get the final product: 
You can also just get the .hex file and burn right away! 
To build it I also borrowed Arduino's Makefile, but it also needed some tweakin': 
(Take a special look at "LDSECTION = --section-start=.text=0x1800" because it holds the key to putting the bootloader in the right spot on the flash memory. I worked according to the datasheet, look under Table 26-9 page 281)

But then - a moment came where something started working... the AVR ISP mkII was no longer complaining it can't talk to the chip and burned the bootloader!!

Making Arduino happy

OK bootloader is burnt on the chip, now I had to configure Arduino to work nicely with ATmega88.
I tweaked $(ARDUINO)/hardware/arduino/boards.txt to add this:





Now Arduino sees it under Tools -> Board -> ATmega88
Also, remember to put the bootloader hex file under: $(ARDUINO)/hardware/arduino/bootloaders/atmega88/ATmegaBOOT_88_m88.hex

At this point you should be able to upload Arduino sketches to your ATmega88 chip.
The first sketch that uploaded successfully - was like a wonderful mermaid song to me :)

Get all the code


To program via USB I use: 

I used this guide roughly to setup Arduino app to "understand" ATmega88: 

This is also helpful: 

(We have a new category now in MTT - "electronics"! I hope to share some interesting stuff in it soon...)

Keep hacking, and share your knowledge,


  • https://wk3.org/u/moon moony


    I got pretty far: bootloader is on the Atmega88, changed code in arduino-devices, Arduino finds the board "Atmega88". But when I try to program, it says my serial-port ttyACM0 is already in use. That can't be true.. Any Idea?

    Cool project anyway :)

  • https://wk3.org/u/moon moony

    Hey you definetely got the Tx and Rx lines wrong, maybe more. Looks like, you placed the Atmega upside down..

  • Hasan

    avrdude: Expected signature for ATMEGA88 is 1E 93 0A
    Double check chip, or use -F to override this check.

    This error ?

  • lucas

    Hi! i'm trying to do this with an Atmega88-pa.
    Do you have any .hex for this mcu?
    I'm using a FTDI chip to link my mcu with my win pc, is there any code diference?

  • Mike

    Agreed with earlier - the chip is the wrong way round. Also, no current limiting resistor on the LED

  • Eugene

    avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0xfc
    avrdude: stk500_cmd(): protocol error



  • Pingback: Minimal Arduino using an ATmega88 | hackup.net()

  • http://www.logview.info Dominik Schmidt

    Hi !

    There is an error in your boards.txt extension ...
    If you set the efuse to 00h this results in a boot size of 1024 WORDS - not 1024 Bytes.

    The mega88 has 8k Flash = 8192 Bytes.
    So this line is def. wrong:

    Change the line to

    Now the bootloader wont override the flash ... I hade this several times and wonder why my sketch won´t run. The drawback is that you have 1k less flash. Now my mega88 is to small for my sketch ...

    Anyway. You should fix this !


  • Pingback: Cómo conseguir un “Arduino” Gratis | Aprendiendo Arduino()