OTA with the ESP32 (Over The Air)

  Рет қаралды 57,487

Programming Electronics Academy

Programming Electronics Academy

Күн бұрын

Пікірлер: 110
@bernardmarx6705
@bernardmarx6705 2 жыл бұрын
So what is the ota code segment we have to include in our sketch to be able to use OTA more then once?
@jeancarloschararoque4163
@jeancarloschararoque4163 3 ай бұрын
you need to join the two codes. I tried it and it works now.
@ChadKapper
@ChadKapper 2 жыл бұрын
I just found my next project… I’ve been meaning to learn how to do this. I’m going to do this over the weekend.
@programmingelectronics
@programmingelectronics 2 жыл бұрын
It was a ton of fun to use the ESP32! Best of luck Chad!
@BeyondGTZ
@BeyondGTZ 9 ай бұрын
If I understood correctly, this technique can be applied only once. If I want to apply additional firmware OTA updates it won't be possible because the original OTA sketch was overwritten by the Blink code...
@zuppy2
@zuppy2 5 ай бұрын
that's why the second firmware has to also contain ota capability. it wasn't shown in this vedo in order to make it simpler to validate that it works.
@eliasram1822
@eliasram1822 Ай бұрын
This is magic!!! Thanks man
@programmingelectronics
@programmingelectronics Ай бұрын
Thanks for watching - good luck! Side note, there is an updated version of this video you should check out. It's referenced in the comments.
@mr.goldenrod291
@mr.goldenrod291 2 жыл бұрын
I have found using the delay() function interferes (failed connections) with OTA. Delays should be seldom used or kept short (
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks for the note! Maybe it's my router - the 2G always seems to connect quickly.
@dieofthebeholder
@dieofthebeholder 2 жыл бұрын
I assumed it meant 2.4GHz vs 5GHz, but also had a moment of pause when I heard it.
@mr.goldenrod291
@mr.goldenrod291 2 жыл бұрын
@@dieofthebeholder Makes sense now. Good call!
@sausagehider
@sausagehider 2 жыл бұрын
That 2G and 5G confused me too. I also didn't make the link between 2G and 2.4Ghz or 5G and 5 Ghz. Could be your 5Ghz is effected more by your walls and floors etc.
@tncowboybuck
@tncowboybuck 2 жыл бұрын
I have not tried this yet but in theory since this is an ESP32 and has RTOS you should be using RTOS tasks to avoid any interference with Wi-Fi and anything else.
@ZookeeperJohnG
@ZookeeperJohnG 2 жыл бұрын
One "Like" is no-where near enough! Well and clearly done, thanks.
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks!!
@atlantikus77
@atlantikus77 Жыл бұрын
This is so cool. I tried and it worked like a charm. I like it.
@programmingelectronics
@programmingelectronics Жыл бұрын
Great! Make sure to take a close look at the comments, because you'll need to included the OTA code in every sketch.
@atlantikus77
@atlantikus77 Жыл бұрын
@@programmingelectronics I figured it out after first selfoverwrite. Honestly it should be mentioned in the video that all setup and ArduinoOTA.handle(); in thel loop to be placed. It could be trap for many young players as I have read comments. What I'm actually working on is bitcoint ticker with nice VFD display. So I need Wi-Fi during program runtime. I plan to display also progress during OTA update as it is currently sent to serial.
@talhasami150
@talhasami150 Жыл бұрын
Hi, great work . Is there any tutorial on how to implement/combine the code so that I can run this more than once?
@programmingelectronics
@programmingelectronics Жыл бұрын
Not yet -> I need to do a follow up on this!
@talhasami150
@talhasami150 Жыл бұрын
@@programmingelectronics Thanks I will be waiting
@RogerTannous
@RogerTannous 2 жыл бұрын
There should be a way to secure the OTA transfer. Otherwise, anyone would be able to modify your code.
@MrI8igmac
@MrI8igmac 3 ай бұрын
So. Reading comments. The blink code should be changed to include the ota code as well?
@programmingelectronics
@programmingelectronics 3 ай бұрын
Yes, , sorry about that -> here is the updated video: kzbin.info/www/bejne/bYnHpJZnptaiqNE
@YigalBZ
@YigalBZ 5 ай бұрын
Do you have the same example with VScode?
@dukathneu
@dukathneu Жыл бұрын
Great. Thanks!
@TonyHodgson-e9q
@TonyHodgson-e9q Жыл бұрын
Hiya, i found that second video. And it works ok thanks.
@programmingelectronics
@programmingelectronics Жыл бұрын
Great!
@hamidemin5690
@hamidemin5690 Жыл бұрын
What if we want to use OTA once more
@programmingelectronics
@programmingelectronics Жыл бұрын
It was my bad, if you read some other comments, you can see that you need to ket the OTA code in the sketch you upload, or you'll be out of luck.
@Gorkilein
@Gorkilein 7 ай бұрын
Great but once Blink is on there and the OTA Sketch therefore overwritren with blink I can't update my Blink sketch anymore OTA because the Sketch was changed right?
@programmingelectronics
@programmingelectronics 7 ай бұрын
Sorry for this, that was an oversight in this video! Please see the pinned comments. Here is the updated video: kzbin.info/www/bejne/bYnHpJZnptaiqNE
@melvinbaby2587
@melvinbaby2587 Жыл бұрын
Will esp wroom 32 show network port by powering the esp through usb
@programmingelectronics
@programmingelectronics Жыл бұрын
This is a great question! I just tested this with an ESP32 Wroom DA module, and yes, it shows up as a network port (with a WiFi symbol next to the board/port in Arduino IDE 2) in addition to it showing up as a serial port. Side Note: This video misses a key step, please watch our more thorough walk through of ESP32 OTA here: kzbin.info/www/bejne/bYnHpJZnptaiqNE
@rajubai0077
@rajubai0077 2 ай бұрын
Sir I need this requirement is this possible by this technique my iot application is some places I need through software reset the esp32 device give some suggestions
@davidforbes9299
@davidforbes9299 4 ай бұрын
Great video! how to upgrade .bin file firmware to esp32? Espresense had ota supported already.
@bretonmendozaangelalberto4672
@bretonmendozaangelalberto4672 2 жыл бұрын
thank you so much !!
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Glad it helped - please take a close look at the comments here. One thing left out in this video is making sure that your update code also includes the OTA code, or else you won;t be able to perform the OTA more than once.
@pigeonramier6898
@pigeonramier6898 4 ай бұрын
ok but when the esp32 is in other wifi router than yours ? for example friend of mine i gave a prototype to test and feedback ??
@fin3125
@fin3125 2 жыл бұрын
It looks like the way you did it is a one time thing. When you upload the blink sketch you wiped out the OTA code. Is that correct?
@programmingelectronics
@programmingelectronics 2 жыл бұрын
That is correct. What I should have done is include that OTA function again!
@MathiasBacher
@MathiasBacher 2 жыл бұрын
@@programmingelectronics Would be awesome if you could explain that in more detail in a pinned comment :)
@ernestorivero9909
@ernestorivero9909 Жыл бұрын
have a program that sends message by Bluetooth to a matrix led works well but I want to load it by OTA but I just put in the setup: SerialBT ("robotics 2") which is the name of the Bluetooth that I gave me says error when compiling for the ESP32 board, you will know why this happens, by cable I charge it well
@masoudjafarzadeh
@masoudjafarzadeh 2 жыл бұрын
Great But i have a problem Why when I close all open programs And then open a new program The serial board is not activated via Wi-Fi After rest my computer i see again serial wifi on the arduino
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Great question, but to be honest, I am not sure of the answer! Sorry I couldn't be of more help on this!
@masoudjafarzadeh
@masoudjafarzadeh 2 жыл бұрын
@@programmingelectronics 🙏🙋‍♂️
@jimcraig5727
@jimcraig5727 2 жыл бұрын
Uploaded the Air Magic sketch via the USB Port. Unplugged it, found the network port and uploaded a blink sketch successfully. Make a change to the delay rate in the blink sketch and try to upload it again and get a No Response error from the ESP32. Only way I can upload the modified blink sketch is to plug the ESP32 back into the computer, go through the process of re-uploading Air magic, unplug it and upload the modified blink sketch. What am I missing?
@jimcraig5727
@jimcraig5727 2 жыл бұрын
I should have read deeper, just found my answer in other's comments.
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Sorry about that Jim - this video could have been done much better!
@sanabouhaha6637
@sanabouhaha6637 Жыл бұрын
thank you very much you saved us
@samm928
@samm928 2 жыл бұрын
Hi .. I used ElegantOTA and for most applications it works well however, if the application uses FastLED NEOmatrix the LEDs stop working as soon as WiFi is turned on.
@fernoratube
@fernoratube 2 жыл бұрын
Why does my "network port option" disappear after I close/open my IDE and power cycle my ESP32? I'm able to execute all the steps in this video successfully but my network IP port is gone
@programmingelectronics
@programmingelectronics 2 жыл бұрын
FRG - what this video left out was making sure to include the OTA code in the new sketch you upload. There are a couple comments about that below. Sorry for leaving that out!
@bxstiii
@bxstiii Жыл бұрын
Thanks!
@randomsoul00
@randomsoul00 Жыл бұрын
can you please make a tutorial on same thing but using esp-IDF
@AurSunaaoKyaHaalHai
@AurSunaaoKyaHaalHai Жыл бұрын
Hi.. could u please send any link or give some suggestions for installing network port. Actually I have only serial port on my arduino IDE. Perhaps some drivers might be missing in device manager
@jccidoncha
@jccidoncha Жыл бұрын
How would it be if i want to work with a SIM module to connect the ESP32 to a cloud via 4g, to update the code of the ESP32 from any place instead of using the wifi
@ParthivGajipara
@ParthivGajipara 11 ай бұрын
Can I able to update my code from another city ? Hopefully not ! Is there any other method by which I do this stuff?
@tonyhodgson6744
@tonyhodgson6744 Жыл бұрын
Hi, Ive uploaded the Basic OTA into my ESP32 ok, got the IP address OK, but when i try to upload the blinky code it firstly asks for a password... which i just type my windows password as i dont understand this, anyway it proceeds to upload via the 192.168 network but only gets to 2% then flags an error, does anyone know why... thanks
@tonyhodgson6744
@tonyhodgson6744 Жыл бұрын
Ive got this working fine now, i had changed the partition scheme so no OTA, its now at minimal spiffs and working OK, only issue now is it will only upload code once then i lose the ip port to send code again.....
@programmingelectronics
@programmingelectronics Жыл бұрын
My apologies for this issue Tony. Here is a video that more correctly covers this topic: kzbin.info/www/bejne/bYnHpJZnptaiqNE
@melvin-rh2gr
@melvin-rh2gr 11 ай бұрын
if i need to upload the code wirelessly to esp32 board, shouldn't me and the esp 32 be in the same network and within a small range
@programmingelectronics
@programmingelectronics 11 ай бұрын
Yes, that is correct.
@mizdraji
@mizdraji Жыл бұрын
Hello, very good video, but I am having problems with the firewall, when I disable it it works OTA. I already opened TCP and UDP ports but it still doesn't work without the firewall disabled, any solution? thank you
@altitude1039
@altitude1039 2 жыл бұрын
Does this only work if it is on your Wi-Fi, or will it also work if it is connected to someone else's Wi-Fi network? Provided you know the devices ip address. So you can do "firmware" updates to a device not in your own home.
@SchwaAlien
@SchwaAlien Жыл бұрын
You would need to set up port forwarding on the router, otherwise a computer like a Pi on that same network would be needed to communicate with it for this method unless it were to check a server (potentially on your network) for the updated binary, there’s an example that uses Amazon AWS servers but it can be any server you can upload to.
@AniktaVanshette
@AniktaVanshette Жыл бұрын
how to upload OTA binary file using linux terminal in esp32
@AliEjaz-ne1ei
@AliEjaz-ne1ei Жыл бұрын
When I upload the blink code it gives me this error "No response from device Failed uploading: uploading error: exit status 1"
@zaighummohd6018
@zaighummohd6018 Жыл бұрын
hello, i am doing the same as you told me, but in respond its saying no respond from device, whats wrong in it. kindly help
@KiTO키토
@KiTO키토 2 жыл бұрын
Is it possible ota through a custom webserver? If yes, I want to see it on ur channel!
@programmingelectronics
@programmingelectronics 2 жыл бұрын
This is a great question! I am not sure to be honest, but I see if we can do try it on the channel! Thanks for the great question!
@roshanakthar.n
@roshanakthar.n Жыл бұрын
when I am uploading my bin file, it is getting paused in 93%, tried several times.
@0124akash
@0124akash Жыл бұрын
Explain only ota part sir
@Антић-у8э
@Антић-у8э 2 ай бұрын
Is this free or I need to pay for maker plan?
@programmingelectronics
@programmingelectronics 2 ай бұрын
It is free
@chesshooligan1282
@chesshooligan1282 2 жыл бұрын
What kind of sorcery is this?
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Programming and electronics ;)
@OcenaSoft
@OcenaSoft 2 жыл бұрын
Hi, Great video and so much better than a bunch I have seen on here. How do I implement/combine the code so that I can run this more than once? You bring this in to make it OTA, but then you only get one shot at the OTA, then you have to go and plug it back in again. HOW is it possible to have the ability to do this forever?
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks Dave! I need to release another video on this covering just that (and it's a shame I didn't in this video) It's pretty straightforward, for every new sketch (aka update) you upload, you include that ArduinoOTA.onStart function, and the ArduinoOTA.begin() function in setup, and then in the loop you make a call to ArduinoOTA.handle() I am not sure how often ArduinoOTA.handle() needs to be called, but I would imagine you do not want any delays inside your loop code else it would mess up the OTA I believe. I hope this helps some! Thanks again for watching!
@OcenaSoft
@OcenaSoft 2 жыл бұрын
@@programmingelectronics thanks for the reply, makes sense to me. I guess I was running before I could walk haha… shame as your video has to be the best out there for demonstrating how easy this is and I can’t understand why it’s taken me so long to come across your video. Thanks - Dave
@flinskikun
@flinskikun Жыл бұрын
Can it be implemented on SIM7600?
@timothyerskine4818
@timothyerskine4818 2 жыл бұрын
Could this be used with a deep sleep sketch? Have a remote solar monitor and would be great to tweak the code using OTA from time to time.
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Great question! I'm not completely sure and it probably depends, but I think deep sleep usually implies that WiFi is off, which would rule out OTA. But perhaps, during its brief wakeup moments, you have it enable an OTA window for a short period?
@SchwaAlien
@SchwaAlien Жыл бұрын
You could potentially do it in reverse where it is checking a server for a new valid binary file to download and flash every time it wakes up, it wouldn’t be as quick or convenient but would do the trick.
@ThePC007
@ThePC007 Жыл бұрын
Is there a way to cryptographically sign the firmware to prevent the MCU from being updated by someone else?
@jasonnation6615
@jasonnation6615 2 жыл бұрын
How would I go about using the esp32 as a simple wifi antenna for my laptop? for example if my wifi card inside was to fail, could I use the esp32 to connect and surf?
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Not sure to be honest! There is this project on github: github.com/fabio-d/esp32-tuntap I think if you search for "esp32 as wifi dongle" you might be able to dig something up. Best of luck!
@amuraojanryanchristiana.6923
@amuraojanryanchristiana.6923 2 жыл бұрын
is it available on esp8266?
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Great question Amurao! Yes it is!
@terryr6774
@terryr6774 Жыл бұрын
Thx 4 this vid ... both the Web OTA and Elegant OTA solutions appear to require Internet connectivity something I specifically deny to any ESP32 device ... b4 seeing your vid, the KEY detail I was missing for this OTA Sketch was that it linked the Arduino IDE to the ESP32 device using MDNS protocols (this was the AHA moment I got from your vid) ... I have now taken this sketch two steps further by encapsulating the Setup and Loop code with a flag triggered by a special URL which puts the ESP32 into what I call OTA Mode ... the Arduino IDE won't see the MDNS Port until the ESP32 is called via :/ ... the server.on code for / runs the OTA setup code plus sets a flag allowing the loop code to exclusively run the OTA handler (effectively turns off ALL other ESP32 functions until the OTA is completed) ... also extended the watchdog timer to 10 minutes which will reset/restart the ESP32 should the OTA either fail OR is never started ... when the OTA is complete the ESP32 is rebooted automatically which resets the OTA mode until it is manually invoked again.
@belezamyfriend
@belezamyfriend Жыл бұрын
Do you have a code for this? If you do, send the github
@dhavalshukla6615
@dhavalshukla6615 2 жыл бұрын
Unfortunately OTA takes place with the WiFi credentials shared. That means if my ESP32 was deployed in a Robot far far away, and I tried to send them this, over OTA, I would need OTA Web Updater, right? I have been trying to do that, and yet cannot seem to be connected to the local IP address, I am still just learning this, I have high hopes for the OTA features as an Intern Robotics Engineer. I am going to so use that.... Is there a video you created for the Web Updater?
@tinker-maniac3084
@tinker-maniac3084 2 жыл бұрын
Nice
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks for watching!
@renosiskasyaflina2827
@renosiskasyaflina2827 Жыл бұрын
Hi, GREAT video. I try it, but I dont have message "uploading === 100%done. I have uploading....................... always. I was waiting so long, More than 3 hour and same message "uploading........." I dont know why. but, my esp and lCD can work with the program I have uploaded. I hope you can help me. Thank you
@programmingelectronics
@programmingelectronics Жыл бұрын
Hi Reno! OK, it probably shouldn't take more than 30-45 seconds to upload to your ESP32 board, so 3 hours is definitely an issue. I would attempt to uplug the board, and plug it back in, also perhaps try closing the Arduino IDE, and opening it again. You also might pressing the boot button on your board if it has one. Then try uploading again. Side note, is this an issue with every sketch you are trying to upload?
@renosiskasyaflina2827
@renosiskasyaflina2827 Жыл бұрын
​@@programmingelectronics Yes, everytime I upload new code, I dont get message "uploading 100% done". always "uploading .............." the esp32 can work. but the process is not finished, always writing " uploading ..............." I have done to boot. but not working either. when I upload new code, the esp not responding.
@Sekhar_Home
@Sekhar_Home 2 жыл бұрын
But we can't make it update again if we wants to....
@steveanimatrix3887
@steveanimatrix3887 Жыл бұрын
You need to include the ota code for every update in addition to your regular code changes, not just the first time. It needs to be a part of your project permanently if you want to always be able to OTA update.
@Tony770jr
@Tony770jr 2 жыл бұрын
The ESP32 can only connect on 2G, 2.4Ghz, not on 5Ghz.
@programmingelectronics
@programmingelectronics 2 жыл бұрын
I wasn't thinking when I said that - sorry about that!
@rodneytapit5636
@rodneytapit5636 2 жыл бұрын
@@programmingelectronics You must have been 'thinking' otherwise you would not have said that!
@programmingelectronics
@programmingelectronics 2 жыл бұрын
@@rodneytapit5636 I wasn't thinking clearly :)
@apostolosn5536
@apostolosn5536 Жыл бұрын
Nice but it would be nice to explain how to add OTA to a new code so it can be repeated again and again and not only one time.
@paulkoepnick7122
@paulkoepnick7122 Жыл бұрын
You can, just take code you made for example a blink program then copy the 3 sections of the blink program (Global, setup, loop) and paste them in the 3 sections of the OTA program leaving the OTA stuff untouched and there you have it, now you can download and change your blink program as many times as you want with OTA.
@iandwyer6658
@iandwyer6658 Жыл бұрын
​@@paulkoepnick7122 Callbacks have a loop which is usually blocking but some have nonblocking options, but if it works as you say, then it should be easy to run in the background of any program. Another option if blocking is an issue, as I have only worked with ROS and MQTT callbacks: ESP32S devices are dual core, so your second core can run the OTA server while the other runs your primary program. This is especially handy if you need to run multiple callbacks from different functions as the loops wont interfere and reduce chance of threading error due to improperly incorporated callback loops. If you want to always program this way, make a template to insert into all your other codes, the method requires no difference in setup between uploads. Also, you do not need to read your IP from the monitor (which comes from your wifi setup section using the localIP() constructor in the setup not the OTA callback section in the setup) I suggest always creating a static IP and knowing all devices on your network. Static, vs DHCP, significantly improves connection reliability and the amount of time it takes to connect to a network using general IoT devices. This may help a few of the people who may ask the same questions as Ive seen below get some ideas to try out.
@desgeneradotv
@desgeneradotv Жыл бұрын
ok video is almost accurate while still missleading. at least in my case when trying this method by the time you upload the 2nd code with your actual code it will stop to work OTA. you need to actually mix your code with the OTA code for it to work consistently otherwise it will only work the first time. thought maybe somebody else could save some time, peace!
@programmingelectronics
@programmingelectronics Жыл бұрын
Sorry about this issue. It is mentioned in the comments. Here is an updated video: kzbin.info/www/bejne/bYnHpJZnptaiqNE
@万沪-s3c
@万沪-s3c Жыл бұрын
Simple, but I tried it to no avail and the internet is full of viral videos.
ESPNOW for beginners! #ESP32 #ESP8266
35:09
Programming Electronics Academy
Рет қаралды 158 М.
ESP32 Guide 2024 | Choosing and Using an ESP32 Board
41:06
DroneBot Workshop
Рет қаралды 349 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 650 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 25 МЛН
#228 ESP32 Over the Air (OTA) Updates with ONE LINE are EASY!
23:26
Ralph S Bacon
Рет қаралды 29 М.
The EASY Guide To Over-The-Air (OTA) Updates With ArduinoOTA
11:52
Programming Electronics Academy
Рет қаралды 28 М.
#332 ESP32  OTA tutorial with tricks (incl. OTA debugging)
10:17
Andreas Spiess
Рет қаралды 137 М.
12 Mind-Blowing ESP32 Projects to try in 2024!
8:50
ToP Projects Compilation
Рет қаралды 208 М.
Why build an entire computer on breadboards?
28:43
Ben Eater
Рет қаралды 3,1 МЛН
HOW DO OTA UPDATES HAPPEN IN THE ESP32? | ADVANCED ESP32
9:06
The Best 20 Arduino Projects of the year 2024!
14:59
ToP Projects Compilation
Рет қаралды 82 М.