ESP-TOUCH User Guide EN - Espressif

2y ago
36 Views
2 Downloads
743.11 KB
19 Pages
Last View : 4m ago
Last Download : 3m ago
Upload by : Tripp Mcmullen
Transcription

!ESP-TOUCHUser GuideVersion 2.0Copyright 2018

About This GuideRelease NotesDateVersionRelease notes2015.12V1.0First release.2016.04V1.1Updated Chapter 2 and Chapter 3.2018.06V2.0Updated Chapter 3 with the support for ESP32.Documentation Change NotificationEspressif provides email notifications to keep customers updated on changes totechnical documentation. Please subscribe here.CertificatesPlease download the product certificate(s) from here.

Table of Contents1. Technology Overview . 12. ESP-TOUCH Operations.32.1. ESP-TOUCH Functional Overview .32.2. ESP-TOUCH Operation Process. 33. API Development .53.1. ESP8266 API .53.1.1.smartconfig start .53.1.2.smartconfig stop .73.1.3.smartconfig set type .73.1.4.Struct .73.2. ESP32 API . 83.2.1.esp smartconfig start .83.2.2.esp smartconfig stop .103.2.3.esp smartconfig set timeout .113.2.4.esp smartconfig set type .113.2.5.esp smartconfig fast mode .123.2.6.Type .123.2.7.Struct .134. ESP-TOUCHPerformance Analysis. 14

1. Technology Overview!1.Technology OverviewEspressif’s ESP-TOUCH protocol implements the Smart Config technology to help usersconnect ESP8266EX- and ESP32-embedded devices (hereinafter referred to as the device)to a Wi-Fi network through simple configuration on a smartphone.!Figure 1-1 Typical ESP-TOUCH ApplicationSince the device is not connected to the network at the beginning, the ESPTOUCH application cannot send any information to the device directly. Withthe ESP-TOUCH communication protocol, a device with Wi-Fi accesscapabilities, such as a smartphone, can send a series of UDP packets tothe Wi-Fi Access Point (AP), encoding the SSID and password into theLength field of each of these UDP packets. The device can then reach theUDP packets, obtaining and parsing out the required information. The datapacket structure is shown in Figure 1-2:Espressif! /1612018.06

1. Technology ntains SSID and keyinformation whichESP8266 device can reachFigure 1-2 Data Packet StructureEspressif! /1622018.06

2. ESP-TOUCH Operations!2.ESP-TOUCH Operations2.1. ESP-TOUCH Functional OverviewThe ESP8266 OS SDK and NONOS SDK, as well as ESP -IDF, all support ESP-TOUCH.The SDKs also integrate the AirKiss protocol developed by Wechat, so that users canconfigure the device either via the ESP-TOUCH App or on the Wechat client-side. Note:Users can download the ESP-TOUCH App source code from: https://github.com/espressifAPP.2.2. ESP-TOUCH Operation Process1. Prepare a device that supports ESP-TOUCH, and enable its Smart Config function.2. Connect your smartphone to the router.3. Open the ESP-TOUCH App installed on the smartphone.4. Input the router’s SSID and password to connect the device to the router. Please, leavea blank in the password box if the router is not encrypted.Espressif! /1632018.06

2. ESP-TOUCH Operations! Note:Espressif It only takes a few seconds for the device to connect to the router if the two are close. With greaterdistance between them, it will take longer to establish their connection. Make sure the router is powered on before configuration, so that the device is able to scan the APs aroundit. The series of data transmitted from the ESP-TOUCH App has a timeout limit. If the device cannot connectto the router within a specified period of time, the App will return a configuration failure message (for furtherdetails, please refer to the App source code). Similarly, the time that the device needs to obtain the SSIDand password will be calculated. If the timeout limit is reached before the SSID and password informationis obtained, the device will automatically start the next round of Smart Config process.Users can set thetimeout limit through esptouch set timeout(uint8 time s) or esp smartconfig set timeout(uint8time s). Sniffer mode should be enabled during the Smart Config process. Station and soft-AP modes of thedevice should be disabled. Other APIs should not be called. Station and soft-AP modes are allowed to beenabled at the same time for ESP32 during the Smart Config process. After the configuration process is completed, the transmitter will get the IP of the device, and the devicewill return the IP of the transmitter. If the user wants to customize the information exchange between thetransmitter and the device, the IP information can be used for performing LAN communication. If the AP isolation mode is enabled on the router, the App may not get a configuration success message,even if the connection has been established. Users can configure multiple devices to connect to the same router simultaneously by configuring the appto receive multiple return values. ESP8266 and ESP32 do not support 5G and 11AC modes. As a result, Smart Config is not supported byrouters using 5G or 11AC mode.! /1642018.06

