logo elektroda
logo elektroda
X
logo elektroda

[Solved] How to upload software to ESP8266 via OTA? Windows Defender problem.

pier 1383 14
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17766394
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    Hello.
    Colleagues how do I deal with uploading software to ESP8266 via OTA on WIN10?
    The culprit of all the confusion is Windows Defender I believe.
    Is it possible to somehow force it not to block the connection to ESP?
    After manually disabling Defender and restarting the computer, I can choose to connect to ESP via OTA, but I can't program it because Defender seems to be turning on at the time.
    How do I deal with this?
  • ADVERTISEMENT
  • #2 17766810
    Anonymous
    Level 1  
  • #3 17766928
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    Tomequ123 wrote:
    Disable all services associated with Defender.

    To make it that simple. I turn it off and after a reboot Defender is working again. I even tried some way with the registry but the result is the same.
  • #4 17766944
    Anonymous
    Level 1  
  • #5 17767014
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    Tomequ123 wrote:
    Link .

    Link

    This doesn't work either?


    Neither way works.
    Even if I manage to disable it and after a reboot I have the OTA connection to ESP visible in the IDE, when I try to upload the sketch it gives an error and the connection disappears and Defender becomes active in an unknown way.

    Any advice?
  • ADVERTISEMENT
  • #6 17767161
    Vinnic
    Level 16  
    Posts: 158
    Help: 18
    Rate: 20
    Board Language: polish
    Maybe you just need to disable the firewall and not all of Defender, or set exceptions.
  • #7 17767792
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    I don't think it's Defender's fault after all.
    IDE already sees the connection but sketch cannot be uploaded. I keep getting an error:
    selected serial port
    does not exist or your board is not connected
  • ADVERTISEMENT
  • #8 17768737
    Vinnic
    Level 16  
    Posts: 158
    Help: 18
    Rate: 20
    Board Language: polish
    It is necessary to select the COM to which the ESP is connected.
  • #9 17768816
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    Vinnic wrote:
    This needs to select the COM to which the ESP is connected.
    .
    Heh ESP is not connected to any port. OTA is programming over WiFi.
  • #10 17769418
    Vinnic
    Level 16  
    Posts: 158
    Help: 18
    Rate: 20
    Board Language: polish
    Right, sorry, my oversight.
  • ADVERTISEMENT
  • #11 17769426
    starob
    Level 29  
    Posts: 1088
    Help: 128
    Rate: 137
    Board Language: polish
    Are we talking about the Arduino IDE?
    The problem is not with the defender but with the Bonjour service.
    The boards with OTA through it "present" themselves.
    If you install https://hobbyistsoftware.com/bonjourbrowser which also detects ESP with OTA it will mean that the service is working properly. Then the IDE will also detect the OTA.
    I struggled with this for a couple of days and did not achieve a reproducible result. Occasionally turning on a printer that presents itself in Bonjour helped.
    The final 100% working solution that applies is the program
    https://1st.bitbumper.de/ota-firmware-update-tool-for-esp8266/.
    I place the program in the project directory and fire it up in parallel with the IDE.
    I do an export of the compiled program (Ctr+Alt+S) and "flash" in BitBumper.
    This is not a cumbersome solution, is hardly different from uploading from the IDE and always works. If this method does not work, it means If it does not work this way, it means that there is something wrong with the program itself.
  • #12 17769620
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    starob wrote:
    We are talking about the Arduino IDE?
    The problem is not with the defender but with the Bonjour service.
    Boards with OTAs through it "present" themselves.
    If you install https://hobbyistsoftware.com/bonjourbrowser which also detects ESP with OTA it will mean that the service is working properly. Then the IDE will also detect the OTA.
    I struggled with this for a couple of days and did not achieve a reproducible result. Occasionally turning on a printer that presents itself in Bonjour helped.
    The final 100% working solution that applies is the program
    https://1st.bitbumper.de/ota-firmware-update-tool-for-esp8266/.
    I place the program in the project directory and fire it up in parallel with the IDE.
    I do an export of the compiled program (Ctr+Alt+S) and "flash" in BitBumper.
    This is not a cumbersome solution, is hardly different from uploading from the IDE and always works. If this method does not work, it means If this way doesn't work it means that there is something wrong in the program itself.
    .
    Yes Arduino IDE.
    I no longer have a problem with the network connection. Bonjour browser sees my ESP the problem is that it doesn't want to program. I get errors as I wrote above either: ERROR not answer.
    I am still wondering what about the gpio0 during OTA programming?

    I found here interesting information:

    Before you begin, please make sure that you have the following installed:
    Arduino IDE 1.6.5 and 1.6.5-947-g39819f0 version of platform package,
    Python 2.7 ( do not install Python 3.5 that is not supported ).

    Maybe it's the python version that's the problem? When installing I didn't think about it, I just downloaded the latest 3.7.2.
  • #13 17769695
    starob
    Level 29  
    Posts: 1088
    Help: 128
    Rate: 137
    Board Language: polish
    In the OTA gpio0 is Hi.
    Upload the BasicOTA sketch if it works then you have something wrong in the loop() function - something that stops the loop.
    Here's the slightly corrected parts of loop() and setup(), you need to write loop() so that you periodically call ArduinoOTA.handle() and only it executes when you start programming.

    Code: C / C++
    Log in, to see the code
    .

    Added after 3 [minutes]:

    pier wrote:
    Maybe it's the python version that's the problem? When installing I didn't think about it but just downloaded the latest 3.7.2.


    ..yes this is the problem
  • #14 17770275
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    Do you have any suitable version of Python?

    I've been looking but some strange versions are downloading for me.
    I even managed to install one but it wouldn't fire up from the console.

    The next version 2.7.15 was able to be installed but does not fire from the console....
  • #15 17770860
    pier
    Level 24  
    Posts: 2444
    Help: 40
    Rate: 1891
    Board Language: polish
    Do you have any suitable version of Python?

    I've been looking but some strange versions are downloading for me.
    I even managed to install one but it wouldn't fire up from the console.

    The next version 2.7.15 was able to be installed but does not fire from the console....

    Added after 3 [hours] 58 [minutes]: .

    Eh, as usual, what turned out differently.
    Nodemcu programs via OTA with no problem.
    In the previous board I have esp8266 -07 and in it not enough memory....
    What's different is that the network connection disappears for no reason when it wants to.

