Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can perform remote firmware updates using ESP8266OTA (Over the Air) update is the process of loading a new firmware to ESP8266 module using WiFi connection rather than a serial communication. This type of functionality is extremely useful in case of no physical access to the ESP module.

Hardware Setup

Add Includes to Skecth to enable OTA

Code Block
languagecpp
#include <ESP8266WiFi.h> 
#include <ArduinoOTA.h>  // Enable Remote Updates

The password is same API_KEY 

Code Block
#define ODEV_API_KEY "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

You can se full featured OTA Sample: 

On IDE: File > Examples > OpenDevice > Projects > SonoffBasic

Info

The first upload must be done by the Serial, the others can be done by the network.

Upload (

...

Using Middleware / Server )

The OpenDevice Server has Firmware version management functionality (binaries only for now)
Through the Programming Menu, it is possible to remotely send firmware to devices

Steps:

1. Generate .bin file: The file will be saved in sketch folder

Image Added


2. Upload firmware binary in Menu > Programming

Image Added


3. Select active connection

Image Added

Info

We still do not have any feedback if the update worked out right or wrong.

See: https://github.com/OpenDevice/OpenDevice/issues/138

You can enable DEBUG_PORT and DEBUG_LEVEL = HTTP_UPDATE  in ESP Configuration Menu on Arduino IDE, to troubleshoot problems



Upload ( Using IDE )

Info

Enable SoftAP: WiFi.mode(WIFI_AP_STA);


On serial console you can see the IP:

...

Only if module is connected to network, after a couple of seconds, the esp8266-ota port will show up in Arduino IDE. 

Info
titleOn linux, you can scan

avahi-browse -rt _arduino._tcp

If it does not appear in the list, restart the IDE.

selection of OTA port

The password is same API_KEY 

If it still does not appear, you can use the option: Upload ( Manual PUSH )


Upload (

...

Command Line )

This option uses the command line (terminal) to upload.

...

python espota.py -i IP.IP.IP.IP -a "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -f /pathtmp/TopathTo/Sketch.ino.bin

To find path to firmware you must enable verbose output in Arduino preferences:

Upload ( Using Middleware )

StatuscolourYellowtitlePENDINGMuch information will appear, look for the file ending with ".ino.bin" on console


References