Random Nerd Tutorials
Shares

ESP8266 OTA Updates with Arduino IDE | Over the Air

Shares

OTA (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.

Uploading a new sketch wirelessly from Arduino IDE is intended for the following typical scenarios:

  • during firmware development – as a quicker alternative to uploading a new sketch over a serial
  • for updating the firmware of multiple ESPs in your network

If you like the ESP and you want to do more projects you can read my eBook Home Automation using ESP8266.

Let’s get started!

Step #1 – Installing Python 2.7.x

To use this functionality it’s required that you have Python 2.7.x installed in your computer. Follow these next instructions:

1) Go to Python website and download the 2.7.x version for Windows: www.python.org/downloads

2) Open the file and follow the installation wizard

3) Choose the option “Install for all users”

4) In Customize Python 2.7.X, you must enable the last option “Add python.exe to Path”

Step #2 – Uploading BasicOTA.ino with serial communication

In order to upload firmware to your ESP8266 wirelessly, you have to upload the BasicOTA.ino sketch example first.

Having the latest Arduino IDE software installed from arduino.cc/en/Main/Software. Follow these next instructions:

1) Connect your ESP8266 to your computer with a USB cable:

2) Go to Tools to select your ESP board model. You also have to choose your ESP’s COM port

3) Open the BasicOTA.ino example: File > Examples > Arduino OTA > BasicOTA.ino or copy the following sketch to your Arduino IDE

»» View and download code on GitHub!

Note: you have to change the sketch example with your SSID and password.

4) Press the “Upload” button in the Arduino IDE and wait for the “Done uploading” message

5) Open the Arduino IDE serial monitor at a baud rate of 115200. If you’ve entered the right network credentials you should see your ESP IP address after a few seconds:

Step #3 – Uploading a new sketch OTA (Over the Air)

Now your ESP8266 is ready to receive OTA firmware updates. You can unplug your ESP8266 from your computer and power it through any power source (for example a power bank). If your ESP8266 has a wireless connection to your router, you should be fine to upload new firmware.

1) Go to your Arduino IDE. Open Tools tab select the Port option and you should see something like this: esp8266-xxxxxx at your_esp_ip_address

2) Copy the following sketch to your Arduino IDE and upload it to your ESP8266. This sketch blinks the ESP12-E NodeMCU kit built-in LED every second

»» View and download code on GitHub!

Note: you have to change the sketch example with your SSID and password.

3) Press the “Upload” button in the Arduino IDE and wait for the “Done uploading” message

4) Your ESP should have it’s built-in LED blinking every second

Wrapping up

I hope this tutorial was useful. Now, you can have your ESP8266 in a remote location and update its firmware without having physical access to the ESP device.

Do you have any questions? Leave a comment down below.

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.

Leave a Comment:

Add Your Reply