How to Remote Firmware Update Atmega328?

Hello,

I have been looking for a way to have a customer update the firmware on a custom Arduino board using Atmega 328p.

I would like to keep it as easy as possible for him.

The easiest solution I have found sofar is an SD card programmer that is connected to a target board.
I would send the customer a hex file, the customer loads it on an SD card programmer and perform the update.

Is this still the best way of a remote sketch update?

The Arduino core is GPL. So, in reality, you need to provide both the hex and source... right?

Update: It is LGPL.

ron_sutherland:
The Arduino core is GPL. So, in reality, you need to provide both the hex and source... right?

Nope. This is taken from the Arduino FAQ on the website:

Can I build a commercial product based on Arduino?

Yes, with the following conditions:
(snip)
Using the Arduino core and libraries for the firmware of a commercial product does not require you to release the source code for the firmware. The LGPL does, however, require you to make available object files that allow for the relinking of the firmware against updated versions of the Arduino core and libraries. Any modifications to the core and libraries must be released under the LGPL.

I believe it's that the mix of LGPL, GPL and Arduino as a platform allow you to keep your code confidential. The LGPL is used in things like libraries and allows you to include them in your code without the need to release the source while GPL requires that all modifications be provided as source when distributed.

My understanding is works built to run on a platform using the GPL license are not bound by the license. Much like Adobe doesn't have any rights on photos edited in Adobe Photoshop.

Ok, but my question is about remote programming methods not about licensing.

Add a CH340 chip or module so you can use "standard" for sketch upload. And send to customer a package with a binary avrdude and batch file.

A Raspberry Pi as a remote update system is a compelling option, but it needs a network connection. The updates can be placed on Github. The R-Pi would need a clone of the repository so the customer could do "git pull" and then run the uploader tool when desired. This could work with either a bootloader or an ISP tool.

For example, this Makefile has the rule to upload a hex file with an ISP tool. So an ISP tool needs to be connected (I use an Arduino Uno with the example ISP sketch) and upload the hex with the "make isp" rule.

ron_sutherland:
A Raspberry Pi as a remote update system is a compelling option, but it needs a network connection. The updates can be placed on Github. The R-Pi would need a clone of the repository so the customer could do “git pull” and then run the uploader tool when desired. This could work with either a bootloader or an ISP tool.

For example, this Makefile has the rule to upload a hex file with an ISP tool. So an ISP tool needs to be connected (I use an Arduino Uno with the example ISP sketch) and upload the hex with the “make isp” rule.

Irrigate7/Makefile at master · epccs/Irrigate7 · GitHub

so that would be an overkill :slight_smile:

OP, has the project network connection?

SD bootloader can do SD update.

it works, but can upload only from SD card, not over USB

ron_sutherland:
A Raspberry Pi as a remote update system is a compelling option, but it needs a network connection. The updates can be placed on Github. The R-Pi would need a clone of the repository so the customer could do "git pull" and then run the uploader tool when desired. This could work with either a bootloader or an ISP tool.

For example, this Makefile has the rule to upload a hex file with an ISP tool. So an ISP tool needs to be connected (I use an Arduino Uno with the example ISP sketch) and upload the hex with the "make isp" rule.

Irrigate7/Makefile at master · epccs/Irrigate7 · GitHub

Thank you for sharing. I have never worked with a R PI. Can you please refer me to a write up on how to get this working?

Juraj:
so that would be an overkill :slight_smile:

OP, has the project network connection?

SD bootloader can do SD update.
GitHub - zevero/avr_boot: Arduino Bootloader to Flash from SD Card
it works, but can upload only from SD card, not over USB

It is overkill for this project as I need to make it as simple as possible. I found the avr_boot but I was wondering if there is something better out there.
I noticed there is a lack of ready made SD programmers.

Can you please refer me to a write up on how to get this working?

I have some notes that I use when setting up an R-Pi.

An off-line remote update could be done with two R-Pi. Put the SD card in an R-Pi with network setup and "git pull" then take the SD card to the remote site and plug it in and power up to run a script that does an auto update of the embedded device and logs the results.

# exampel bash script to update and log what it did
avrdude -p atmega328p -c arduino -P /dev/ttyAMA0 -b 115200 -e -u -U flash:w:foo.hex | tee logfile_$(date +%y%j-%T)
echo ${PIPESTATUS[0]}

one way to do an autorun script is to add it in rc.local

A stand-alone sd card based isp programmer $50 (scroll down to standalone programmer):

http://www.crossroadsfencing.com/BobuinoRev17/

The Arduino core is GPL.

No. (Already discussed.)

So, in reality, you need to provide both the hex and source... right?

No. Even if all the Arduino code was GPL, you would only need to make the source "available." It would still be perfectly acceptable if the "easy update installer" included only binary.

You should look at something like Nick Gammon's or Adafruit's extension of my Optiloader concept. While OptiLoader is limited to storing code that fits in ~1024 bytes or less, I think both of the extended versions would let you store code up to the full size (by some measure) of the "programmer" flash. So a nano-with a programming cable could program sketches up to 20k or so (-10k for the loader software.)

rocky79:
Ok, but my question is about remote programming methods not about licensing.

You can wire an ESP32-based board or module to your Arduino, and use https://vcon.io for a truly remote OTA. vcon firmware can act as an AVR (and not just AVR) programmer, and reflash your Arduino remotely.

Also, as a side-effect, you'll get remote control capability for your Arduino. https://dash.vcon.io cloud service gives you device dashboard and an API for remote control and OTA.

Disclaimer: I do represent https://vcon.io product.

lsm:
You can wire an ESP32-based board or module to your Arduino, and use https://vcon.io for a truly remote OTA. vcon firmware can act as an AVR (and not just AVR) programmer, and reflash your Arduino remotely.

Also, as a side-effect, you'll get remote control capability for your Arduino. https://dash.vcon.io cloud service gives you device dashboard and an API for remote control and OTA.

Disclaimer: I do represent https://vcon.io product.

Thanks, it looks like a potential solution.

WattsThat:
David_2018: please don’t feed the troll, this was a necro post resurrected by an ad spammer in a lame attempt to sell his subscription based product.

If it’s useful and relevant then why not?
It looks like they have a free service for controlling under 10 devices.