copying chips

Hay all, So i have an old project that has a very intricate code and tbh it would take me ages to rewrite is there any way of copying the chips to save myself a lot of hassle. im using the atmega328 chip

Which microcontroller does it use?

For the Arduino UNO, MEGA, Nano, Micro, Leonardo... those that use the ATmega 'avr' processors, you can read out the memory (FLASH and EEPROM) using an ISP device and the "avrdude" program that comes with the Arduino IDE. You can put the binary into a .hex file and use 'avrdude' and the ISP device to write the data to a new processor.

You can get a USBasp device for under $5 from eBay. Most come with only a 10-pin cable and the Arduinos use a 6-pin cable so be sure to get an adapter. It will take a while if the device is coming from Asia so order early or pay more for one that is already in your country.

Thank you for your help with this, Ive tried to run avrdude but for some reason its asking for a libusb.0dll so i installed it and its still not working, so i managed to find avrdudess and that seems to work can i use this or does it have to be avrdude.

I've never used it, but I'm sure you can use avrdudess.

If you decide you still want to use avrdude, the Arduino IDE comes with a copy of avrdude. I'm guessing you are using a copy of avrdude you found somewhere online. If so, there is a good chance Arduino's avrdude won't have this problem. Here are the instructions in case they might be useful:


First, we’re going to do a dummy upload in the Arduino IDE in order to get it to help us generate the avrdude command used to read the program from the Arduino board:

Plug your Arduino board into your computer.

Select your board from the Arduino IDE’s Tools > Board menu.

Select your board’s port from the Tools > Port menu.

VERY IMPORTANT: Unplug your board from your computer.

File > Preferences

Check the box next to “Show verbose output during > upload”.

Click “OK”.

Sketch > Upload

Wait for the upload to fail.

Scroll up the black console window at the bottom of the Arduino IDE window until you see the avrdude command that was generated for the upload. It will look something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

Select the full text of the upload command.

Press Ctrl + C. This will copy the upload command to the clipboard.

Next, you need to modify the upload command to read the hex file out of your Arduino board:

Start a text editor program.

In the text editor window, press Ctrl + V. This will paste the command into the text editor. The end of the command will look something like this:

-D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

That is the part of the command that tells it to write.

Replace that part of the command with the command that tells AVRDUDE to read:

-Uflash:r:readfile.hex:i

That will cause the read file to be named “readfile.hex”, which will be saved to whichever folder you run the command from. So now the full command looks something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:r:readfile.hex:i

If the paths in the command contain spaces, wrap the paths in quotes.

Plug your Arduino board into your computer.

Copy and paste the command from the text editor to the command line

If you are uploading to an ATmega32U4-based board (e.g., Leonardo, Micro, Yun), you’ll need to press and release the reset button on the board immediately after running the command. If you are using a Pro Micro, use a wire to momentarily connect the RST and GND pins. If you are using a Yun, press and release the “32U4 RST” button quickly twice. Wait about a second after resetting the board before running the command.

Run the command.

Wait for the command to finish successfully.


You can follow a similar procedure to write the file to another Arduino board. Remember that this file was compiled specifically for the Arduino board you read it from. You can’t use it with an Arduino board that has a different configuration. For example, if you read it from an Uno, it is compiled for an ATmega328P running at 16 MHz with a boot section of 0.5 kB.

First, we’re going to do a dummy upload in the Arduino IDE in order to get it to help us generate the avrdude command used to write the program to the Arduino board:

Plug the Arduino board you want to write to into your computer.

Select your board from the Arduino IDE’s Tools > Board menu.

Select your board’s port from the Tools > Port menu.

File > Preferences

Check the box next to “Show verbose output during > upload”.

Click “OK”.

Sketch > Upload

Wait for the upload to finish.

Scroll up the black console window at the bottom of the Arduino IDE window until you see the avrdude command that was generated for the upload. It will look something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

Select the full text of the upload command.

Press Ctrl + C. This will copy the upload command to the clipboard.

Next, you need to modify the upload command to write the hex file you read from your other Arduino board:

Start a text editor program.

In the text editor window, press Ctrl + V. This will paste the command into the text editor. The end of the command will look something like this:

-D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

That is the part of the command that tells it to write.

Replace the filename in that part of the command with the name of the file you read:

-Uflash:w:readfile.hex:i

So now the full command looks something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:w:readfile.hex:i

If the paths in the command contain spaces, wrap the paths in quotes.

Plug your Arduino board into your computer.

Copy and paste the command from the text editor to the command line

If you are using an ATmega32U4-based board (e.g., Leonardo, Micro, Yun), you’ll need to press and release the reset button on the board before running the command. If you are using a Pro Micro, use a wire to momentarily connect the RST and GND pins. If you are using a Yun, press and release the “32U4 RST” button quickly twice. Wait about one second before running the command.

Run the command.

Wait for the writing process to finish successfully.