+ All Categories
Home > Documents > ESP8266 FOTA Demonstration with Phone App EN

ESP8266 FOTA Demonstration with Phone App EN

Date post: 21-Dec-2021
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
27
Version 1.0 Copyright © 2016 ESP8266 FOTA Demonstration with Phone App
Transcript
Page 1: ESP8266 FOTA Demonstration with Phone App EN

Version 1.0 Copyright © 2016

ESP8266 FOTA Demonstration

with Phone App

Page 2: ESP8266 FOTA Demonstration with Phone App EN

About This Guide The document is structured as follows:

Release Notes

Chapter Title Content

Chapter 1 Overview Introduction to the FOTA (Firmware Over The Air) demonstration.

Chapter 2 Organization of the Demonstration Network architecture and structure of the FOTA demonstration.

Chapter 3 Environment Setup Set up the hardware and software environment for running the FOTA demonstration.

Chapter 4 User Guide User guide of the FOTA demonstration.

Chapter 5 Conclusion of the Demonstration Conclusion of the FOTA demonstration.

Appendix Ⅰ Install UART Driver for the ESP8266 Demo Board

Introduction to the installation of the UART driver on the PC, and how to use the UART debug tool.

Appendix ⅠⅠ Flash Download Tool User Guide

Introduction to the Espressif Flash Download Tool, and how to use it to download the firmware into the ESP8266 demo board.

Appendix ⅠⅠⅠ Espressif Phone App Introduction to the Espressif phone app.

Date Version Release notes

2016.10 V1.0 Initial release.

Page 3: ESP8266 FOTA Demonstration with Phone App EN

Table of Contents 1. Overview 1.................................................................................................................................

2. Organization of the Demonstration 2.........................................................................................

3. Environment Setup 3.................................................................................................................3.1. Environment Preparation 3............................................................................................................

3.1.1. Hardware Preparation 3...................................................................................................3.1.2. Software Preparation 3....................................................................................................

3.2. Hardware Connection 4................................................................................................................3.3. Software Installation 4...................................................................................................................3.4. The ESP8266 Demo Board 4........................................................................................................

4. User Guide 6..............................................................................................................................4.1. Download Firmware 6...................................................................................................................4.2. Configure ESP8266 to Connect to the Cloud Server 7.................................................................4.3. Upgrade ESP8266 Firmware from the Cloud 10...........................................................................

5. Conclusion of the Demonstration 14.........................................................................................

I. Appendix - Install UART Driver for the ESP8266 Demo Board 16............................................

II. Appendix - Flash Download Tool User Guide 20.......................................................................

III. Appendix - Espressif Phone App 23..........................................................................................

Page 4: ESP8266 FOTA Demonstration with Phone App EN

"

1. Overview

1. Overview This guide demonstrates the FOTA (Firmware-Over-The-Air) function for ESP8266-based devices. In particular, the guide outlines the process of upgrading ESP8266 firmware from Espressif Cloud over Wi-Fi by using our Android app. This process requires no technical skills and does not involve a PC or UART based tools. Therefore this process can be carried out by any user, including end users of ESP8266 based products. The FOTA test has been demonstrated and run on the ESP-Launcher, an ESP8266 evaluation board designed by Espressif. However, with appropriate build settings based on your application flash configuration, the test can be made to run on any ESP8266 based system.

📖 Note: For more documentation on ESP8266, please visit: http://www.espressif.com/support/download/documents?keys=&field_type_tid%5B%5D=14.

Espressif " /"1 24 2016.10

Page 5: ESP8266 FOTA Demonstration with Phone App EN

"

2. Organization of the Demonstration

2. Organization of the Demonstration

The organization of the FOTA update demonstration, along with the required network architecture is shown below:

" Figure 2-1. Network Architecture for FOTA Update Demonstration

• ESP8266 Device: Runs in Station mode or Station + SoftAP mode, and accesses the internet via a router. It will connect to the Espressif Cloud server after being configured by the phone app, and download the updated software BIN from the Espressif Cloud server to perform an update.