3. API Development!3.API DevelopmentUsers can call the following APIs to realize the ESP-TOUCH configuration. Please, use thelatest App and firmware. The SDKs and ESP-IDF provide an ESP-TOUCH demo for yourreference.3.1. ESP8266 API3.1.1. smartconfig startFunction: configure the device and connect it to the AP. Notice: This API can be called in the Station mode only. Call smartconfig stop to stop the Smart Config process,before repeating it or calling other APIs.Defintion: bool smartconfig start(sc callback t cb, uint8 log)Parameters:The Smart Config callback is executed when the smart-config statuschanges. The parameter status of this callback shows the status of SmartConfig:sc callback t cb When the status is SC STATUS GETTING SSID PSWD, parameter void*pdata is a pointer of sc type, meaning that the Smart Config type isAirKiss or ESP-TOUCH. When the status is SC STATUS LINK, parameter void *pdata is a pointerof struct station config. When the status is SC STATUS LINK OVER, parameter void *pdata is apointer of mobile IP address (4 bytes). It applies to the ESP-TOUCHconfiguration process only; otherwise, parameter void *pdata will beNULL. When the status is otherwise, parameter void *pdata is NULL.“1” indicates that the connection process will be printed out via the UARTinterface. Otherwise, only the connection result will be printed.For example:uint8 log smartconfig start(smartconfig done,1): DEBUG information duringthe connection process will be printed out via the serial port. smartconfig start(smartconfig done): DEBUG information will not beprinted out; only the connection result will be printed.Espressif! /1652018.06

3. API Development!Returned Value:TRUESucceededFALSEFailedExample:void ICACHE FLASH ATTRsmartconfig done(sc status status, void *pdata){switch(status) {case SC STATUS WAIT:os printf("SC STATUS WAIT\n");break;case SC STATUS FIND CHANNEL:os printf("SC STATUS FIND CHANNEL\n");break;case SC STATUS GETTING SSID PSWD:os printf("SC STATUS GETTING SSID PSWD\n");sc type *type pdata;if (*type SC TYPE ESPTOUCH) {os printf("SC TYPE:SC TYPE ESPTOUCH\n");} else {os printf("SC TYPE:SC TYPE AIRKISS\n");}break;case SC STATUS LINK:os printf("SC STATUS LINK\n");struct station config *sta conf pdata;wifi station set config(sta conf);wifi station disconnect();wifi station connect();break;case SC STATUS LINK OVER:os printf("SC STATUS LINK OVER\n");if (pdata ! NULL) {uint8 phone ip[4] {0};memcpy(phone ip, (uint8*)pdata, 4);os printf("Phone ip: %d.%d.%d.%d\n",phone ip[0],phone ip[1],phone ip[2],phone ip[3]);}smartconfig stop();Espressif! /1662018.06

3. API Development!break;}}smartconfig start(smartconfig done);3.1.2. smartconfig stopFunction: stop the Smart Config process, and free the buffer taken bysmartconfig start. Note:After the connection has been established, users can call this API to free the memory taken bysmartconfig start.Defintion: bool smartconfig stop(void)Parameters: NullReturned Value:TRUEFALSESucceededFailed3.1.3. smartconfig set typeFunction: set the protocol type used in smartconfig start mode. Note:Please call this API before smartconfig start。Definition: bool smartconfig set type(sc type type)Parameters:typedef enum {SC TYPE ESPTOUCH 0,SC TYPE AIRKISS,SC TYPE ESPTOUCH AIRKISS,} sc type;Returned Value:TRUEFALSESucceededFailed3.1.4. Structtypedef enum {Espressif! /1672018.06

3. API Development!SC STATUS WAIT 0,SC STATUS FIND CHANNEL 0,SC STATUS GETTING SSID PSWD,SC STATUS LINK,SC STATUS LINK OVER,} sc status; Notice:SC STATUS FIND CHANNEL status: Users may open the App for configuration only when the device startsscanning the channels.typedef enum {SC TYPE ESPTOUCH 0,SC TYPE AIRKISS,SC TYPE ESPTOUCH AIRKISS,} sc type;3.2. ESP32 API3.2.1. esp smartconfig startFunction: configure the device so that it connects to the AP. Notice: This API can be called in the Station mode or Station soft-AP mode. Call esp smartconfig stop to stop the Smart Config process before repeating esp smartconfig start orcalling other APIs.Defintion: esp err t esp smartconfig start(sc callback t cb, .)Parameters:Espressif! /1682018.06

