Upload a code to an Arduino without connecting it to a computer?

This is probably something very difficult to do, but would it be possible to update the code on an Arduino without uploading the code of my project again? I want to have a something that replaces the current code with a new code. If that's not possible, is there any other ways I can approach this?

Thanks.

Uploading via bluetooth.

mart256:
Uploading via bluetooth.

How would that work? I want someone without the code to be able to update it.

It depends on what you want/need to change.

Do you need to upload a whole new code? Or you just need to "update" some variables?

You can upload a whole code (reprogram the chip) via bluetooth, for example, as pointed out by mart256, or you can update a variable via SD card (I did it a couple of times and it's pretty easy).

c0rsa1r:
It depends on what you want/need to change.

Do you need to upload a whole new code? Or you just need to "update" some variables?

You can upload a whole code (reprogram the chip) via bluetooth, for example, as pointed out by mart256, or you can update a variable via SD card (I did it a couple of times and it's pretty easy).

Can I upload a new code (a lot of changes to the old code) without the person uploading it seeing the code?

surfknasen:
Can I upload a new code (a lot of changes to the old code) without the person uploading it seeing the code?

Well, you could search for "upload arduino code without IDE", and that will point you at many results, one of those is:

which is a terminal way to both compile and upload a whole code to your duino (only AVR seems to be supported at the moment). You could even make everything "automatic" writing a script and launch it when you want to upload the updated code.

It's not really "easy" as the IDE, but it's certainly a good starting point.

As far as Ii know there is another method which consist in a whole embedded OS made for this sort of thing, you can find it between arduino.cc pages (I don't remeber where and the name but should be easy to find).

You can exporet the compiled .hex file (there's a menu option for that in recent IDE versions), and then package up avrdude, the .hex file, the avrdude.conf, and a batch file to call it - but they'd still need a way to connect to the device (ie, a serial adapter - unless your board doesn't use the bootloader, in which case they'd need an ISP programmer).

There are also a number of people here who have devised sketches that will use ISP programming to load sketches onto a target arduino off of an SD card, which might be useful?

In any event, no matter what, somehow you need to get the new data from where you are to where the device you're updating is, and then get the data loaded onto that device. It's not clear from your discussion what the constraints on either of these sides of the issue are.

Standalone programmer option:
http://www.crossroadsfencing.com/BobuinoRev17/


Couple versions available, with one display (for up to 1 files) and 2 displays (for up to 255 files),
or no display, for just a single file.

c0rsa1r:
Well, you could search for "upload arduino code without IDE", and that will point you at many results, one of those is:

GitHub - sudar/Arduino-Makefile: Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.

which is a terminal way to both compile and upload a whole code to your duino (only AVR seems to be supported at the moment). You could even make everything "automatic" writing a script and launch it when you want to upload the updated code.

It's not really "easy" as the IDE, but it's certainly a good starting point.

As far as Ii know there is another method which consist in a whole embedded OS made for this sort of thing, you can find it between arduino.cc pages (I don't remeber where and the name but should be easy to find).

DrAzzy:
You can exporet the compiled .hex file (there's a menu option for that in recent IDE versions), and then package up avrdude, the .hex file, the avrdude.conf, and a batch file to call it - but they'd still need a way to connect to the device (ie, a serial adapter - unless your board doesn't use the bootloader, in which case they'd need an ISP programmer).

There are also a number of people here who have devised sketches that will use ISP programming to load sketches onto a target arduino off of an SD card, which might be useful?

In any event, no matter what, somehow you need to get the new data from where you are to where the device you're updating is, and then get the data loaded onto that device. It's not clear from your discussion what the constraints on either of these sides of the issue are.

Thanks, I'll give those a try.

CrossRoads:
Standalone programmer option:
Cross Roads Electronics


Couple versions available, with one display (for up to 1 files) and 2 displays (for up to 255 files),
or no display, for just a single file.

If I replace the code on the sd card (on the standalone board) with a new code (basically just switching sd cards), will that work?

surfknasen:
How would that work? I want someone without the code to be able to update it.

I assume you mean "... without the source code to be able to update it."?

It sounds like you may be wanting to create a product using Arduino that is closed source.
If that is the case, read on.
If not you can stop right here.
--- bill


Can it be done. Yes.
But you won't be able to use the IDE as it is geared to using source code for open source projects.

If this is really a question about how to handle closed source projects and device updating, then there are some things that will need to be understood and resolved before the specific update mechanism needs to be worked out.

The rest of this response is about using closed source with Arduino.


When trying to use closed source with Arduino, you can rapidly run into s/w licensing issues that will likely prevent you from either using Arduino libraries, or from keeping your source code closed.

Licenses like BSD licenses are basically "freeware" and you can use them pretty much anyway you want; however, many other licenses are not so liberal such as LGPL or GPL.

While LGPL is compatible with closed source projects, some libraries are GPL which does not allow their use in closed source projects.

If you are using any GPL licensed libraries, particularly GPL 3.0 licensed code, you cannot distribute your device without also making all the source code in the project (which includes any/all of your sketch code) available.

If not using any GPL code but you are using LGPL code, the LGPL licensing does allow use in closed source projects; however, with Arduino it is nearly impossible to comply with the LGPL licensing rules.
The LGPL licensing rules mandate that a user be able to rebuild the executable image with updated LGPL code.
i.e. if the user wants/needs to update an Arduino LGPL library or a gcc library (all of which are LGPL) that is in your f/w image, the user must have a way to do this.
This means that you must provide all the files needed to allow this to happen.
Typically that is all the source code for the open source LGPL modules, and then the .o files for the closed source modules.
In "normal" projects, that would also include the makefiles needed to rebuild the image.
A makefile based system could fulfil the needed GPL requirement as it could use the pre-compiled objects.
However, with Arduino, the included Arduino IDE is typically used to build the executable image and the IDE does not provide a way to build an image with pre-compiled components.

So under the LGPL licensing requirements, I see no way to comply with the terms for use in a closed source project unless the image is built using some sort of method that does not use the IDE, like using make with a makefile.

--- bill

Thanks a lot, I'm using a lot of libraries for my project, I suppose this could mess up then?

Make your doodad open source -- you are already benefiting greatly by using free, open source software.

surfknasen:
Thanks a lot, I'm using a lot of libraries for my project, I suppose this could mess up then?

You understand, that at some point.. you'll be benefiting from others (Free) hard work.....right?

Which is pretty much against the whole stance of this community/scene... (and hence why we have so much free/open source code, libraries..etc to use to begin with.)

surfknasen:
Thanks a lot, I'm using a lot of libraries for my project, I suppose this could mess up then?

Not sure what you mean by "could mess up"

The main question I have (and probably others) is that I don't yet understand your goal.

  1. Are you trying to provide a way to update your product and hide source code from the users of your product?

or

  1. Are you looking for an alternate "easier" way to update the code in your product that does not involved using the IDE to rebuild everything from sources?

  2. Something else?

We still don't really know.

--- bill

bperrybap:
Not sure what you mean by "could mess up"

The main question I have (and probably others) is that I don't yet understand your goal.

  1. Are you trying to provide a way to update your product and hide source code from the users of your product?

or

  1. Are you looking for an alternate "easier" way to update the code in your product that does not involved using the IDE to rebuild everything from sources?

  2. Something else?

We still don't really know.

--- bill

I'm looking for an easier way to update the code that does not involve using the IDE to rebuild everything from sources, yes, but I got another idea so I won't be needing that anymore.
Thanks.

surfknasen:
I'm looking for an easier way to update the code that does not involve using the IDE to rebuild everything from sources, yes, but I got another idea so I won't be needing that anymore.
Thanks.

So is the project open source?
You have never clearly stated whether your project is open source or not.

If it is not, you will still have all the LGPL licensing requirements which requires you to provide users with all the files needed to rebuild the image themselves - which requires using something other than the IDE to build the image.
If it is using any GPL libraries, then you must provide all your source code to anyone you provide the binary image to.


Not using the IDE creates some difficulties.
You either have to have some specialized h/w that can use ISP programming with some sort of image like what CrossRoads showed.
(There are commercial products like this on the market that can be purchased)

Or you have to provide an executable like avrdude or some other upload tool.
And while you can wrap a script or gui around this upload tool, you then still have the issue of which operating systems to support and how to actually do the update.
i.e. over a serial port or requiring some sort of ISP tool
And then if using ISP, how does the customer get access to the pins to attach the connector?

lots of stuff to think about and resolve.

--- bill