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 ?

10
  • Just use the ISP interface, which is similar to SPI.
    – Turbo J
    Commented Dec 15, 2016 at 15:49
  • will it work without a computer? Commented Dec 15, 2016 at 15:54
  • 1
    Depends on your programming skills...
    – Turbo J
    Commented Dec 15, 2016 at 15:54
  • This sounds like an XY Problem. What are you really trying to do?
    – tangrs
    Commented Dec 15, 2016 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
    Commented Dec 15, 2016 at 16:37

2 Answers 2

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.

4
  • 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
    Commented Dec 16, 2016 at 8:09
  • True, but the question was about 2 x Atmega328P.
    – Nick Gammon
    Commented Dec 16, 2016 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
    Commented Dec 16, 2016 at 9:14
  • Quite possibly. :)
    – Nick Gammon
    Commented Dec 16, 2016 at 9:23
3

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

1
  • add as may as you want
    – duck
    Commented Dec 16, 2016 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.