OTA with the ESP32 (Over The Air)

  Переглядів 46,759

Programming Electronics Academy

Programming Electronics Academy

2 роки тому

🤩 Check out this Free Arduino Course 👇
bit.ly/get_Arduino_skills
✅ $0 for 1-4 layers PCBs
www.nextpcb.com/register?code...
✅ Register and get $100 from NextPCB:
www.nextpcb.com/pcb-quote?act...
✅ PCB Assembly capabilities info:
www.nextpcb.com/pcb-assembly-...
#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.programmingelectronics.com/
________________________________
**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.**

КОМЕНТАРІ: 100
@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?
@BeyondGTZ
@BeyondGTZ 2 місяці тому
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...
@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!
@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.
@bretonmendozaangelalberto4672
@bretonmendozaangelalberto4672 Рік тому
thank you so much !!
@programmingelectronics
@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.
@ZookeeperJohnG
@ZookeeperJohnG Рік тому
One "Like" is no-where near enough! Well and clearly done, thanks.
@programmingelectronics
@programmingelectronics Рік тому
Thanks!!
@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
@sanabouhaha6637
@sanabouhaha6637 Рік тому
thank you very much you saved us
@dukathneu
@dukathneu Рік тому
Great. Thanks!
@ThePC007
@ThePC007 8 місяців тому
Is there a way to cryptographically sign the firmware to prevent the MCU from being updated by someone else?
@samm928
@samm928 Рік тому
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.
@mizdraji
@mizdraji 7 місяців тому
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
@vladimirastrelin1719
@vladimirastrelin1719 3 місяці тому
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
@programmingelectronics 3 місяці тому
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.
@bxstiii
@bxstiii Рік тому
Thanks!
@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
@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?
@jccidoncha
@jccidoncha 10 місяців тому
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
@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
@timothyerskine4818
@timothyerskine4818 Рік тому
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 Рік тому
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.
@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
@Gorkilein
@Gorkilein 25 днів тому
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 25 днів тому
Sorry for this, that was an oversight in this video! Please see the pinned comments. Here is the updated video: ukposts.info/have/v-deo/b4iVp5loqKeg06M.html
@user-yp5wt5bu5j
@user-yp5wt5bu5j 4 місяці тому
Can I able to update my code from another city ? Hopefully not ! Is there any other method by which I do this stuff?
@flinskikun
@flinskikun Рік тому
Can it be implemented on SIM7600?
@jasonnation6615
@jasonnation6615 Рік тому
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 Рік тому
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!
@melvinbaby2587
@melvinbaby2587 5 місяців тому
Will esp wroom 32 show network port by powering the esp through usb
@programmingelectronics
@programmingelectronics 5 місяців тому
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: ukposts.info/have/v-deo/b4iVp5loqKeg06M.html
@user-tf9pt7yy7w
@user-tf9pt7yy7w Рік тому
Is it possible ota through a custom webserver? If yes, I want to see it on ur channel!
@programmingelectronics
@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!
@altitude1039
@altitude1039 Рік тому
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.
@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
@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 :)
@user-qd6cc3km3l
@user-qd6cc3km3l 6 місяців тому
Hiya, i found that second video. And it works ok thanks.
@programmingelectronics
@programmingelectronics 6 місяців тому
Great!
@randomsoul00
@randomsoul00 6 місяців тому
can you please make a tutorial on same thing but using esp-IDF
@RogerTannous
@RogerTannous 2 роки тому
There should be a way to secure the OTA transfer. Otherwise, anyone would be able to modify your code.
@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"
@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!
@melvin-rh2gr
@melvin-rh2gr 4 місяці тому
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 4 місяці тому
Yes, that is correct.
@roshanakthar.n
@roshanakthar.n Рік тому
when I am uploading my bin file, it is getting paused in 93%, tried several times.
@fernoratube
@fernoratube Рік тому
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 Рік тому
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!
@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
@masoudjafarzadeh
@masoudjafarzadeh Рік тому
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 Рік тому
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 Рік тому
@@programmingelectronics 🙏🙋‍♂️
@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 Рік тому
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.
@hamidemin5690
@hamidemin5690 10 місяців тому
What if we want to use OTA once more
@programmingelectronics
@programmingelectronics 10 місяців тому
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.
@user-gk2ti2by9g
@user-gk2ti2by9g Рік тому
how to upload OTA binary file using linux terminal in esp32
@tonyhodgson6744
@tonyhodgson6744 6 місяців тому
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 6 місяців тому
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 6 місяців тому
My apologies for this issue Tony. Here is a video that more correctly covers this topic: ukposts.info/have/v-deo/b4iVp5loqKeg06M.html
@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.
@amuraojanryanchristiana.6923
@amuraojanryanchristiana.6923 Рік тому
is it available on esp8266?
@programmingelectronics
@programmingelectronics Рік тому
Great question Amurao! Yes it is!
@0124akash
@0124akash Рік тому
Explain only ota part sir
@chesshooligan1282
@chesshooligan1282 Рік тому
What kind of sorcery is this?
@programmingelectronics
@programmingelectronics Рік тому
Programming and electronics ;)
@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 Рік тому
@@programmingelectronics You must have been 'thinking' otherwise you would not have said that!
@programmingelectronics
@programmingelectronics Рік тому
@@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 11 місяців тому
​@@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 8 місяців тому
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 8 місяців тому
Sorry about this issue. It is mentioned in the comments. Here is an updated video: ukposts.info/have/v-deo/b4iVp5loqKeg06M.html
@Sekhar_Home
@Sekhar_Home Рік тому
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.
@user-cw3vo8hv5u
@user-cw3vo8hv5u 7 місяців тому
Simple, but I tried it to no avail and the internet is full of viral videos.
The EASY Guide To Over-The-Air (OTA) Updates With ArduinoOTA
11:52
Programming Electronics Academy
Переглядів 16 тис.
格斗裁判暴力执法!#fighting #shorts
00:15
武林之巅
Переглядів 7 млн
How to Run Linux on an ESP32
18:53
element14 presents
Переглядів 144 тис.
#228 ESP32 Over the Air (OTA) Updates with ONE LINE are EASY!
23:26
Ralph S Bacon
Переглядів 27 тис.
ESP-IDF ESP-32 HTTP/HTTPS OTA(Over The Air) Firmware Update
15:06
Embedded Hacks
Переглядів 12 тис.
ESP32 Guide 2024 | Choosing and Using an ESP32 Board
41:06
DroneBot Workshop
Переглядів 207 тис.
3D Prints Outside for 7 years: What happened? RMRRF2024
29:36
CNC Kitchen
Переглядів 99 тис.
Best OS for programming? Mac vs Windows vs Linux debate settled
8:40
12 Useful & Interesting ESP32 Projects for Beginners!
9:41
ToP Projects Compilation
Переглядів 569 тис.
ESP 8266 Nodemcu Uploading code over wifi | ESP OTA UPDATE
7:54
electronic GURU
Переглядів 50 тис.