Sketch over network? (OTA to Arduino Ethernet)

Hi! It’s possible to send code (programmation) to arduino over internet using Arduino UNO and a Ethernet Shield W5100?

hi!
several years ago there were some experiments. technically it is possible, but afaik it is VERY complex and needs complicated procedure + advanced coding skills.

i didn’t followed if there were any improvements in the last years with wired ethernet modules + arduino… but, with current tehnology, my best bet would be:

  • a properly configured remote pc (raspberry, laptop, etc)
  • esp8266 based board
  • both connected to the same wifi network and internet
  • access the remote pc via teamviewer and upload code ota to the esp

but this question is not really blynk related…

Hi, I don’t think you can do OTA with Arduino boards, even on the same network.
With an ESP8266 board it’s easy to do OTA on the same network, but not over the Internet. The solution (with an ESP8266) is to use the OTA library and have the device check for code updates that are dropped onto a web server, on a regular basis.
I use a free web hosting service as a place to drop my code. The ESP is programmed to check a specific URL every night and if it finds code there it installs it and restarts. If you leave the code on the web server the ESP will keep reinstalling it every night.
I think there may be a clever way to only install the code if it’s newer than the existing version, but I’ve never delved that deeply into the process.
I get my ESP to send me a Pushover message when it restarts, with details of the firmware version, so I know the new code is installed and it acts as a reminder to remove the code from the web server.

Pete.

1 Like

@PeteKnight, seems very clever!

i’m also interested in this method, updating esp8266. could you give more detail how the periodical check is implemented on the esp?

and regarding the server side, you have to set up some script, or how the firmware update is initiated?

i wonder if this method could be combined with a “local” blynk server…

As long as each bin file is sequentially numbered and the sketch that created the bin file has a few lines of code to cover the sequential numbering then you don’t need any scripts on the server.

Basically bin file number 1 looks for bin file number 2, if it exists on the server the OTA is carried, bin file 2 looks for bin file 3 etc.
You have to be very disciplined with the sequential numbering but much of this is handled in the sketch code.

1 Like

hm, this seems very interesting. when i will have some free time, i will do some experiments.
@Costas, you have done this “remote sketch uploading” actually?

Yes for ESP’s but not for Arduino’s.

of course i’m not interested for arduinos :wink:

@wanek me neither but I didn’t want to confuse the OP and other Blynkers.

I resemble that remark :stuck_out_tongue:

1 Like

Here’s the info on how to do the OTA on an ESP8266:
http://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html

Scroll down to the HTTP Server section.

I use a free web hosting account from hostinger.co.uk.
In my ESP code I specify the path as follows:
http://xxxxxxxxx.com/A0-B0-C0-D0-E0-F0/updater.ino.bin
where A0-B0-C0-D0-E0-F0 is the MAC address of the ESP to be updated. That makes it easier to manage multiple devices running different firmware.

The only bit that took me a while to figure-out was the Hostinger file structure. When you use their File Manager 2 app you have to navigate to /public_html and that’s where you create your folders with the MAC addresses for your devices, so in the path in the Hostinger file manager would be:
/public_html/A0-B0-C0-D0-E0-F0/updater.ino.bin

You don’t need any scripts running on the server side to do the basic HTTP OTA updates.

Pete.

1 Like

That is quite normal.

But how do you stop the MCU updating over and over again or do you have a Blynk / physical button?

We use buttons but also automatically at 2am every morning but with the special sequential coding to stop it updating over and over again with the same firmware.

1 Like

I’m sure it is, but not having done much playing around with web hosting sites in the past I had me scratching my head for a couple of hours. Hopefully adding the info will save others the hassle.

As I said before, I have my devices set to check for new firmware in the early hours, and they send me a Pushover message when they restart, The message contains the MAC address of the device and the Firmware compile date/time. The next morning I see the Pushover message and know that the update was successful, then I manually go and delete the code from the webserver. Not very elegant, but it works fine for the occasional tweaks to code that I have to do,

Pete.

2 Likes

I see, OK.

@PeteKnight, @Costas, thanks a lot for initiating me into this. i’m sure soon i will need to implement this in one of my projects. so i will bookmark this topic for future reference!

we will host the files in one of our blynk servers, so probably it is possible to make a small script, that after successful flashing the server can delete the files automatically…

1 Like

I made something similar with an OTA library, can’t remember what I used though. I just put the whole HTTP routine in an IF statement controlled by a Blynk button. E.g. firmware update mode or not :slight_smile: Maybe that helps a bit.

1 Like

@Fabio_Faria, I have no experience … but I’m also looking how to set it up

For me personally, I wish I was able to make a setup to
– Flash arduino over ethernet
– How To Upload A Sketch To Your Arduino Via A Network
– OTA arduino - over the air by ethernet shield
so as in the following video is done by Yoan Andreev

Flash arduino over ethernet – https://youtu.be/9U8PpUBYER4 24 jan. 2013
This is a demonstration video on my arduino which I can flash over our network! The DIY tutorial is coming up soon!

In a way I hoped to do it by his DIY tutorial
(the DIY video is not released/found)

more links can be found in the online document : more information … links
(I’m limited with links as beginner)