Тёмный

ESP32 OTA via HTTPS 

Luca Dentella
Подписаться 3,3 тыс.
Просмотров 52 тыс.
50% 1

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...

Наука

Опубликовано:

 

26 окт 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 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!
@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.
@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!
@AndreaSalvatori92
@AndreaSalvatori92 5 лет назад
Grazie per il video. Molto utile come, d'altronde, il resto delle sue pubblicazioni
@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
@arunbm123
@arunbm123 5 лет назад
brilliant tutorials
@tomvenice
@tomvenice 5 лет назад
Complimenti, ottimo video, molto utile!!
@lucadentella
@lucadentella 5 лет назад
grazie mille!
@yashizuko
@yashizuko 6 месяцев назад
Grande! molto chiaro ed utile
@nickfelstead7559
@nickfelstead7559 2 года назад
Thabks for this!
@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).
@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.
@sixhundred243
@sixhundred243 Год назад
You’re my Hero.
@lucadentella
@lucadentella Год назад
;) thanks
@habbabyhnos1203
@habbabyhnos1203 Год назад
I love you! 😁 Thankssssssssssssss!
@dr.hriturajrohariya
@dr.hriturajrohariya 2 года назад
You are a Gem... 👍👍👍
@lucadentella
@lucadentella 2 года назад
thanks!
@sixhundred243
@sixhundred243 Год назад
Incredible.
@abbarajumanojsai7096
@abbarajumanojsai7096 4 года назад
Hello Luca , how do you used step by step debugging for esp32
@laxmipathymaisale9081
@laxmipathymaisale9081 5 лет назад
I followed esp32 simple ota example.openssl gives .rnd file not found
@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
@asierdanjou3905
@asierdanjou3905 8 месяцев назад
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 8 месяцев назад
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
@FrankWolf74
@FrankWolf74 3 года назад
Thank you
@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
@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
@md.jahangiralam6658
@md.jahangiralam6658 7 месяцев назад
Thanks from bangladesh.
@iramtrabelsi6799
@iramtrabelsi6799 7 месяцев назад
hi can u help me to do this project
@riz237
@riz237 3 года назад
Good day Luca, How can we begin the OTA process in Http without having/passing any certificates?
@lucadentella
@lucadentella 3 года назад
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...)
@KK-ib5nh
@KK-ib5nh Год назад
I am trying esp idf simple ota example. But i am getting error OTA image invalid magic byte How to solve this ?
@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 ?
@zameerahmed1775
@zameerahmed1775 11 месяцев назад
Too good ...........
@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 7 месяцев назад
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 7 месяцев назад
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)
@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)
@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
@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.
@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) :-)
@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)
@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?
@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.
@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)
@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..
@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
@andreasjonsson3687
@andreasjonsson3687 4 года назад
Thanks for a great tutorial. Can you recommend alternatives to netsons.co.?
@lucadentella
@lucadentella 4 года назад
I normally use italian companies (tophost, aruba...) but any hosting providers should do the job...
@aghaharry8
@aghaharry8 4 года назад
what to code in ESP ?
@lucadentella
@lucadentella 4 года назад
hi, code is in my github repo, check the video description
@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 :)
@muhammadsharjeel4941
@muhammadsharjeel4941 9 месяцев назад
How to solve certificate issue?
@lucadentella
@lucadentella 9 месяцев назад
which issue?
@muhammadsharjeel4941
@muhammadsharjeel4941 9 месяцев назад
@@lucadentella i am facing handshake issue mdtls handshake issue... please do upload one video on it please.......
@user-qj1jx6wi4l
@user-qj1jx6wi4l 3 месяца назад
did you solve?@@muhammadsharjeel4941
@dodogot5814
@dodogot5814 2 года назад
excellent explanation. Thanks for the upload
Далее
OG Buda - Сделай Мне Приятно Щас
02:24
Malware Development: Processes, Threads, and Handles
31:29
OTA with the ESP32 (Over The Air)
8:38
Просмотров 49 тыс.
PlatformIO: All you need to know in 10 Minutes!
10:56
Просмотров 294 тыс.
Как разблокировать айфон?
0:27
Просмотров 152 тыс.
Choose a phone for your mom
0:20
Просмотров 6 млн