3. API Development!The Smart Config callback is executed when the smart-config statuschanges. The parameter status of this callback shows the status of SmartConfig:sc callback t cb When the status is SC STATUS GETTING SSID PSWD, parameter void*pdata is a pointer of smartconfig type t, meaning that the SmartConfig type is AirKiss or ESP-TOUCH. When the status is SC STATUS LINK, parameter void *pdata is apointer of wifi config t. When the status is SC STATUS LINK OVER, parameter void *pdata is thepointer of a mobile IP address (4 bytes). It applies to the ESP-TOUCHconfiguration process only; otherwise, parameter void *pdata will beNULL. When the status is otherwise, parameter void *pdata is NULL.“1” indicates that the connection process will be printed out via the UARTinterface. Otherwise, only the connection result will be printed.For example,. esp smartconfig start(smartconfig done,1): DEBUG informationduring the connection process will be printed out via the serial port. esp smartconfig start(smartconfig done) DEBUG information will notbe printed out; only the connection result will be printed.Returned Value:ESP OKSucceededothersFailedExample:void sc callback(smartconfig status t status, void *pdata){switch(status) {case SC STATUS WAIT:printf("SC STATUS WAIT\n");break;case SC STATUS FIND CHANNEL:printf("SC STATUS FIND CHANNEL\n");break;case SC STATUS GETTING SSID PSWD:printf("SC STATUS GETTING SSID PSWD\n");smartconfig type t *type pdata;if (*type SC TYPE ESPTOUCH) {Espressif! /1692018.06

3. API Development!printf("SC TYPE:SC TYPE ESPTOUCH\n");} else {printf("SC TYPE:SC TYPE AIRKISS\n");}break;case SC STATUS LINK:printf("SC STATUS LINK\n");wifi config t *wifi conf pdata;esp wifi disconnect();esp wifi set config(ESP IF WIFI STA, wifi conf);esp wifi connect();break;case SC STATUS LINK OVER:printf("SC STATUS LINK OVER\n");if (pdata ! NULL) {uint8 phone ip[4] {0};memcpy(phone ip, (uint8*)pdata, 4);printf("Phone ip: %d.%d.%d.%d\n",phone ip[0],phone ip[1],phone ip[2],phone ip[3]);}esp smartconfig stop();break;}}esp smartconfig start(sc callback);3.2.2. esp smartconfig stopFunction: stop the Smart Config process, and free the buffer taken byesp smartconfig start. Note:After the connection has been established, users can call this API to free the memory.Defintion: esp err t esp smartconfig stop(void)Parameters: NullReturned Value:EspressifESP OKSucceedothersFailed! /16102018.06

3. API Development!3.2.3. esp smartconfig set timeoutFunction: set a timeout limit to Smart Config. Note: Call this API first before calling esp smartconfig start. The timeout limit is calculated by getting the state of SC STATUS FIND CHANNEL, and Smart Config will berestarted after the timeout limit is reached.Defintion: esp err t esp smartconfig set timeout(uint8 t time s)Parameters:time stime-out period, ranging from 15 to 255s.Returned Value:ESP OKSucceedothersFailed3.2.4. esp smartconfig set typeFunction: set the protocol type used in esp smartconfig start mode. Note:Call this API first before calling esp smartconfig start.Defintion: esp err t esp smartconfig set type(smartconfig type t type)Parameters:typedef enum {SC TYPE ESPTOUCH 0,SC TYPE AIRKISS,SC TYPE ESPTOUCH AIRKISS,} smartconfig type t;Returned Value:EspressifESP OKSucceedothersFailed! /16112018.06

