Good day, I followed the instructions provided by the Amazon Vendor (see below) and successfully ran the BasicOTA sketch through the USB connection. I received an IP address, which I can see under Arduino-Tools-Port. When I select the port and then try to upload a blink sketch via wifi, I receive a " No response from device" error. When I use the USB connection it loads without any issues.
#include <ESP8266WiFi.h> //provides ESP8266 specific Wi-Fi routines we are calling to connect to network.
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h> // OTA library
#ifndef STASSID
#define STASSID "xxxx"
#define STAPSK "xxxx"
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
const int blink_led = D0; // LED pin on NodeMCU ESP8266
void setup() {
pinMode(blink_led,OUTPUT);
Serial.begin(115200); //Set Baud Rate
Serial.println("Booting");
// Step to connect ESP with the Wi-Fi
WiFi.mode(WIFI_STA); //Set ESP as station mode
WiFi.begin(ssid, password); //Wi-Fi Credentials
while (WiFi.waitForConnectResult() != WL_CONNECTED) //Connecting ESP to wi-fi takes some time, so wait till it gets connected
{
Serial.println("Connection Failed! Rebooting...");
delay(1000);
ESP.restart();
}
// Port defaults to 8266
// ArduinoOTA.setPort(8266);
// Hostname defaults to esp8266-[ChipID]
// ArduinoOTA.setHostname("myesp8266");
// 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);
});
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(); //OTA initialization
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP()); // Display the IP address of the ESP on the serial monitor
}
void loop() {
ArduinoOTA.handle();
// code to blink led every 1 second
digitalWrite(blink_led,HIGH);
delay(1000);
digitalWrite(blink_led,LOW);
delay(1000);
}
I'm missing key pieces to the configuration and OTA update puzzle. What's the next step required for me to do perform OTA updates to the NodeMCU?
Here are the vendor's instructions:
- Download the Ar-duino IDE, the latest version.
- Install the IDE
- Set up your Ar-duino IDE as: Go to File->Preferences and copy the URL below to get the ESP board manager extensions: http://arduino.esp8266.com/stable/package_esp8266com_index.json Placing the http:// before the URL lets the Ar-duino IDE use it...otherwise it gives you a protocol error.
- Go to Tools > Board > Board Manager> Type "esp8266" and download the Community esp8266 and install.
- Set up your chip as:
Tools -> Board -> NodeMCU 1.0 (ESP-12E Module)
Tools -> Flash Size -> 4M (3M SPIFFS)
Tools -> CPU Frequency -> 80 Mhz
Tools -> Upload Speed -> 921600
Tools-->Port--> (whatever it is) - Download and run the 32 bit flasher exe at Github(Search for nodemcu/nodemcu-flasher/tree/master/ at Github) nodemcu-flasher/Win32/Release at master · nodemcu/nodemcu-flasher · GitHub Or download and run the 64 bit flasher exe at: nodemcu-flasher/Win64/Release at master · nodemcu/nodemcu-flasher · GitHub
- In Ar-duino IDE, look for the old fashioned Blink program. Load, compile and upload.
- Go to FILE> EXAMPLES> ESP8266> BLINK, it will start blinking.