OTA Flashing

I’d like an opinion on what i’m missing. (This is my first post here, I’m extremely new to this world, please assume i know nothing in your answer.)

I was successful in flashing my esp8266-01 with a ttyl over usb from windows machine, The cloud based blynk server saw my esp that it was online.
I’m using Audrino IDE 1.8.4.
The second flash was several weeks later: I attempted to change the code to enable OTA flashing.
The IDE sees this Network device in ports. But my blynk app on android no longer sees it. I’ve updated my python to v3* and java seems to be running as well.
I’ve also attempted to replace all the libraries and tools from blynk downloads getting started site in feeble attempt to help myself out before asking here.
Since I’m so new to this I’m assuming i’m missing something little.
When looking at the code, *.h headings are orange but the #include <BlynkSimpleEsp8266.h> is not.
1st question…
Is this indicative of anything?

2nd question…
This is the verbose when attempting to upload OTA.
"Arduino: 1.8.4 (Windows 10), Board: “Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 1M (512K SPIFFS), ck, Disabled, None”
Archiving built core (caching) in: C:\Users\mporterm\AppData\Local\Temp\arduino_cache_921145\core\core_esp8266_esp8266_generic_CpuFrequency_80,FlashFreq_40,FlashMode_dio,UploadSpeed_115200,FlashSize_1M512,ResetMethod_ck,Debug_Disabled,DebugLevel_None_____965b30be6e4013497578516a2065d38a.a
Sketch uses 249019 bytes (49%) of program storage space. Maximum is 499696 bytes.
Global variables use 34672 bytes (42%) of dynamic memory, leaving 47248 bytes for local variables. Maximum is 81920 bytes.
python.exe C:\Users\mporterm\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/espota.py -i 192.168.0.22 -p 8266 --auth= -f C:\Users\mporterm\AppData\Local\Temp\arduino_build_597967/blynktestOTA.ino.bin
19:50:21 [ERROR]: No response from device
19:50:21 [ERROR]: No response from device "

The code i’m attempting to work with…

#include <Blynk.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <BlynkSimpleEsp8266.h>



const char auth[] = "***";
const char ssid[] = "***";
const char pass[] = "***";

const int ESP_BUILTIN_LED = 2;

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

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

  // Hostname defaults to esp8266-[ChipID]
  // ArduinoOTA.setHostname("myesp8266");

  // No authentication by default
  // ArduinoOTA.setPassword((const char *)"123");

  ArduinoOTA.onStart([]() {
    Serial.println("Start");
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.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());

  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass); 
}

void loop() {
  ArduinoOTA.handle();
  Blynk.run();

}

I hope my question is not too rudimentary
Sam.

No… at least nothing that pertains to Blynk or OTA… probably some quirky reasoning internal to the IDE.

This is the key error… for one of many reasons, your pre-flashed script has either not broadcast itself properly, or is not actual paying attention to the communication request.

One common issue is after flashing (via USB), you need to physically reset or power cycle the ESP, or else the next OTA attempt will not work.

OTA programming is well covered all over the web… and is really not affected by how Blynk works, so you might get quicker results Googling and researching some tutorials specifically about OTA.

I thought you had to be running Python 2.7xx for OTA to work.
http://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html#arduino-ide

Pete.

2 Likes

Bingo!

Here is the most basic OTA setup. Give it a go after you install v2.7
Be sure to power down the device after you flash it. Then power it on and wait 15 seconds before trying OTA.

#include <ArduinoOTA.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
char ssid[] = "xxxxxxxx"; 
char pass[] = "xxxxxxxx"; 
void setup() {
  WiFi.mode(WIFI_STA);
  Blynk.begin(auth, ssid, pass);
  while (Blynk.connect() == false) {}
  //ArduinoOTA.setHostname("xxxxxxx"); // OPTIONAL
  ArduinoOTA.begin();
}
void loop() {
  Blynk.run();
  ArduinoOTA.handle();
}

Thank you for the patient support.
I’ll go back to v2.7 and use this much simpler code, (is by far less complicated than any I found googling around.)

Any sites to very basic C programming for beginners you find is helpful to others whom are new like myself?

Thank you! Sam.

I hope I can help anyone who is having a problem as I have with the error 19:50:21 [ERROR]: No response from device "

I downgraded python to v2.7x
This did not solve the problem

I killed my firewall in windows as best i know how and antivirus.
This did not solve the problem

I rearranged the simplified code that Jamin graceously offered up.
This seemed to fix my problem.
The following is what seems to allow me to update OTA, (And keep Blynk capabilities as well).
Thank you for your assistance, hope this can help anyone searching the blynk community.
Sam.

#include <ArduinoOTA.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "XXXX";
char ssid[] = "XXXX"; 
char pass[] = "XXXX"; 
void setup() {
  WiFi.mode(WIFI_STA);
  ArduinoOTA.setHostname("myesp8266");
  ArduinoOTA.begin();
  Blynk.begin(auth, ssid, pass);
  while (Blynk.connect() == false) {}
}
void loop() {
  ArduinoOTA.handle();
  Blynk.run();
}

@st3303 it will simply not work if you don’t follow this procedure i.e. after every local flash reset the device to enable OTA. Are you doing this?

I did power cycle the esp after each flash.
Odd thing = I flashed successfully 3 times, with-without-then-with blynk code to ensure the flash was actually working.
I got doing something else for 30min, tried flashing again, same problem… No response error… Thought it was the computer, restarted it to no avail.
What am I missing?
I thought I was on to something with reordering the code that somehow it was effecting the no response error.

@st3303 it’s much more reliable with Ubuntu than it is with Windows. Or it is with my systems but Windows is bogged down with 1TB of applications and data.

@st3303 is the device able to ping, is it responding? or pinging but there some pocket lost?

That’s a great thought… I gave it a go on my MacBook. Same error of not responding. but successful over serial with the macbook. Not once did it work OTA. I’ve thrown my arms up and will have to take my project apart and flash manually when i need to change anything.
I truly appreciate all the support you all have offered up.

It is able to ping, hadn’t thought to do that until you asked… but have always been able to see it in the arduino IDE and on my network when logged into the router. It’s got me stumped and just not willing to try any further. Thank you for the support, I’m open to additional suggestions.
Sam.

@st3303 pinging but pocket lost is there? or time out?
i have experience thesame issue. what happen is during compiling i pressed some character in my keyboard unintintionally, and its not giving any error, after that i upload the sketch and it has successfully uploaded.
then when i try to upload the next comulative sketch it come thesame error you are facing now.
what to do is. review your basic OTA sketch line by line, and upload it through USB and arduino IDE.
i fixed this error using that process only to retore the OTA.

1 Like