3. API Development!3.2.5. esp smartconfig fast modeFunction: enable/disable the Smart Config fast mode. Note: Call this API first before calling esp smartconfig start; To make the fast mode fully functional, a corresponding App is required.Definition: esp err t esp smartconfig fast mode(bool enable)Note:enableTrue: enable fast mode; False: disable fast mode.Returned Value:ESP OKSucceedothersFailed3.2.6. TypeTypedef void (*sc callback t)(smartconfig status t status, void *pdata)Function: input the callback of esp smartconfig start.Parameters:smartconfig status tVoid*EspressifStatus of the device. When the status is SC STATUS GETTING SSID PSWD, parameter void*pdata is a pointer of smartconfig type t, meaning that the SmartConfig type is AirKiss or ESP-TOUCH. When the status is SC STATUS LINK, parameter void *pdata is thepointer of a wifi config t. When the status is SC STATUS LINK OVER, parameter void *pdata is apointer of mobile IP address (4 bytes). It applies to the ESP-TOUCHconfiguration process only ; otherwise, parameter void *pdata will beNULL. When the status is otherwise, parameter void *pdata is NULL.! /16122018.06

3. API Development!3.2.7. Structtypedef enum {SC STATUS WAIT 0,SC STATUS FIND CHANNEL 0,SC STATUS GETTING SSID PSWD,SC STATUS LINK,SC STATUS LINK OVER,} smartconfig status t; Notice:SC STATUS FIND CHANNEL status: users may open the App for configuration only when the device startsscanning the channels.typedef enum {SC TYPE ESPTOUCH 0,SC TYPE AIRKISS,SC TYPE ESPTOUCH AIRKISS,} smartconfig type t;Espressif! /16132018.06

4. ESP-TOUCH 通信协议性能分析!4.ESP-TOUCHPerformance AnalysisThe communication model on which the ESP-TOUCH technology is based can beunderstood as a unidirectional channel with a certain error rate. However, this error ratediffers depending on the bandwidth. The packet error rate for a 20 MHz bandwidth is 0 5%, and the packet error rate for a 40 MHz bandwidth is 0 - 17%. Assuming that themaximum length of data to be transmitted is 104 bytes, if an error-correcting algorithm isnot used, it is difficult to ensure that the data can be transmitted over limited rounds of datatransfer.ESP-TOUCH uses a cumulative error-correcting algorithm to achieve completing thetransmission process over limited rounds of data transfer. The theoretical basis of thecumulative error-correcting algorithm is that the probability of an error occurring on thesame bit of data during multiple rounds of data transmission is very low. Therefore, it ispossible to accumulate results of multiple rounds of data transfer, where there is greatpotential for one bit of erroneous data in one round to lead to the correct correspondingvalue in other rounds, thus ensuring the completion of data transfer within a limited amountof time.k lThe success rate of data transmission can be generalized as ! [1 [1 p ] ] (! p : packetsuccess rate, ! k : round of transmission, ! l : length of transmitted data).Assuming that the length of data to be transmitted is 104 bytes and 72 bytes, the successrate can reach 0.95 when the bandwidth is 20 MHz, and 0.83 when the bandwidth is 40MHz.The tables below show the probability of the data transmission success rate and thetransmission time when the cumulative error-correcting algorithm is adopted.Espressif! /16142018.06

4. ESP-TOUCH 通信协议性能分析!Table 4-1. ESP-TOUCH Error Correcting Analysis (20 MHz Bandwidth)Length: 104 BytesRoundTransmission Time (s)Success RateLength: 72 BytesTransmission Time (s)Success 6.20.99998628.080.99999819.40.99999Table 4-2 ESP-TOUCH Error Correcting Analysis (40 MHz Bandwidth)Length: 104 BytesLength: 72 BytesRoundTransmission Time (s)EspressifSuccess RateTransmission Time (s)Success .20.989628.080.99719.40.998! /16152018.06

