OTA with the ESP32 (Over The Air)

Поделиться
HTML-код
  • Опубликовано: 24 фев 2022
  • 🤩 FREE Arduino Crash 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.**

Комментарии • 102

  • @bernardmarx6705
    @bernardmarx6705 2 года назад +33

    So what is the ota code segment we have to include in our sketch to be able to use OTA more then once?

  • @ChadKapper
    @ChadKapper 2 года назад +8

    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.

  • @AurSunaaoKyaHaalHai
    @AurSunaaoKyaHaalHai Год назад +1

    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

  • @YigalBZ
    @YigalBZ 14 дней назад

    Do you have the same example with VScode?

  • @ZookeeperJohnG
    @ZookeeperJohnG 2 года назад +7

    One "Like" is no-where near enough! Well and clearly done, thanks.

  • @mizdraji
    @mizdraji 9 месяцев назад

    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

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

  • @dukathneu
    @dukathneu Год назад +1

    Great. Thanks!

  • @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

  • @flinskikun
    @flinskikun Год назад

    Can it be implemented on SIM7600?

  • @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?

  • @sanabouhaha6637
    @sanabouhaha6637 Год назад

    thank you very much you saved us

  • @user-yp5wt5bu5j
    @user-yp5wt5bu5j 6 месяцев назад

    Can I able to update my code from another city ? Hopefully not !
    Is there any other method by which I do this stuff?

  • @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

  • @bxstiii
    @bxstiii Год назад

    Thanks!

  • @ThePC007
    @ThePC007 10 месяцев назад

    Is there a way to cryptographically sign the firmware to prevent the MCU from being updated by someone else?

  • @bretonmendozaangelalberto4672
    @bretonmendozaangelalberto4672 Год назад +1

    thank you so much !!

    • @programmingelectronics
      @programmingelectronics  Год назад +1

      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.

  • @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

  • @randomsoul00
    @randomsoul00 8 месяцев назад

    can you please make a tutorial on same thing but using esp-IDF

  • @atlantikus77
    @atlantikus77 Год назад +1

    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 Год назад +1

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

  • @BeyondGTZ
    @BeyondGTZ 4 месяца назад +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...

    • @zuppy2
      @zuppy2 22 дня назад

      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.

  • @RogerTannous
    @RogerTannous 2 года назад +3

    There should be a way to secure the OTA transfer. Otherwise, anyone would be able to modify your code.

  • @user-gk2ti2by9g
    @user-gk2ti2by9g Год назад

    how to upload OTA binary file using linux terminal in esp32

  • @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  Год назад +1

      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!

  • @Gorkilein
    @Gorkilein 2 месяца назад +1

    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  2 месяца назад

      Sorry for this, that was an oversight in this video! Please see the pinned comments.
      Here is the updated video: ruclips.net/video/7Xdsc1qqoro/видео.html

  • @talhasami150
    @talhasami150 Год назад +5

    Hi, great work . Is there any tutorial on how to implement/combine the code so that I can run this more than once?

  • @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"

  • @timothyerskine4818
    @timothyerskine4818 Год назад +1

    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 Год назад +3

      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.

  • @vladimirastrelin1719
    @vladimirastrelin1719 5 месяцев назад +1

    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  5 месяцев назад +1

      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.

  • @roshanakthar.n
    @roshanakthar.n Год назад

    when I am uploading my bin file, it is getting paused in 93%, tried several times.

  • @altitude1039
    @altitude1039 2 года назад +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
      @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.

  • @fin3125
    @fin3125 2 года назад +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 года назад +2

      That is correct. What I should have done is include that OTA function again!

    • @MathiasBacher
      @MathiasBacher 2 года назад +1

      @@programmingelectronics Would be awesome if you could explain that in more detail in a pinned comment :)

  • @melvinbaby2587
    @melvinbaby2587 7 месяцев назад +1

    Will esp wroom 32 show network port by powering the esp through usb

    • @programmingelectronics
      @programmingelectronics  7 месяцев назад

      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:
      ruclips.net/video/7Xdsc1qqoro/видео.html

  • @jimcraig5727
    @jimcraig5727 2 года назад +1

    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 года назад +2

      I should have read deeper, just found my answer in other's comments.

    • @programmingelectronics
      @programmingelectronics  2 года назад +1

      Sorry about that Jim - this video could have been done much better!

  • @user-tf9pt7yy7w
    @user-tf9pt7yy7w 2 года назад +1

    Is it possible ota through a custom webserver?
    If yes, I want to see it on ur channel!

    • @programmingelectronics
      @programmingelectronics  Год назад +1

      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!

  • @fernoratube
    @fernoratube 2 года назад +1

    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 года назад +1

      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!

  • @melvin-rh2gr
    @melvin-rh2gr 6 месяцев назад

    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

  • @OcenaSoft
    @OcenaSoft 2 года назад +4

    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 года назад +4

      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 года назад +1

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

  • @user-qd6cc3km3l
    @user-qd6cc3km3l 8 месяцев назад +1

    Hiya, i found that second video. And it works ok thanks.

  • @0124akash
    @0124akash Год назад

    Explain only ota part sir

  • @hamidemin5690
    @hamidemin5690 Год назад +1

    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.

  • @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

  • @masoudjafarzadeh
    @masoudjafarzadeh Год назад +1

    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 года назад +4

    I have found using the delay() function interferes (failed connections) with OTA. Delays should be seldom used or kept short (

    • @programmingelectronics
      @programmingelectronics  2 года назад +1

      Thanks for the note!
      Maybe it's my router - the 2G always seems to connect quickly.

    • @dieofthebeholder
      @dieofthebeholder 2 года назад +5

      I assumed it meant 2.4GHz vs 5GHz, but also had a moment of pause when I heard it.

    • @mr.goldenrod291
      @mr.goldenrod291 2 года назад +1

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

  • @amuraojanryanchristiana.6923
    @amuraojanryanchristiana.6923 Год назад +1

    is it available on esp8266?

  • @tinker-maniac3084
    @tinker-maniac3084 2 года назад +1

    Nice

  • @chesshooligan1282
    @chesshooligan1282 Год назад +2

    What kind of sorcery is this?

  • @tonyhodgson6744
    @tonyhodgson6744 8 месяцев назад +1

    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 8 месяцев назад +1

      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  8 месяцев назад

      My apologies for this issue Tony. Here is a video that more correctly covers this topic: ruclips.net/video/7Xdsc1qqoro/видео.html

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

  • @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 Год назад +1

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

  • @Sekhar_Home
    @Sekhar_Home Год назад

    But we can't make it update again if we wants to....

    • @steveanimatrix3887
      @steveanimatrix3887 Год назад +1

      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 года назад +3

    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 Год назад +1

      @@programmingelectronics You must have been 'thinking' otherwise you would not have said that!

    • @programmingelectronics
      @programmingelectronics  Год назад

      @@rodneytapit5636 I wasn't thinking clearly :)

  • @user-cw3vo8hv5u
    @user-cw3vo8hv5u 8 месяцев назад

    Simple, but I tried it to no avail and the internet is full of viral videos.

  • @desgeneradotv
    @desgeneradotv 10 месяцев назад +1

    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  9 месяцев назад

      Sorry about this issue. It is mentioned in the comments. Here is an updated video: ruclips.net/video/7Xdsc1qqoro/видео.html