OTA with the ESP32 (Over The Air)
🤩 FREE Arduino Crash Course 👇👇
bit.ly/get_Ard...
✅ $0 for 1-4 layers PCBs
www.nextpcb.co...
✅ Register and get $100 from NextPCB:
www.nextpcb.co...
✅ PCB Assembly capabilities info:
www.nextpcb.co...
#NextPCB
**Want to learn more? Check out our courses!**
bit.ly/3GNMF6w
**We designed this circuit board for beginners!**
Kit-On-A-Shield: amzn.to/3lfWClU
FOLLOW US ELSEWHERE
---------------------------------------------------
Facebook: / programmingelectronics...
Twitter: / progelecacademy
Website: www.programmin...
________________________________
**About Us:**
This Arduino lesson was created by Programming Electronics Academy. We are an online education company who seeks to help people learn about electronics and programming through the ubiquitous Arduino development board.
**We have no affiliation whatsoever with Arduino LLC, other than we think they are cool.**
Пікірлер: 104
So what is the ota code segment we have to include in our sketch to be able to use OTA more then once?
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
2 жыл бұрын
It was a ton of fun to use the ESP32! Best of luck Chad!
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
2 ай бұрын
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.
Thanks a lot for your tutorial. At first, I got an Error Message: No monitor available for the port protocol network. Could not connect to ...network port. But when I Compiled&Uploaded the same sketch second time everything worked just fine .. Thanks again for your video, it opened up new great possibilities !
@programmingelectronics
6 ай бұрын
Great to hear! There is also an updated video about this, you should be able to find linked in the comments that is definitely worth watching, as I left out something important in this lesson.
One "Like" is no-where near enough! Well and clearly done, thanks.
@programmingelectronics
2 жыл бұрын
Thanks!!
There should be a way to secure the OTA transfer. Otherwise, anyone would be able to modify your code.
Hi, great work . Is there any tutorial on how to implement/combine the code so that I can run this more than once?
@programmingelectronics
Жыл бұрын
Not yet -> I need to do a follow up on this!
@talhasami150
Жыл бұрын
@@programmingelectronics Thanks I will be waiting
I have found using the delay() function interferes (failed connections) with OTA. Delays should be seldom used or kept short (
@programmingelectronics
2 жыл бұрын
Thanks for the note! Maybe it's my router - the 2G always seems to connect quickly.
@dieofthebeholder
2 жыл бұрын
I assumed it meant 2.4GHz vs 5GHz, but also had a moment of pause when I heard it.
@mr.goldenrod291
2 жыл бұрын
@@dieofthebeholder Makes sense now. Good call!
@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
Жыл бұрын
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.
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
4 ай бұрын
Sorry for this, that was an oversight in this video! Please see the pinned comments. Here is the updated video: kzread.info/dash/bejne/aYyY1cVqodTVotI.html
Great video! how to upgrade .bin file firmware to esp32? Espresense had ota supported already.
This is so cool. I tried and it worked like a charm. I like it.
@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
Жыл бұрын
@@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.
Hiya, i found that second video. And it works ok thanks.
@programmingelectronics
9 ай бұрын
Great!
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 ??
What if we want to use OTA once more
@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.
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.
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
Do you have the same example with VScode?
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
2 жыл бұрын
That is correct. What I should have done is include that OTA function again!
@MathiasBacher
2 жыл бұрын
@@programmingelectronics Would be awesome if you could explain that in more detail in a pinned comment :)
Great. Thanks!
Will esp wroom 32 show network port by powering the esp through usb
@programmingelectronics
8 ай бұрын
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: kzread.info/dash/bejne/aYyY1cVqodTVotI.html
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
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!
What kind of sorcery is this?
@programmingelectronics
Жыл бұрын
Programming and electronics ;)
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
thank you so much !!
@programmingelectronics
Жыл бұрын
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.
can you please make a tutorial on same thing but using esp-IDF
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
Жыл бұрын
Great question, but to be honest, I am not sure of the answer! Sorry I couldn't be of more help on this!
@masoudjafarzadeh
Жыл бұрын
@@programmingelectronics 🙏🙋♂️
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
thank you very much you saved us
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
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
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
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
2 жыл бұрын
I should have read deeper, just found my answer in other's comments.
@programmingelectronics
2 жыл бұрын
Sorry about that Jim - this video could have been done much better!
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
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
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
Жыл бұрын
Do you have a code for this? If you do, send the github
When I upload the blink code it gives me this error "No response from device Failed uploading: uploading error: exit status 1"
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
Жыл бұрын
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.
Thanks!
The ESP32 can only connect on 2G, 2.4Ghz, not on 5Ghz.
@programmingelectronics
2 жыл бұрын
I wasn't thinking when I said that - sorry about that!
@rodneytapit5636
Жыл бұрын
@@programmingelectronics You must have been 'thinking' otherwise you would not have said that!
@programmingelectronics
Жыл бұрын
@@rodneytapit5636 I wasn't thinking clearly :)
when I am uploading my bin file, it is getting paused in 93%, tried several times.
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
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
Жыл бұрын
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.
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
9 ай бұрын
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
9 ай бұрын
My apologies for this issue Tony. Here is a video that more correctly covers this topic: kzread.info/dash/bejne/aYyY1cVqodTVotI.html
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
8 ай бұрын
Yes, that is correct.
how to upload OTA binary file using linux terminal in esp32
Is it possible ota through a custom webserver? If yes, I want to see it on ur channel!
@programmingelectronics
Жыл бұрын
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!
Can I able to update my code from another city ? Hopefully not ! Is there any other method by which I do this stuff?
Explain only ota part sir
Is there a way to cryptographically sign the firmware to prevent the MCU from being updated by someone else?
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
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!
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?
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
Жыл бұрын
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
Жыл бұрын
@@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.
Simple, but I tried it to no avail and the internet is full of viral videos.
Can it be implemented on SIM7600?
Nice
@programmingelectronics
2 жыл бұрын
Thanks for watching!
But we can't make it update again if we wants to....
@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.
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
11 ай бұрын
Sorry about this issue. It is mentioned in the comments. Here is an updated video: kzread.info/dash/bejne/aYyY1cVqodTVotI.html
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
Жыл бұрын
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
Жыл бұрын
@@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.
is it available on esp8266?
@programmingelectronics
Жыл бұрын
Great question Amurao! Yes it is!