Disclaimer and Copyright NoticeInformation in this document, including URL references, is subject to change withoutnotice.THIS DOCUMENT IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER,INCLUDING ANY WARRANTY OF MERCHANTABILITY, NON-INFRINGEMENT, FITNESSFOR ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUTOF ANY PROPOSAL, SPECIFICATION OR SAMPLE.All liability, including liability for infringement of any proprietary rights, relating to use ofinformation in this document is disclaimed. No licenses express or implied, by estoppel orotherwise, to any intellectual property rights are granted herein.The Wi-Fi Alliance Member logo is a trademark of the Wi-Fi Alliance. The Greentooth logois a registered trademark of Greentooth SIG.Espressif IoT TeamAll trade names, trademarks and registered trademarks mentioned in this document areproperty of their respective owners, and are hereby acknowledged.www.espressif.comCopyright 2018 Espressif Inc. All rights reserved.

2. ESP-TOUCH Operations! Note: It only takes a few seconds for the device to connect to the router if the two are close. With greater distance between them, it will take longer to establish their connection. Make sure the router is powered on before configuration, so that the device is able to scan the APs around it. The series of data tran

Related Documents:

Kodak AiO Ink Technology Deep Dive ESP 1.2 / 3.2ESP 1.2 / 3.2 Hero 9.1Hero 9.1 Hero 7.1Hero 7.1 Office Hero 6.1Office Hero 6.1 Hero 5.1Hero 5.1 Hero 3.1Hero 3.1 2011‐ 2013 ESP C110, C310, C315 ESP Office 2150/2170 ESP Office 6150 ESP 7250 ESP 9250 2010‐ ESP 3250 ESP 5250 ESP3 ESP5 ESP7 ESP9 2011 2008‐ 2009 Easyshare 5100 Easyshare 5300 .

ESP 88 and ESP 00 can support a total of 4 cards per ESP for a total of 16 mic/ line inputs and 16 line outputs. The ESP-88 comes pre-loaded with two 4x4 mic/line cards, allowing two additional 4x4 cards to be added. The ESP-00 does not include these cards, so 8 audio input or output cards can be added. PC 0

1 subl 12 , %esp 1 function : 2 movl 3 , 8(%esp ) 2 pushl %ebp 3 movl 2 , 4(%esp ) 3 movl %esp , %ebp 4 movl 1 , (%esp ) 4 subl 16 , %esp 5 c a l l function. Pushes the base pointer (EBP) in the stack, now it’s a saved frame pointer (SFP). Moves the stack pointer (ESP) in EBP, subst

The ESP-MC, ESP-SAT and ESP-SITE-Satellite controllers are available as metal wall-mount (WM) or stainless steel pedestal-mount (SS) models, with 8-, 12-, 16-, 24-, 28, 32, 36- or 40-station capability. All configurations have the following special features: Anti-rus

Datasheet Includes: ESP-WROOM-02D ESP-WROOM-02U. About This Guide This document provides introduction to the specifications of ESP-WROOM-02D and ESP- . Core ESP8266 ESP8266 Antenna Onboard antenna IPEX antenna Dimensions (unit: mm) (18.00 0.10) x (20.00 0.10) x (3.20 0.10)

(Postgres) OSISoft Historian A-MQ. ESP Replacement Business Optimization - BPMN. ESP Demo Walkthrough ESP Vibration Simulation ESP Remote Metrics ESP Remote Control. Global visibility to Production KPIs Demo ESP Machine Health Scenario . SSL/TLS – ensure the wire is encrypted

All ESP course designers should know that the job of an effective ESP course design includes: (a) planning and designing an appropriate course suitable for the target ESP groups, (b) deciding on the practical type of syllabus that well meets the basic requirements of the ESP course participants. 1. Theoretical Background to ESP Course Design

ESP-PSRAM64 and ESP-PSRAM64H are 64 Mbit serial pseudo SRAM devices that are organized in 8Mx8 bits. They are fabricated using the high-performance and high-reliability CMOS technology. ESP-PSRAM64 operates at 1.8V and can offer high data bandwidth at 144 MHz clock rate, while ESP-PSRAM64H o