I have an Arduino that has a sketch that has been uploaded to it and it performs its task fine.
The original sketch saved on the PC was then lost.
Is it possible for me to extract the sketch from the Arduino or copy it onto another similar Arduino?
I don’t need the code back I just need to be able to clone the Arduino.
I have an Arduino Uno R3.
Thanks for your question.
You can get a hex dump of the program but not the original source code.
You can then clone the hex dump onto other units.
To do this you’ll need to use avrdude.
Extract sketch from Arduino (as hex dump)
avrdude -C "C:\Program Files (x86)\arduino-00XXX\hardware\tools\avr\etc\avrdude.conf" -v -v -v -v -p atmega328p -c stk500 -U flash:r:"c:/arduino.hex":r -P\\.\COM5 -b57600
Naturally swap ut the
arduino-00XXX for your Arduino folder and
COM5 for your com port.
If you’re on Windows, ATMEL’s AVR Studio apparently has a nice gui for doing this (I haven’t used it yet).
~/arduino-00XXX/hardware/tools/avrdude \ -C~/arduino-00XXX/hardware/tools/avrdude.conf -v -v -v -v \ -pm328p -cstk500v2 -P/dev/ttyUSB1 -D -Uflash:r:/tmp/arduino.hex:i
#To upload the hex dump to another Arduino use:**
avrdude -C "C:\Program Files (x86)\arduino-00XXX\hardware\tools\avr\etc\avrdude.conf" -v -v -v -v -p atmega328p -c stk500 -U flash:r:"c:/arduino.hex":w -P\\.\COM5 -b57600
avrdude -U flash:w:[put-hex-file-path-here]:i -C avrdude.conf -v -p atmega328 -b 115200 -c stk500v2 -P [put-device-path-here]