2

enter image description here

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 J Dec 15 '16 at 15:49
  • will it work without a computer? – Rishi Sharma Dec 15 '16 at 15:54
  • 1
    Depends on your programming skills... – Turbo J Dec 15 '16 at 15:54
  • This sounds like an XY Problem. What are you really trying to do? – tangrs Dec 15 '16 at 15:55
  • 2
    You 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_cro Dec 15 '16 at 16:37
3

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:

Board programmer

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:

Stand-alone programmer

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.

| improve this answer | |
  • 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. – Mark Smith Dec 16 '16 at 8:09
  • True, but the question was about 2 x Atmega328P. – Nick Gammon Dec 16 '16 at 8:36
  • 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. – Mark Smith Dec 16 '16 at 9:14
  • Quite possibly. :) – Nick Gammon Dec 16 '16 at 9:23
2

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).

| improve this answer | |
  • add as may as you want – dhimaspw Dec 16 '16 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.