0

members

Easy Basics: Project 066v ESP8266 ESP-12E module - Over the Air updates via ESP8266 Web server

of Acoptex.com in ESP8266 ESP-12

Basics: Project 066v

Project name: ESP8266 ESP-12E module - Over the Air updates via ESP8266 Web server

Tags: ESP, ESP8266, WI FI module, ESP-12E, Ai Thinker, AI-Cloud, SOC, GPIO, General Purpose Input Output, System On a Chip, IOT, internet of things, FTDI232, FTDI 232, how to upload sketch, LoLin NODEMCU V3, NODEMCU, V3, Development Board with USB-to-Serial Onboard, NodeMCU DevKit, Wi-Fi OTA, Wireless Update ESP8266 ESP-12E module from the Arduino IDE, ESP8266 ESP-12E moduleOver-the-Air (OTA) Updating, OTA update, Over the Air updates (OTA), ESP8266 web server

Attachments: ArduinoOTAlibrary, WebServer1, WebServer2

In this project, you need these parts :

1. ESP8266 ESP-12E module with micro USB cable 1pc

2. Arduino IDE version 1.6.13 ( you can download it here )

3. Python 2.7.15 ( you can download it here )

4. Led (red and green) 2 pcs

5. Resistor 220 Ohm 2 pcs

6. Breadboard 1 pc

7. Jumper wires F-M, M-M

General

We will learn how to do update through WiFi  via ESP8266 Web server (OTA - Over The Air Update) with ESP8266 ESP-12E module (LoLin NODEMCU V3). 

 

OTA (Over the Air) update is the process of loading a new firmware to ESP8266 ESP-12E module using WiFi connection rather than a serial communication. This type of functionality is extremely useful in case of no physical access to the ESP8266 ESP-12E module.

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

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

Understanding the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

You can read more about it here.

Signals and connections of LED

The operating voltage of the LED is 1.8V and the operating current is 10mA-20mA. The Arduino Uno board can supply 5V or 3.3V power. We will use 5V for this project, so the minimum resistance of the current limiting resistor should be (5 V to 1.8 V)/20 = 160 Om. The 220 Om offered in the kit is suitable and you can also choose other resistors that meet the condition. The larger the resistance is, the dimmer the LED will get.

Signals and connections of the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)

TX - transmit pin. GPIO pin

RX  - receive pin.  GPIO pin

3V3 (or 3V or 3.3V) - power supply pin (3-3.6V). 

GND ( or G) - ground pin.

RST - reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.

EN - Chip enable. Keep it on high (3.3V) for normal operation.

Vin - External power supply 5VDC.

D0-D8 - GPIO (General Purpose Input Output) pins 

D5-D8 - SPI interface

D1-D2– I²C/TWI Interface

SC (or CMD) - (Chip Select) - the pin that the master can use to enable and disable specific devices. GPIO pin

SO (or SDO) - Master In Slave Out (MISO) - SPI communication. The Slave line for sending data to the master. GPIO pin

SK (or CLK) - SCK (Serial Clock) - SPI communication.The clock pulses which synchronize data transmission generated by the master. GPIO pin

S1 (or SD1) - Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. GPIO pin

S2 (or SD2) - GPIO pin

S3 (or SD3) - GPIO pin

VU (or VUSB) - external power 5VDC.

A0 - ADC output.

RSV - reserved

Wiring

Step by Step instruction

1. Adding ESP8266 platform to Arduino IDE

the Arduino environment has to be set up to make it compatible with the 
ESP-01 module. It is required to have Arduino version 1.6.4 or higher in order to install the ESP8266’s platform packages.

The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-12E module. 

We are using PC with Windows 10 OS.

1. Installation of  ESP8266 add-on in Arduino IDE on Windows OS.

  1. Download and install the Arduino IDE version 1.6.13 Windows Installer. You can download it here.
  2. Open Arduino IDE. 
  3. Open the Preferences window from the Arduino IDE. Go to File -> Preferences.
  4. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)
  5. Open Boards manager. Go to Tools -> Board -> Boards Manager…

  6. There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install
  7. The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.