• Server: Espressif Cloud server (http://iotbucket.com/) for IoT (Internet of Things) devices that communicates with the phone app and the ESP8266 IoT devices under consideration. It can understand update requests and serve the relevant updated ESP8266 firmware.

• Mobile App: Espressif phone app that can control ESP8266 in LAN or through the Espressif Cloud server.

Room

Device

Phone

Office

Server

Mobile App

Router B

Cloud Network

Router A

Espressif " /"2 24 2016.10

Page 6: ESP8266 FOTA Demonstration with Phone App EN

"

3. Environment Setup

3. Environment Setup 3.1. Environment Preparation 3.1.1. Hardware Preparation

3.1.2. Software Preparation

Table 3-1. Hardware Preparation

Name Figure Quantity Description

ESP-Launcher (ESP8266 Demo Board)

1The development board with ESP8266. Whip antenna is needed.

Micro USB cable 1

To connect the ESP8266 demo board to the PC. • PC provides power supply. • User can trace the log output from

ESP8266 on the PC UART tool.

PC - 1PC for running software tools: Windows XP or Windows 7 OS is recommended.

Android Mobile Phone - 1To run the Espressif phone app: Version Android4.0 or later is recommended.

Router (can access the internet) - 1 To provide Wi-Fi network

"

"

Table 3-2. Software Preparation

Name Location Description

demo.bin ./Bin-FW/ Firmware running on the ESP8266 demo board

IOT-Espressif-Android_1.1.4.apk ./Tools/ Phone APP for ESP8266 IoT devices

SecureCRT.rar ./Tools/PC UART terminal emulator tool (support 74880 baud rate)

ft232r-usb-uart.zip ./Tools/ USB - UART converter driver

Flash Download ./Tools/ To download the firmware into the ESP8266 demo board

Espressif " /"3 24 2016.10

Page 7: ESP8266 FOTA Demonstration with Phone App EN

"

3. Environment Setup

3.2. Hardware Connection • ESP8266 demo board connects to the PC via the micro USB cable. For instructions on

how to install the UART driver on your PC, please refer to Appendix Ⅰ. • A router through which ESP8266 can access the internet.

3.3. Software Installation 1. Flash Download Tool, to download firmware into the ESP8266 demo board.

2. Android phone app, provided by Espressif, to control the ESP8266 demo board.

3.4. The ESP8266 Demo Board

�Figure 3-1. The ESP8266 Demo Board (ESP-Launcher)

The switch "1": toggle to the lower side • Lower side: power-off, Upper side: power-on.

The switch "2": toggle to the lower side

• Lower side: firmware download mode, Upper side: program execution mode.

📖 Notes: • The firmware to be downloaded can be found in ./Bin-FW/.

• For more on how to use Flash Download Tool, please refer to Appendix Ⅱ.

📖 Notes: • Install the ./Tools/IOT-Espressif-Android_1.1.4.apk on an Android mobile phone.

• For instructions on how to start using phone APP, please refer to Appendix Ⅲ.

Espressif " /"4 24 2016.10

Page 8: ESP8266 FOTA Demonstration with Phone App EN

"

3. Environment Setup

• The ESP8266 will read the level of switch "2" when powering up.

- If the switch "2" is set to the lower position, the ESP8266 will enter firmware download mode after power on.

- If the switch "2" is set to the upper position, the ESP8266 will enter program execution mode after power on.

The switch “3" (CHIP_EN Pin): toggle to the upper side • Lower side: chip disable, Upper side: chip enable.

The pin "4": put a jumper cap on the above 2 pins The pin "5": put a jumper cap on it

Espressif " /"5 24 2016.10

Page 9: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

4. User Guide4.1. Download Firmware

1. Download the supplied firmware to the ESP8266 demo board. Using Flash Download Tool to download ./Bin-FW/demo.bin into address 0x0000. For more on how to use the Flash Download Tool, please refer to Appendix Ⅱ.

" Figure 4-1. Downloading Firmware

📖 Notes: • In general, the firmware needs to be downloaded only once.

• Only if there is a later version of firmware with more functions, it can be downloaded into the ESP8266 demo board again.

Espressif " /"6 24 2016.10

Page 10: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

2. Run the firmware to confirm that the download was successful.

• Connect the ESP8266 demo board to the PC using the micro USB cable. • Open the UART serial monitor tool on your PC, and configure the serial terminal to

74880-8-n-1. For more on how to configure the serial terminal, refer to Appendix Ⅰ.

• Toggle the switch "2" on the ESP8266 demo board to the upper side to configure it to be in program execution mode on power up.

• Next, toggle the switch "1" to the upper side to power up the ESP8266 demo board. • If the firmware download was successful, you should see an output like this on the

UART terminal:

" Figure 4-2. UART Output Log

4.2. Configure ESP8266 to Connect to the Cloud Server 1. Launch the android app and log in. The mobile phone must have access to the internet.

• User needs to be registered to connect ESP8266 to cloud server and has to log in to the phone app. Please register a user account first if you have not.

2. Enable the configuration mode of the ESP8266 demo board as follows:

• Power up the ESP8266 demo board. • Long press the button "6" (S1 button) on the ESP8266 demo board for 5 seconds. • Release the button "6" and observe the light "8" on the ESP8266 demo board, if the

light "8" is flickering slowly, it means that the ESP8266 has entered configuration mode successfully. UART will continually output log "configing..." as shown below:

" Figure 4-3. UART Log of Configuring Mode

Espressif " /"7 24 2016.10

Page 11: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

3. Set ESP8266 to connect to the cloud server using phone app.

• Open the app on the Android phone, click the " icon on the upper left corner and select "Add Devices".

" Figure 4-4. Add Devices

• Input the Wi-Fi password and select the "Make device connect to cloud", and click the "OK" button at the bottom. The phone app will set the ESP8266 demo board to connect to the cloud server.

" Figure 4-5. Input Wi-Fi password

⚠ Notice: • Before clicking “OK”, please ensure that the ESP8266 demo board is in configuration mode as instructed

in STEP 2 above.

• User can check the Wi-Fi password by checking "Show password".

Espressif " /"8 24 2016.10

Page 12: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

4. Wait till the ESP8266 demo board connects to the cloud server.

• If the ESP8266 connected to the cloud server successfully, a message will pop up as shown:

" Figure 4-6. ESP8266 Successfully Connected to the Cloud

• Click the "OK" button on the phone app in Figure 4-6. Refresh the main page of the

phone app, there should be a cloud icon" next to the ESP8266 device name, indicating that the ESP8266 has already connected to the cloud server for the first time. If it is not the first time that the ESP8266 has connected to the server, the icon

will be " .

" Figure 4-7. Main Page of the Phone App (note the cloud icon next to device name)

Espressif " /"9 24 2016.10

Page 13: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

4.3. Upgrade ESP8266 Firmware from the Cloud If a new ESP8266 firmware with enhanced functionality is released by Espressif, user may need to upgrade the firmware on the ESP8266 demo board. The OTA (Over-The-Air) function makes upgrade possible over Wi-Fi, without the need to connect to the PC. The OTA (Over-The-Air) function makes ESP8266 device connect to the Espressif cloud server through Wi-Fi, then download the latest firmware from the cloud server and reboot to run the updated firmware.

1. Keep the phone connected to the internet and find the ESP8266 device name on the main page of the phone app.

• Click the ESP8266 device name on the main page of the phone app, for example, click the "ESP_14C790" below.

" Figure 4-8. The Main Page of the Phone App

2. Enter the ESP8266 device page, and click the " button on the upper right corner, and then choose the "Upgrade cloud" option to start downloading the new firmware from the Espressif cloud server into the ESP8266 demo board.

📖 Note: If the ESP8266 failed to connect to the cloud server, user can refresh the main page of the phone app, then long press the ESP8266 device name and select the "Make device connect to cloud" to retry the connection.

Espressif " /"10 24 2016.10

Page 14: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

" Figure 4-9. Start Downloading Firmware from the Cloud

• The UART log will print information indicating the progress of the firmware update process as shown here:

" Figure 4-10. UART Log of Upgrading

3. After downloading, the ESP8266 will restart automatically to run the new firmware. The following message will be printed:

" Figure 4-11. UART Logs on Restarting to Run New Firmware

Espressif " /"11 24 2016.10

Page 15: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

• After upgrading, the new version information can be seen on the main page of the phone app. For example, the firmware has been upgraded from version 1.0.9 to version 1.1.0.

" Figure 4-12. The Old Version of Firmware

" Figure 4-13. The Updated Version of Firmware

• If it is the latest version of firmware running on the ESP8266 demo board, the "Upgrade cloud" button on the phone app will be disabled, user cannot upgrade the firmware.

Espressif " /"12 24 2016.10

Page 16: ESP8266 FOTA Demonstration with Phone App EN

"

4. User Guide

" Figure 4-14. The Latest Firmware

Espressif " /"13 24 2016.10

Page 17: ESP8266 FOTA Demonstration with Phone App EN

"

5. Conclusion of the Demonstration

5. Conclusion of the Demonstration

This demonstration is intended to help users run the FOTA function, configure the ESP8266 to connect to the Espressif cloud server by using the phone app and to download the latest firmware from the cloud server through Wi-Fi for upgrading. When Espressif releases a firmware update that fixes some bugs or adds new features, the new firmware will be available on the Espressif cloud server. Then user can set the ESP8266 device to upgrade to the new firmware from the cloud server by using phone app. Without connecting to the PC or using Flash Download Tool, the ESP8266 can upgrade its firmware easily through Wi-Fi, assisted by a phone app.

" Figure 5-1. Before Firmware Upgrade

" Figure 5-2. Upgrading the Firmware

Espressif " /"14 24 2016.10

Page 18: ESP8266 FOTA Demonstration with Phone App EN

"

5. Conclusion of the Demonstration

" Figure 5-3. After Firmware Upgrade

Espressif " /"15 24 2016.10

Page 19: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅰ

I. Appendix - Install UART Driver for the ESP8266 Demo Board 1. Use a Micro USB cable to connect the ESP-Launcher to the PC. The UART driver needs

to be installed on the PC.

" Figure Ⅰ-1. Installing UART Driver on PC

Finish installing the UART driver on the PC:

" Figure Ⅰ-2. UART Driver Installed

2. Unzip ./Tools/SecureCRT.rar, and open the SecureCRT to check if the UART driver is installed successfully.

⚠ Notice: If the PC does not install the UART driver automatically, user can install it manually. Espressif provides the UART driver in ./Tools/ft232r-usb-uart.zip.

📖 Notes: The UART configuration of the ESP-Launcher should be as follows: • Baud rate: 74880 (by default) or 115200 (for standard AT commands) • 8N1 (Data bits: 8, Parity bit: None, Stop bit: 1) • Flow control: none • The SecureCRT should be set into “New line mode”, because AT commands are terminated with a new-

line (CR-LF).

Espressif " /"16 24 2016.10

Page 20: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅰ

• If it is the first time you are using the SecureCRT, create a new serial port connection. Users can set the configuration by referring to the screenshot below. Protocol: serial, flow control: none, and set the actual port number by finding out the assigned port from the “Device Manager” of PC.

" Figure Ⅰ-3. Creating a New Serial Port Connection

- If the serial port connection was created before, users can change its configuration by right-clicking on it, and selecting “properties”.

" Figure Ⅰ-4. Checking the “Properties” of the Serial Port

Espressif " /"17 24 2016.10

Page 21: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅰ

- Select the “Serial” page in the “Properties” window to check the configuration of the serial connection.

"

Figure Ⅰ-5. Checking the “Serial” in “Properties” Window

• If AT commands are used, the baud rate should be 115200, and the “New line mode” should be set as the AT commands terminate with a newline (CR-LF).

"

Figure Ⅰ-6. Setting the “New line mode” for AT Commands

Espressif " /"18 24 2016.10

Page 22: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅰ

3. Power up the ESP-Launcher by toggling the switch “1” to the upper side. Check if the startup logs (baud rate 74880) are displayed on the SecureCRT.

" Figure Ⅰ-7. Startup Logs

4. User can connect / disconnect the serial port by clicking these two buttons

" at the upper left corner of the SecureCRT. • The left button is to create a serial port connection.

• The right button is to abort the connection.

📖 Note: The default baud rate of ESP8266 is 74880. But to use AT commands, the baud rate should be 115200.

Espressif " /"19 24 2016.10

Page 23: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅱ

II. Appendix - Flash Download Tool User Guide

1. Double click the ./Tools/FLASH_DOWNLOAD_TOOLS_v2.4_150924/ESPFlashDownloadTool_v2.3+.exe to run the Flash Download Tool.

2. Fill the Download Path Config area with the location of the firmware which is to be downloaded, and download it to ADDR 0x0000. SPI SPEED is 40 MHz, SPI MODE is QIO, FLASH SIZE is 8 Mbit. And select the corresponding COM port.

" Figure Ⅱ-1. Flash Download Tool

📖 Note: The selected firmware in the Download Path Config area will turn into green and be downloaded into the ESP-Launcher. If there is any other firmware which is not selected, it will be ignored.

Espressif " /"20 24 2016.10

Page 24: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅱ

3. Click the “START” button on the ESP8266 Flash Download Tool to enter the “SYNC” state. Wait for the ESP-Launcher to power up.

" Figure Ⅱ-2. “SYNC” State of Flash Download Tool

4. Power up the ESP-Launcher, and start downloading firmware.

• Toggle the switch “2” to the lower side to set ESP-Launcher to download mode. And toggle the switch “1” to the upper side to power up the ESP-Launcher. More details about the ESP-Launcher are in Section 3.4.

" Figure Ⅱ-3. ESP-Launcher

• The Flash Download Tool will start to download firmware into the ESP-Launcher. The DETECTED INFO area on the ESP8266 Flash Download Tool will display information about the flash chip on the ESP-Launcher.

" Figure Ⅱ-4. Starting Downloading Firmware

Espressif " /"21 24 2016.10

Page 25: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅱ

• Wait for the download to complete. “FINISH” state will be shown on the Flash Download Tool.

" Figure Ⅱ-5. Downloading Firmware Finished

After the download is finished, toggle the switch “1” to the lower side to power off the ESP-Launcher. Set the ESP8266 to be in program execution mode by toggling the switch “2” to the upper side. Then toggle the switch “1” to the upper side again to power on the ESP-Launcher.

Espressif " /"22 24 2016.10

Page 26: ESP8266 FOTA Demonstration with Phone App EN

"

Appendix Ⅲ

III. Appendix - Espressif Phone App

Espressif provides an Android phone app which can be used to test and control ESP8266-based devices. The phone app package can be found in ./Tools/IOT-Espressif-Android_1.1.4.apk. Launch the phone app and log in. Please register an account when using the phone app for the first time.

" Figure Ⅲ-1. Logging in to the Phone App

📖 Notes: • "Quick Usage" button can be used to launch quick start for the phone app.

• User has to log in to the phone app first to use the Espressif Cloud service.

Espressif " /"23 24 2016.10

Page 27: ESP8266 FOTA Demonstration with Phone App EN

Disclaimer and Copyright Notice Information in this document, including URL references, is subject to change without notice. THIS DOCUMENT IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY, NON-INFRINGEMENT, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. All liability, including liability for infringement of any proprietary rights, relating to the use of information in this document, is disclaimed. No licenses express or implied, by estoppel or otherwise, to any intellectual property rights are granted herein. The Wi-Fi Alliance Member logo is a trademark of the Wi-Fi Alliance. The Bluetooth logo is a registered trademark of Bluetooth SIG. All trade names, trademarks and registered trademarks mentioned in this document are property of their respective owners, and are hereby acknowledged. Copyright © 2016 Espressif Inc. All rights reserved.

Espressif IOT Teamwww.espressif.com


Recommended