question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ESP32 OTA very flakey

See original GitHub issue

Hello! I have been trying to make the OTA example found here work:

http://docs.platformio.org/en/latest/platforms/espressif32.html#over-the-air-ota-update https://github.com/espressif/arduino-esp32/tree/master/libraries/ArduinoOTA/examples/BasicOTA

I can get the example to upload every 10 tries or so, but not consistently

I am using PlatformIDE on VSCode on macOS Mojave

Here are the versions that I am running:

VSCode: 1.31.1 PlatformIO: 3.6.4

I have tried disabling my firewall but that did not help. Any help or further guidance would be appreciated, thank you!

Here is the code that I am using, it is identical to the OTA example:

#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

const char* ssid = "HOME-C44A-2.4";
const char* password = "3PD94CA9TFDV34AT";

void setup() {
  Serial.begin(115200);
  Serial.println("Booting");
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }

  // Port defaults to 3232
  // ArduinoOTA.setPort(3232);

  // Hostname defaults to esp3232-[MAC]
  // ArduinoOTA.setHostname("myesp32");

  // No authentication by default
  // ArduinoOTA.setPassword("admin");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
  // ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");

  ArduinoOTA
    .onStart([]() {
      String type;
      if (ArduinoOTA.getCommand() == U_FLASH)
        type = "sketch";
      else // U_SPIFFS
        type = "filesystem";

      // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
      Serial.println("Start updating " + type);
    })
    .onEnd([]() {
      Serial.println("\nEnd");
    })
    .onProgress([](unsigned int progress, unsigned int total) {
      Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
    })
    .onError([](ota_error_t error) {
      Serial.printf("Error[%u]: ", error);
      if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
      else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
      else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
      else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
      else if (error == OTA_END_ERROR) Serial.println("End Failed");
    });

  ArduinoOTA.begin();

  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  ArduinoOTA.handle();
}

Here is my platform.ini

[env:esp32thing]
platform = espressif32
board = esp32thing
framework = arduino
monitor_speed = 115200

Here is the command I am using to upload

platformio run -t upload --upload-port 10.0.0.132

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
davidsiemerscommented, Aug 6, 2019

I’d definitely give other power supplies a shot. The 5v voltage regulators on these boards can be finicky and while a PSU may be in spec, it’s starting voltage or even running voltage may be below what the regulator needs to run reliably. Also, some companies like to implement things slightly off spec, too; the Nintendo Switch PSU is a great example of that. A generic, 1A/5W or similar PSU may be your best bet for something like this. May need to try every wall wort you’ve got hoarded away, though 😉 I’d also try running in it on just a LiPo battery, which should bypass that regulator. Worth a shot 😃.

0reactions
stale[bot]commented, Jul 31, 2022

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Failed to connect to ESP32: Timed out waiting for ...
Learn how to fix the Fatal Error Occurred: "Failed to connect to ESP32: Timed out waiting for ... A very shoddy programming interface...
Read more >
OTA updates that let you sleep at night - The Toit Take
This makes a Toit device extremely robust, accessible, and power-efficient even on slow and flaky internet connections. With us, you literally ...
Read more >
NUKI Hub firmware for the ESP32 - Third party integrations
It could be network trouble - ESP32 wifi, at least with the PCB antenna, is always somewhat flaky (pings in the tens or...
Read more >
OTA_Mode - No Network port is shown - Arduino Forum
3 and 1.8.7 installed. I run both ESP8266's and ESP32's that use OTA. When using 1.8.3 I always see the OTA addresses in...
Read more >
332 ESP32 OTA tutorial with tricks (incl. OTA debugging)
In this video, I would like to remind you of a handy ESP32 concept: Over the air or OTA update. A simple and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found