2. Installing Python 2.7.x

  1. You need to install Python 2.7.X on your PC. Go to python.org website and download the latest version of Python 2.7.X for your OS (Operating System) (We are using Python 2.7.15 version in this project. You can download it here).
  2. Open the downloaded file to start the Python installation wizard. 
  3. Press Next button. Select destination directory.
  4. Press Next button.
  5. Scroll down in the Customize Python 2.7.15window and open the Add python.exe to Path. Select the option Will be installed on local hard drive.
  6. Press Next button to complete the installation. Press Yes button to give access to the drive.
  7. Press Finish button to complete installation.

3. Uploading the WebServer1 sketch to ESP8266 ESP-12E module 

 If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer. 

Before use ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3), you need to download the manufacture's driver (CH340)  for this chip and install it in your PC. Here is the link. See the description of driver installation package below: CH340 / CH341 USB to serial WINDOWS driver installation package that supports 32/64 bit Windows 10 / 8.1 / 8/7 / VISTA / XP, SERVER 2016/2012/2008/2003, 2000 / ME / 98, through Microsoft digital signature authentication, support USB to 3-wire and 9-wire serial port, with the product release To the end user. Applicable scope: CH340G, CH340C, CH340B, CH340E, CH340T, CH340R, CH341A, CH341T, CH341H chips.

If you have CP2102 chip then  you need to download the manufacture's driver for this chip and install it in your PC. Driver for Mac, Windows, Linux or more.. 

  1. Do wiring.
  2. Open Arduino IDE and open WebServer1 sketch.
  3. Plug your ESP8266 ESP-12E module into your PC USB port.
  4. Choose your NodeMCU board. Go to Tools -> Board -> NodeMCU 1.0 (ESP-12E Module)
  5. Select the correct com port.
  6. Modify sketch with your SSID and password for WiFi network which you are going to use for OTA updates. You can also modify update path, update password and update username.
  7. Compile and upload the WebServer1 to your ESP8266 ESP-12E module. If everything went as expected, you should see a “Done uploading” message. 
  8. Open the Serial Monitor at a baud rate of 115200 to verify that the ESP8266 ESP-12E module is properly connected to the Wi-Fi network. 
  9. Press RST button on your ESP8266 ESP-12E module to reset it.
  10. When your ESP8266 ESP-12E module restarts, you will see the IP address of your ESP8266 ESP-12E module in Serial monitor (in our case it’s 192.168.0.118). You will see the red LED blinks and the green LED is off.

 4. Uploading a new sketch Over the Air

  1. Now your ESP8266 ESP-12E module is ready to receive OTA firmware updates. You can unplug your ESP8266 ESP-12E module from your PC and power it through any power source (for example a power bank). If your ESP8266 ESP-12E module has a wireless connection to your router, you should be fine to upload new firmware.
  2. Open Arduino IDE and open WebServer2 sketch.
  3. Modify sketch with your SSID and password for WiFi network which you are going to use for OTA updates. You can also modify update path, update password and update username.
  4. Go to Sketch->Export compiled binary. Your sketch will be compiled and saved in the same folder as the sketch.
  5. Go to Sketch -> Show Sketch Folder. You will see the WebUpdater2.ino.nodemcu.bin file there, rename it as fw1.bin
  6. You can access your web server, if you type your ESP8266 ESP-12E module IP address in your browser. In our case - http://192.168.0.118/firmware or http://myesp8266.local/firmware
  7. Enter username - admin and password - best. Press Sign in button. You can upload the update now.
  8. Press Choose file button to select fw1.bin file.
  9. Press Open button. The pop up window close.
  10. Press Update button. OTA update will start. You can monitor the progress in percents % below.
  11. Update will be done when the progress 100%. The ESP8266 ESP-12E module will reboot automatically. Congrats! You have successfully uploaded WebServer2 sketch.
  12. This sketch blinks the red LED now and green LED is off.

 

Summary

We have learnt how to do update through WiFi  via ESP Web server (OTA - Over The Air Update) with ESP8266 ESP-12E module (LoLin NODEMCU V3). 

Library

  • ArduinoOTA library included in your Arduino IDE.
  • ESP8266WiFi library included in your Arduino IDE.

Sketch

  • See attachments on the begining of this project description.


Other projects of Acoptex.com
Easy Basics: Project 086d ESP-12E module, BME280 sensor - Web server of Acoptex.com in ESP8266 ESP-12 18-07-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 19-08-2018
Viewed: 199 times