ESP32 OTA via HTTPS

  Переглядів 50,576

Luca Dentella

Luca Dentella

5 років тому

How to perform OTA (Over-The-Air) updates of the firmware running on your esp32 IoT project using only componenents included in the esp-idf framework.
Link to my blog:
www.lucadentella.it/en/2018/10...
Link to my Github repository for the code:
github.com/lucadentella/esp32...

КОМЕНТАРІ: 103
@ugetridofit
@ugetridofit 5 років тому
Thank you so much for posting this! I am glad to finally find someone who explained well, and thanks again for the code!
@kissinnokissinnovation8097
@kissinnokissinnovation8097 4 роки тому
Wonderful tutorial. Well done Luca & thanks a lot for sharing all your projects. Now I have some reading for my Xmass vacations.
@nadie8480
@nadie8480 3 роки тому
Clear and well explained, thank you!
@jonasinta9405
@jonasinta9405 5 років тому
Thankyou very much. Greetings from New Zealand. Loved your explanation. You made what seemed to me to be very complex- to be actually not so complex. And thankyou for sharing the code as well. Thanks to you I am OTA-ing! I have incorporated it as a component that I can shove into any wifi enabled project. Thanks again for taking time to share.
@AndreaSalvatori92
@AndreaSalvatori92 5 років тому
Grazie per il video. Molto utile come, d'altronde, il resto delle sue pubblicazioni
@arunbm123
@arunbm123 5 років тому
brilliant tutorials
@Cojonel89
@Cojonel89 3 роки тому
Wonderful tutorial, Luca! I am very surprised to see an RTOS-IDE example, while the whole internet is intoxicated by the tons of Arduino examples.
@lucadentella
@lucadentella 3 роки тому
Thanks Alexandru! As you wrote, I didn't want to write "yet another arduino tutorial" so I made these ones using only the esp-idf fw
@yashizuko
@yashizuko 3 місяці тому
Grande! molto chiaro ed utile
@tomvenice
@tomvenice 5 років тому
Complimenti, ottimo video, molto utile!!
@lucadentella
@lucadentella 5 років тому
grazie mille!
@ravindukathriarachchie5851
@ravindukathriarachchie5851 3 роки тому
Hello! Thank you so much for sharing all this information. I am stuck in 1:43 can you explain how to set up the server. You have a .bin file link in the CPanel and In the code you are using a .json file. Can you please explain the steps in between these.
@nickfelstead7559
@nickfelstead7559 2 роки тому
Thabks for this!
@zameerahmed1775
@zameerahmed1775 8 місяців тому
Too good ...........
@abbarajumanojsai7096
@abbarajumanojsai7096 4 роки тому
Hello Luca , how do you used step by step debugging for esp32
@habbabyhnos1203
@habbabyhnos1203 Рік тому
I love you! 😁 Thankssssssssssssss!
@amiral3187
@amiral3187 3 роки тому
Hi Luca, Thank you for your great tutorials...... Since we are configuring the partition as an "OTA", how we can use OTA with the custom partition of the SPIFFS? Another question, if the website is an HTTP (not HTTPS) is the library still works?
@lucadentella
@lucadentella 3 роки тому
Hi Amir! Thanks for your comment! With OTA you change the content of "app" partitions, it doesn't touch other partitions (SPIFFS, FAT...). If you want to upgrade also the SPIFFS content, you have to do it in your code (or use pre-made components). And no, the OTA component included in the framework requires HTTPS (for security reasons).
@sixhundred243
@sixhundred243 Рік тому
Incredible.
@laxmipathymaisale9081
@laxmipathymaisale9081 5 років тому
I followed esp32 simple ota example.openssl gives .rnd file not found
@dr.hriturajrohariya
@dr.hriturajrohariya 2 роки тому
You are a Gem... 👍👍👍
@lucadentella
@lucadentella 2 роки тому
thanks!
@sixhundred243
@sixhundred243 Рік тому
You’re my Hero.
@lucadentella
@lucadentella Рік тому
;) thanks
@FrankWolf74
@FrankWolf74 3 роки тому
Thank you
@asierdanjou3905
@asierdanjou3905 6 місяців тому
Buenas Luca! Thank you for your video. It is really helpfully. Could you explain a bit more certificate generation part? Which is this process for netsons hosting that are you using at the example? Great job! thanks in advance.
@lucadentella
@lucadentella 6 місяців тому
Hi! Netsons provides a way (from the admin console) to generate SSL certificates for your hosted websites: you normally don't need to generate them manually. You only need to download it and pass to you code for validation
@UmarKhan-ub5ps
@UmarKhan-ub5ps 3 роки тому
Great example! Any chance we can do OTA using Dropbox? i.e. we put new bin and json file in a Dropbox folder and make the ESP32 get it from there?
@lucadentella
@lucadentella 3 роки тому
Hi! I think it should work... I'm not an expert of Dropbox: is it possible to have a direct link to a file? If not, the code could be more complex because of the need of multiple calls to get the file content
@md.jahangiralam6658
@md.jahangiralam6658 5 місяців тому
Thanks from bangladesh.
@iramtrabelsi6799
@iramtrabelsi6799 5 місяців тому
hi can u help me to do this project
@Jindraxx20
@Jindraxx20 5 років тому
Hello Luca. Have you ever tried out to do OTA updates with ssl + mutual authentication ?
@lucadentella
@lucadentella 5 років тому
Hi, at the moment it seems that the http_client used by the OTA component does not support mutual authentication
@Jindraxx20
@Jindraxx20 5 років тому
Dear @@lucadentella , thank you for your response. Have a nice day and keep up the good work !!!
@lucadentella
@lucadentella 5 років тому
Hi! It seems that the latest version of esp_http_client DOES include the SSL mutual authentication! Let's give it a try: docs.espressif.com/projects/esp-idf/en/latest/api-reference/protocols/esp_http_client.html#structesp__http__client__config__t
@shakaibsafvi97
@shakaibsafvi97 3 роки тому
Beautifully Done ! Bravo ! Do I have permission to use this code in my projects ?
@lucadentella
@lucadentella 3 роки тому
sure!
@shakaibsafvi97
@shakaibsafvi97 3 роки тому
@@lucadentella Is there an easy way to convert all the code to Arduino Compiler ? cmake is not very user friendly :(
@lucadentella
@lucadentella 3 роки тому
@@shakaibsafvi97 for Arduino I found - not tested! - ready-to-use OTA libraries
@akshaydasm.k9388
@akshaydasm.k9388 3 роки тому
You can use all the esp-IDF functions and libraries in arduino if you have installed esp32 board support in your arduino ide. All the esp32-arduino libraries and functions are based on esp-idf hal.
@KK-ib5nh
@KK-ib5nh 10 місяців тому
I am trying esp idf simple ota example. But i am getting error OTA image invalid magic byte How to solve this ?
@AngelRoyo864
@AngelRoyo864 5 років тому
Thanks for your video. Grazie mille. How can I make file .bin? With the IDE Arduino? Best regards
@lucadentella
@lucadentella 5 років тому
No, you need the esp-idf framework... see esp-idf.readthedocs.io/ to install and configure it
@VitalyStockman
@VitalyStockman 5 років тому
​@@lucadentella Is there similar OTA mechanism (over HTTPS and that would work from outside of home network) that would be working with Arduino IDE? I have a lot of other stuff already on Arduino IDE/C++ and need this type of OTA, rewriting all for ESP-IDF/C is way too much work. Or maybe there is a way to somehow have this OTA mechanism work with the rest of code made in Arduino IDE? Thank you!
@NickName-ck2hy
@NickName-ck2hy 3 роки тому
@@VitalyStockman Got the same problem. Have you found a solution?
@VitalyStockman
@VitalyStockman 3 роки тому
​@@NickName-ck2hy yes, we use this library. Allows to do OTA from anywhere over the internet. Using Arduino IDE. Here is the library: github.com/arvindr21/esp32-ota-https
@NickName-ck2hy
@NickName-ck2hy 3 роки тому
@@VitalyStockman thanks :)
@tejasmd8143
@tejasmd8143 3 роки тому
Wow! Great Video. Can I not export a bin file from Arduino IDE and do this procedure?
@lucadentella
@lucadentella 3 роки тому
sorry my tutorials are NOT for Arduino but for the esp-idf framework... I
@lucadentella
@lucadentella 3 роки тому
Anyway I found that esp32-arduino is shipped with OTA examples, give them a try: lastminuteengineers.com/esp32-ota-web-updater-arduino-ide/
@tejasmd8143
@tejasmd8143 3 роки тому
@@lucadentella Hi, Thanks for the quick reply, I found that this tutorial is for local use and yours helps remotely upload sketches. Also, I see no difference in that tutorial and yours except that you're using CLI for the same tasks. So, exporting a bin from Arduino IDE should work too! Thanks a lot for your detailed idea, will let you know the results!
@mbanini6848
@mbanini6848 4 місяці тому
Hi. thank you for tutorial. Unofrtunately I have been using Arduino IDE for compiling sketches for ESP32. I made litlle modification to be able to compile, but even uploading succesfully (after defining the const * char server_cert) the code is unable to show it is executing. Can you make a tutorial to show steps and method you use for compiling this code , and uploading please?
@lucadentella
@lucadentella 4 місяці тому
Hi, my tutorials are based on the "pure" esp32 framework, not designed to be used with Arduino IDE (on the Internet there are a lot of good tutorials for that, for example check randomnerdtutorial website)
@jean-pierrepourrez4594
@jean-pierrepourrez4594 4 роки тому
Thank for your tutorial. I wish to put the binary file on my repository at github.com. How can I get certs.pem file ? Can I use your file ?
@lucadentella
@lucadentella 3 роки тому
you should be able to download certificate bundle from Github
@junaidahmed-kc6li
@junaidahmed-kc6li 2 роки тому
@@lucadentella Can you help me how to download them ?
@riz237
@riz237 2 роки тому
Good day Luca, How can we begin the OTA process in Http without having/passing any certificates?
@lucadentella
@lucadentella 2 роки тому
Hi! You can't, at least using the component included in the framework. Of course you can program your own component/OTA routine or try to change the existing one (it's opensource after all...)
@yigitatalan515
@yigitatalan515 Рік тому
Hi. what about we reset mcu? it last firmware from memory or get new firmware on every boot?
@lucadentella
@lucadentella Рік тому
Of course it takes the current firmware after a reset
@calogerotaibbi5699
@calogerotaibbi5699 Рік тому
Bellissimo video potresti rifarlo in italiano magari anche l’altro in seguito quello che spiega come downgreadare ad una versione vecchia sei un grande subito inscritto
@lucadentella
@lucadentella Рік тому
Ciao Calogero, grazie per il commento.. questo video è relativo ad un tutorial di ormai quattro anni fa... puoi trovare il relativo articolo in italiano sul mio blog
@AngelRoyo864
@AngelRoyo864 5 років тому
Luca, it possible to do on platformio?
@lucadentella
@lucadentella 5 років тому
sure, platform.io is an IDE, just make sure you're using the esp-idf framrwork and not the esp32-arduino
@VitalyStockman
@VitalyStockman 5 років тому
Just so that others are not confused, it is platformio.org (platform.io is something else) :-)
@muhammadsharjeel4941
@muhammadsharjeel4941 6 місяців тому
How to solve certificate issue?
@lucadentella
@lucadentella 6 місяців тому
which issue?
@muhammadsharjeel4941
@muhammadsharjeel4941 6 місяців тому
@@lucadentella i am facing handshake issue mdtls handshake issue... please do upload one video on it please.......
@user-qj1jx6wi4l
@user-qj1jx6wi4l 25 днів тому
did you solve?@@muhammadsharjeel4941
@simielcanguro
@simielcanguro 3 роки тому
It looks very nice, Do you think it would run over ESP8266?
@lucadentella
@lucadentella 3 роки тому
not using this exact code because it's based on the esp32 framework but I was able to find on the Internet several examples about how to perform OTA with ESP8266 (one is gist.github.com/igrr/24dd2138e9c8a7daa1b4)
@ABDULSAMAD-mb2iw
@ABDULSAMAD-mb2iw 2 роки тому
Thank you sir. But json file is getting downloaded, the rcv_buffer is empty always. Any solution please.Thank you sir.
@lucadentella
@lucadentella 2 роки тому
Hi, can you better explain your issue? share your code maybe?
@simonegasparella1228
@simonegasparella1228 Рік тому
Can I use aws as web hosting service ? what do you suggest?
@lucadentella
@lucadentella Рік тому
I never tested aws hosting service but as long as it is a "standard" https service it should work
@simonegasparella1228
@simonegasparella1228 Рік тому
@@lucadentella grazie mille luca.. una volta creato domimio e associato server su netsons dove trovo la gui pe rinserire il json . .? grazie .. Inoltre ho questo warning nel cpanel Primary Domain (Self-Signed Certificate) .. come posso risolvere ? Grazie
@lucadentella
@lucadentella Рік тому
@@simonegasparella1228 io apro il cPanel del servizio hosting e da li uso la funzione Gestione file per editare come indicato nel videotutorial
@lucadentella
@lucadentella Рік тому
@@simonegasparella1228 per il warning non saprei dirti, a me non appare ma on sono sicuramente un esperto di netsons, puoi provare con il loro supporto tecnico
@simonegasparella1228
@simonegasparella1228 Рік тому
@@lucadentella ho risolto grazie mille..
@MuhammadAwais-cf5vr
@MuhammadAwais-cf5vr 2 роки тому
I am getting the error "downloaded file is not a valid json". Also if the rcv_buffer is empty at start of the code, it will always return NULL. Isn't it?
@lucadentella
@lucadentella 2 роки тому
Hi, are you using my example? Or a file hosted by you?
@MuhammadAwais-cf5vr
@MuhammadAwais-cf5vr 2 роки тому
@@lucadentella i tried using both
@lucadentella
@lucadentella 2 роки тому
@@MuhammadAwais-cf5vr I've just tested my example and it works for me... are you sure your devboard is correctly connected to the Internet?
@MuhammadAwais-cf5vr
@MuhammadAwais-cf5vr 2 роки тому
@@lucadentella yes my board is connected. When i print the rcv_buffer it shows the result but not parsing the json.
@srknyxl
@srknyxl Рік тому
Can i do this with GSM Module?
@lucadentella
@lucadentella Рік тому
if it provides internet connection, I think it should work (you'd probably change something in the HTTPclient part because I think it assumes a wifi connection)
@hungdang6333
@hungdang6333 3 роки тому
How to update via bluetooth on ESP32?
@lucadentella
@lucadentella 3 роки тому
Sparkfun has a great tutorial about it: learn.sparkfun.com/tutorials/esp32-ota-updates-over-ble-from-a-react-web-application/all
@RGPinger
@RGPinger 4 роки тому
hello there... In original ESP-IDF OTA examples, there is only connection to .bin file on webserver (or some net location). That mean, board will download it each time in "loop"? How it know, that bin file changed or not? Or I am not understand it correctly? You have made .json file where you put version 0.2, 0.1 etc.. and if it is difference, it will download bin file and run it.. github.com/espressif/esp-idf/tree/master/examples/system/ota Edit: 2 hours later...... Oh yes... I understand it now. But i cannot compile your code, because it is old with Makefile and make command isnt working on my ESP-IDF 3.3. I dont know how to install it correctly to support toolchain and other dependencies...
@junaidahmed-kc6li
@junaidahmed-kc6li 2 роки тому
How you downloaded certifivcate bundle from gthub?
@RGPinger
@RGPinger 2 роки тому
@@junaidahmed-kc6li you don't need to download it. You have already it in your ESP-IDF. You need only to use it.
@shamilyazeen4062
@shamilyazeen4062 3 роки тому
any way to upload Spiffs via OTA??
@lucadentella
@lucadentella 3 роки тому
sure! it's quite easy to download a file and store it to SPIFFS... you can find several examples with Google
@shamilyazeen4062
@shamilyazeen4062 3 роки тому
@@lucadentella checked everywhere I couldn't find a genuine result! Can someone please share a link or code?
@lucadentella
@lucadentella 3 роки тому
@@shamilyazeen4062 This library should be able to do what you're looking for: github.com/chrisjoyce911/esp32FOTA and check also this forum thread esp32.com/viewtopic.php?t=3775
@shamilyazeen4062
@shamilyazeen4062 3 роки тому
@@lucadentella Thanks Luca . I will check it out :)
@aghaharry8
@aghaharry8 4 роки тому
what to code in ESP ?
@lucadentella
@lucadentella 4 роки тому
hi, code is in my github repo, check the video description
@RSP13
@RSP13 Рік тому
I think I found a security risk. The code only checks for authentication (using the certificate) while calling the "esp_https_ota" function. But the code does not check for authentication while downloading the JSON file. That is enough for a man-in-the-middle-attack, right? For example, an attacker could use DNS spoofing to redirect you to his own JSON file, pointing you to the address of his own malicious binary file. As long as his binary file is hosted on a legit domain with the SAME ROOT CERTIFICATE as the legit binary file's domain, the second authentication check will not detect the deception.
@lucadentella
@lucadentella Рік тому
you're right, in a real application you should perform additional checks (maybe also digitally sign the firmware)
@andreasjonsson3687
@andreasjonsson3687 3 роки тому
Thanks for a great tutorial. Can you recommend alternatives to netsons.co.?
@lucadentella
@lucadentella 3 роки тому
I normally use italian companies (tophost, aruba...) but any hosting providers should do the job...
@dodogot5814
@dodogot5814 2 роки тому
excellent explanation. Thanks for the upload
The EASY Guide To Over-The-Air (OTA) Updates With ArduinoOTA
11:52
Programming Electronics Academy
Переглядів 15 тис.
Китайка и Мармеладный Лего😂😆
00:19
KITAYSKAYA ZMEYKA
Переглядів 2,2 млн
КАК ГЛОТАЮТ ШПАГУ?😳
00:33
Masomka
Переглядів 838 тис.
когда одна дома // EVA mash
00:51
EVA mash
Переглядів 1,9 млн
Лизка заплакала смотря видео котиков🙀😭
00:33
ESP-IDF ESP-32 HTTP/HTTPS OTA(Over The Air) Firmware Update
15:06
Embedded Hacks
Переглядів 12 тис.
#332 ESP32  OTA tutorial with tricks (incl. OTA debugging)
10:17
Andreas Spiess
Переглядів 130 тис.
OTA with the ESP32 (Over The Air)
8:38
Programming Electronics Academy
Переглядів 45 тис.
#232 How to secure our devices using SSL (ESP8266, ESP32, Tutorial)
17:27
Andreas Spiess
Переглядів 113 тис.
ESP32 OTA update via internet (once for ever)
7:10
OTA Drive
Переглядів 10 тис.
PlatformIO: All you need to know in 10 Minutes!
10:56
J's e-shack
Переглядів 276 тис.
OTA Solution - Build your own OTA platform (2/2, ESP32 OTA Application)
14:23
Power AC Coolness with Anker SOLIX F3800
0:27
Anker SOLIX
Переглядів 3,3 млн