Is there any way I can program an Arduino using another Arduino,without the need of any computer. I want to store the programming code in the EEPROM of the "Programmer Arduino" and using any interface like SPI, I2C or Serial, burn this code to the Second arduino. Is it possible? How can it be implemented ?
-
Just use the ISP interface, which is similar to SPI.– Turbo JCommented Dec 15, 2016 at 15:49
-
will it work without a computer?– Rishi SharmaCommented Dec 15, 2016 at 15:54
-
1Depends on your programming skills...– Turbo JCommented Dec 15, 2016 at 15:54
-
This sounds like an XY Problem. What are you really trying to do?– tangrsCommented Dec 15, 2016 at 15:55
-
2You could store just a small program into an EEPROM. For example ATmega328 has 32 KB of program memory and just 1 KB of EEPROM. Besides that, instruction opcodes are 16 bit so you could store only 512 instructions in 1 KB of EEPROM space. But yes, you could store the opcodes as data in flash and write a program (or use a bootloader for that purpose) to send the firmware over serial communication to another Arduino board.– Chupo_croCommented Dec 15, 2016 at 16:37
2 Answers
It is certainly possible to do this.
I want to store the programming code in the EEPROM of the "Programmer Arduino" and using any interface like SPI, I2C or Serial, burn this code to the Second arduino.
I should point out that the EEPROM may not be large enough for this. For example, the Uno has only 1KB of EEPROM.
A more workable solution would be to store a reasonable size program in PROGMEM, or a larger one in external memory, like an SD card.
I have a page about a stand-alone programmer - the first idea presented just uses the Serial monitor to command the programmer behaviour:
Using the Serial Monitor you select the file you want programmed. Another approach, commissioned by someone who wanted to eliminate the external computer altogether looks like this:
In this case you put one or more hex files onto the SD card, choose one using the "file select" knob, and then press the "program" button to program it. This only takes a couple of seconds.
There are also commercial products that do a similar thing.
-
Worth bearing in mind that something like an ESP-01 has much larger memory than the Uno's 1k - 512kB or 1MB - and is smaller and cheaper. Other models have more memory /flash still. Commented Dec 16, 2016 at 8:09
-
-
Hence why I said it was also worth considering. Perhaps he's not 100% unchangably committed to that particular device for the programmer - an XY problem perhaps. Commented Dec 16, 2016 at 9:14
-
Yes. Connect 2 arduinos via serial connection (https://www.arduino.cc/en/Reference/Serial), restart one of them via RESET channel and upload sketch(https://www.arduino.cc/en/Guide/ArduinoProMini#toc1). You will need binary files - google 'arduino get sketch binary'(cannot add any more links).