FOTA(HTTP) update from dropbox or google drive?

Which ESP are you using, specifically Flash and SPIFFS sizes?

i am using a nodemcu v3 that i baught from aliexpress
how can i tell the flash and SPIFFS

Look in the IDE.

Also now i am getting WRONG HTTP CODE error

anyone??

I would love to see this working, but AFAIK you need to set some custom headers in HTTP, which Dropbox/GDrive do not allow to do.
I did not try HTTPS update, but HTTP worked like a charm.
In any case you can dig into the code of HTTP updater and try to figure out what goes wrong.

@Oleg_Pugach as pointed out by @vshymanskyy HTTP works fine but HTTPS is very flakey.

We use HTTP via a regular server and have 2 ways to update our firmware. One is a Blynk button and the second is at a predetermined time each day.

If you want to continue to try HTTPS these are the steps you need to follow:

'1. In the IDE switch from NODEMCU to generic ESP board.
'2. In setup() add the following as the first line:
Serial.setDebugOutput(true);
'3. In the IDE set debug port to Serial 1 and Debug level to All.
With steps 1 to 3 set you will see a huge amount of debugging information in Serial Monitor relating to fingerprint checks etc.
'4. Locate the raw.githubusercontnent url for your bin file and use that in the ESPhttpUpdate() call along with the standard fingerprint of 21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58

When we tried this yesterday we had limited success but most of the time it failed. This was also with a basic 10 to 20 line sketch. As soon as you start adding additional libraries for Blynk etc you will normally run out of memory and the update will fail. Hence the reason we just use HTTP.

thank you very much for the reply’s
i will try it soon

@Oleg_Pugach let us now how you get on. With a few tweaks we now have https working reliably at our side.

Hi
its still not working for me
i woud be glad to hear about your tweaks

Our tweaks that are working with a full Blynk project are:

  1. Forget the normally useful Serial.setDebugOutput(true) and associated IDE settings.
  2. In the IDE switch from generic ESP board to our actual WeMos board.
  3. Check fingerprint of our secure server with https://www.grc.com/fingerprints.htm because our browser is showing the incorrect fingerprint for some reason.

Do remember the ESP “bug” that means after each serial firmware update you must manually reset the ESP or the OTA reset will not be able to reset the ESP. This only applies when you do serial updates, once you have done the first manual reset OTA updates will work over and over again until you do another serial update (and manual reset).

1 Like

Hi costas
i tried you recommendations
1.switched to wemos board :slight_smile:

checked the fingerprint on grc.com
the fingerprint that it gave me is:
D7 9F 07 61 10 B3 92 93 E3 49 AC 89 84 5B 03 80 C1 9E 2F 8B
(what do you mean buy saying Check fingerprint of our secure server)
performed a manual reset after serial update
still recieving the following error:
HTTP_UPDATE_FAILD Error (-1) HTTP error connection refused

 else if (String("update") == param.asStr()) {
  terminal.println("Updating...") ;
  terminal.flush();
    t_httpUpdate_return ret = ESPhttpUpdate.update("https://github.com/opbeer/cxbcvx/raw/master/Blink.bin","","D7 9F 07 61 10 B3 92 93 E3 49 AC 89 84 5B 03 80 C1 9E 2F 8B");
    switch(ret) {
        case HTTP_UPDATE_FAILED:
            terminal.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
            terminal.flush();
            break;

        case HTTP_UPDATE_NO_UPDATES:
            terminal.println("HTTP_UPDATE_NO_UPDATES");
            terminal.flush();
            break;

        case HTTP_UPDATE_OK:
            terminal.println("HTTP_UPDATE_OK");
            terminal.flush();
            break;
    }
    }

This is my procedure for updating

@Oleg_Pugach is it a WeMos that you are using or a NodeMCU? You should select your actual board rather than Generic board.

We have our own servers but we did use GitHub in our tests before we moved to our own servers.
As per an earlier post you need to use the raw.githubusercontent.com url and the fingerprint of “21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58”.

Just downloaded your bin file with the url contained in the line below and this is what you should use:

t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/opbeer/cxbcvx/master/Blink.bin", "", "21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58");

Just so you are aware the case statements don’t really work other than the failed case. This is because if the update is successful the ESP will reboot right after t_httpUpdate… line.

You need to include something like a unique Serial.print() command in setup() for each new bin file so you can see that the update completed successfully.

Please confirm you understand the ESP reset bug “fix”.

i am using the nodemcu 12e board so i chose it
used your script
i understand the esp reset bug and performed a manual reset after the serial update
still no luck :frowning:

With GitHub you might need to try the update several times.

I’m not sure if this is because GitHub is a little flakey. You might have seen 404 errors on GitHub from time to time for no apparent reason. GitHub uses TLS 1.2 protocol, ECDHE_RSA with P-256 key exchange and AES_128_GCM cipher.

A few days ago I stumbled across a 79 page pdf written by Ivan “ESP god” Grokhotkov for release 2.4.0 of the ESP8266 Arduino Core dated 20th Feb 2017. The url for the pdf is https://media.readthedocs.org/pdf/arduino-esp8266/docs_to_readthedocs/arduino-esp8266.pdf
I’m still using 2.3.0 core and not sure if the 2.4.0 core has been released yet.

Page 28 states TLS 1.1 is supported but TLS 1.2 is not. So per the docs it’s not technically possible but all I can say is that the docs are wrong / outdated.

You can check SSL details for GitHub with the following url:
https://sslanalyzer.comodoca.com/?url=raw.githubusercontent.com

My own server also has broadly similar details i.e. TLS 1.2 and a 2048 bit key.
If the key for any server you use is bigger than 2048 bits it will almost certainly fail.

there is a little progress
after my command to update i receive no errors and the esp reboots
with the following message in the serial monitor:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld

after its goes up the version is the previous not updated version
any suggestions?

Yes this is progress.

Repeat 10 more times and see if you finally get the updated bin file loaded.

its not helping
also i deleted the file from github but it still acting the same