Topic summary

✨ The discussion revolves around issues faced when uploading software to the ESP8266 via Over-The-Air (OTA) on Windows 10, particularly due to conflicts with Windows Defender. The user experiences difficulties with Defender blocking the connection, even after attempts to disable it. Suggestions include disabling the firewall instead of the entire Defender, setting exceptions, and ensuring the correct COM port is selected. It is noted that the Arduino IDE may not be the issue, but rather the Bonjour service, which is essential for OTA functionality. A recommended solution involves using the BitBumper OTA firmware update tool alongside the IDE. Additionally, the importance of using the correct version of Python (2.7) for compatibility is highlighted, as well as ensuring GPIO0 is high during OTA programming.
Generated by the language model.

FAQ

TL;DR: ESP8266 OTA on Windows often fails due to Bonjour/mDNS, not AV; "The problem is not the defender but the Bonjour service," and one user reports a "100% working solution" using BitBumper. Fix discovery, ensure Python 2.7 for older cores, keep GPIO0 HIGH, and call ArduinoOTA.handle(). [Elektroda, starob, post #17769426]

Why it matters: This FAQ helps Arduino IDE users on Windows quickly fix failed ESP8266 OTA uploads.

Quick Facts

What actually blocks ESP8266 OTA on Windows—Defender or something else?

Most OTA failures come from the Bonjour/mDNS service, not antivirus. “The problem is not the defender but the Bonjour service.” Ensure the Bonjour service runs and advertises your ESP. Use a Bonjour Browser to confirm discovery. If Bonjour lists it, Arduino IDE should show its Network Port. [Elektroda, starob, post #17769426]

How can I check if Bonjour/mDNS finds my ESP8266 OTA port?

Install Bonjour Browser and look for your ESP’s OTA hostname. If it appears, mDNS works. Arduino IDE will then list a matching Network Port. If it does not appear, restart the Bonjour service or your router. “Occasionally turning on a printer that presents itself in Bonjour helped.” [Elektroda, starob, post #17769426]

Why do I see “selected serial port does not exist” when trying OTA?

That message appears when the network OTA port disappears during upload. It is not a COM‑port issue in OTA mode. Ensure the ESP stays connected and visible via mDNS. Recheck Wi‑Fi signal and that the OTA target remains listed before uploading. [Elektroda, pier, post #17767792]

Do I need GPIO0 LOW for OTA like I do for serial flashing?

No. Keep GPIO0 HIGH during OTA. LOW puts the chip in serial bootloader mode. OTA needs normal runtime so the sketch can receive the update. [Elektroda, starob, post #17769695]

My OTA upload starts, then the network port vanishes—what should I check?

Verify that Bonjour is stable and your ESP remains advertised. A flaky mDNS service can drop the port mid‑upload. Use Bonjour Browser to confirm visibility. If discovery stalls, restart the service or switch to a dedicated OTA tool. [Elektroda, starob, post #17769426]

Does Python 3 break espota.py for the ESP8266 Arduino core?

For the older core docs (v2.1.0), yes. They require Python 2.7 and explicitly say not to install Python 3.5. Install Python 2.7 to match that toolchain if you follow those instructions. [“ESP8266 Arduino: OTA Updates”]

How should I structure loop() and setup() for reliable OTA?

Initialize ArduinoOTA in setup(), then call ArduinoOTA.handle() in loop(). Avoid long blocking operations. Use a flag to pause your app logic during OTA. “Only ArduinoOTA.handle() executes when you start programming” in the shared pattern. [Elektroda, starob, post #17769695]

Is there a standalone tool when Arduino IDE upload fails?

Yes. Export the compiled binary with Ctrl+Alt+S, then flash using the BitBumper OTA tool. “100% working solution” was one user’s verdict. Place the tool in your project directory and run it alongside the IDE. If this fails, inspect your sketch for blocking logic. [Elektroda, starob, post #17769426]

Why does OTA work on NodeMCU but fails on my ESP‑07?

ESP‑07 modules can have smaller flash, which triggers “not enough memory” during OTA. Your NodeMCU likely has a larger flash chip, so OTA completes. If the network port also disappears, verify Wi‑Fi and Bonjour stability first. [Elektroda, pier, post #17770860]

What is the simplest 3‑step way to upload via OTA in Arduino IDE?

  1. Load and upload the BasicOTA sketch over serial, and connect the ESP to Wi‑Fi.
  2. Confirm it appears as a Network Port via Bonjour/mDNS.
  3. In Arduino IDE, select that Network Port and click Upload. [“ESP8266 Arduino: OTA Updates”]

Should I disable Windows Defender or just adjust the firewall?

Do not disable Defender globally. “Disable the firewall and not all of Defender, or set exceptions.” Allow OTA traffic through the firewall. For testing, you may temporarily disable only the firewall to isolate issues. [Elektroda, Vinnic, post #17767161]

How do I fix “ERROR not answer” from OTA upload?

That error means the ESP did not respond to the OTA script. Recheck Python version and that the device remains visible. Ensure your sketch calls ArduinoOTA.handle() while running. Try again after confirming connectivity. [Elektroda, pier, post #17769620]

Do I need to select a COM port for OTA uploads?

No. OTA uses a Network Port, not a serial COM port. If only COM ports appear, fix Bonjour discovery so the IDE can show the OTA port. [Elektroda, pier, post #17768816]
Generated by the language model.
ADVERTISEMENT