|Atmega8||8 kB||1 kB||512 bytes|
|Atmega168||16 kB||1 kB||512 bytes|
|Atmega328||32 kB||2 kB||1 kB|
Since the three MCUs all have the same pin outs, it is easy to upgrade an older board to use an ATMega328p instead. To upgrade the board to use an ATMega328p you will need
- An ATMega8 or ATMega168 Arduino to upgrade
- An ATMega328P MCU
- A small screw driver
- avrdude (uisp can also be used, but the instructions below use avrdude)
- A stk500 programmer. The instructions below assume that it turns up as /dev/ttyACM0.
Step 1: Swapping MCU
Remove the old MCU
IC orientation tab
Step 2: Setting the fusesThe fuse bits of a MCU control different aspects of how the MCU should behave (for example, if a bootloader should be used or not). The default fuse settings on a brand new ATmega328p are not quite suitable for use in an Arduino board , and will need to be changed. The fuse settings I use are :
- efuse: 0x04
- hfuse: 0xd8
- lfuse: 0xff
avrdude -p ATMEGA328P -P /dev/ttyACM0 -c stk500v2 -t -F -uto go to the terminal mode of avrdude. Set the efuse (extended), hfuse (high) and lfuse (low) with
write efuse 0 0x04 write hfuse 0 0xd8 write lfuse 0 0xffAfter having done this, the new fuse settings can be verified with
dump efuse dump hfuse dump lfuseWhen you are done, exit avrdude with
Step 3: Upload bootloaderThe last step in the upgrade process is to upload the bootloader. Locate the ATmegaBOOT_168_atmega328.hex file (it will be somewhere among the Arduino IDE files, and do
avrdude -c stk500v2 -P /dev/ttyACM0 -F -e -p ATMEGA328P avrdude -c stk500v2 -F -P /dev/ttyACM0 -U flash:w:ATmegaBOOT_168_atmega328.hex -p ATMEGA328Pto upload.
Uploading the bootloader can also be done in the Arduino IDE. Just make sure to pick the correct programmer and MCU type.
There is also a second thing really old Arduinos lack - a way to trigger reset in software. This is convenient since it removes the need to physically press the reset button prior to transferring a new program to the MCU. This can be done by connecting one of the serial control signals of the FTDI chip to reset on the MCU. WARNING: This requires a bit of fiddly soldering! This connection between a serial control signal and reset is already done on all but the oldest Arduino versions, so you probably won't have to mess with it.