Inland 8266 WIFI Module (2PCS) Contents1. Product Overview1.1 Overview1.2 Features1.3 Basic Parameters1.4 Hardware Introduction1.5 Power Consumption1.6 Radio Frequency Indicator2. Function Description2.1 Main Function2.2 Working Mod2.3 Applications3. Example Use3.1 Use Uno R3 and ESP-01 as server3.1.1 Tools3.1.2 Connection3.1.3 Test Code3.1.4 Use and Result3.2 Set ESP-01 as Client and connect server3.2.1 Tools3.2.2 Connection3.2.3 Detailed debugging4. Basic AT Commands4.1 Test the AT4.2 WiFi Function AT Command4.2.1 Select WiFi Application Mode: AT+CWMODE4.2.2 List out Access Point: AT+CWLAP4.2.3 Add Access Point: AT+CWJAP4.2.4 Exit Access Point: AT+CWQAP4.2.5 Set the AP Mode: AT+CWSAP4.3 TCPIP AT Command4.3.1 Build TCP/UDP Connection: AT+CIPSTART4.3.2 Get TCP/UDP Connection Status: AT+CIPSTATUS4.3.3 Start Multilink: AT+CIPMUX4.3.4 Send Data: AT+CIPSEND4.3.5 Close TCP/UDP Connection: AT+CIPCLOSE4.3.6 Get Local IP Address: AT+CIFSR4.3.7 Select TCPIP Mode: AT+CIPMODE4.3.8 Set the Sever Timeout: AT+CIPSTO4.3.9 Set the Baud Rate: AT+CIOBAUD 5. AT Command Settings6. Firmware Programming7. Resources Download 1. Product Overview1.1 OverviewThe package includes 2pcs of ESP8266 WIFI module. It is an ultra-low-power UART-Wi-Fi pass-through module with industry-leading package size and ultra-low power technology. It is specially designed for mobile devices and IoT applications. It can connect users' physical devices to Wi-Fi wireless network for Internet or LAN communication, achieving the networking function.1.2 Features1) Support wireless 802.11 b/g/n standard2) Support three working modes: STA/AP/STA+AP 3) Built-in TCP/IP protocol stack to support multiple TCP Client connections4) Support various Socket AT commands5) Support UART/GPIO data communication interface6) Support Smart Link intelligent networking function7) Support remote firmware upgrade (OTA)8) Built-in 32-bit MCU, able to double as an application processor9) Ultra low consumption, suitable for battery powered applications.10) 3.3V single power supply1.3 Basic Parameters 1.4 Hardware IntroductionESP8266 hardware has plentiful interfaces, and can support UART,IIC,PWM,GPIO,ADC and more, suited for mobile devices and IoT applications. Module pins diagram: Pins definition: Power ConsumptionThe following measured power consumption data is based on a 3.3V power supply at 25°ambient temperature.1. All measurements are done at the antenna interface.2. All transmit data is based on a 90% duty cycle and measured in continuous transmission mode. 1.6 Radio Frequency IndicatorThe following data are measured at indoor temperature when the voltage is 3.3v. Note: 1. 72.2Mbps is measured in 802.11n mode, MCS=7,GI=200uS.2. The output power of up to +19.5dBm can be reached in 802.11b mode. 2. Function Description2.1 Main FunctionESP8266 can realize the main functions as follows: Serial port passthrough: data transmission, good reliability of transfer; the maximum transmission rate is up to 460800bps.PWM regulation and control: light adjustment, RGB LED adjustment, motor speed control and more.GPIO control: control the switches, relays and more. 2.2 Working ModeESP8266 module supports three working modes: STA/AP/STA+APSTA mode: The ESP8266 module can access to the Internet through a router, so the mobile phone or computer can remotely control the device through the Internet.AP mode: The ESP8266 module acts as a hotspot to enable communication directly with the mobile phone or computer to achieve wireless control of the local area network (LAN).STA+AP mode: The coexistence mode of the above two modes, that is, can achieve the seamless switching through the Internet control, more convenient for operation. 2.3 Applications1) Serial port CH340 to Wi-Fi;2) Industrial transparent transmission DTU;3) Wi-Fi remote monitoring/control;4) Toy field5) Color LED control;6) Integrated management of fire protection and security intelligence;7) Smart card terminals, wireless POS machines, Wi-Fi cameras, handheld devices, etc.3. Example Use3.1 Use Uno R3 and ESP-01 as server3.1.1 Tools(1) Prepare the hardware components as follows:Computer *1; UNO R3 development board*1; Esp-01 module *1;Square USB cable *12-cell 18650 lithium battery case with batteries *1(2) Software: using Arduino IDE3.1.2 ConnectionConnect Uno R3 to ESP-01 module: 3.1.3 Test Code#include <SoftwareSerial.h> SoftwareSerial mySerial(2, 3); // RX, TX char OK[2]=""; ////////////////////////////////////////////////////////////////////////// void OK_config() { while(1) { OK[0]=mySerial.read(); if(OK[0]=='O') { OK[1]=mySerial.read(); if(OK[1]=='K') { break; } } delay(20); } } ////////////////////////////////////////////////////////////////////////// void esp8266_config() { Serial.println("AT+RST"); delay(1000); mySerial.println("AT+CWMODE_DEF=3"); //set the current Wi-Fi mode and save to Flash OK_config(); mySerial.println("AT+CWSAP=\"KEYES_server\",\"123456789\",11,2"); OK_config(); mySerial.println("AT+CIPMUX=1"); //multiple connection default port=333 OK_config(); mySerial.println("AT+CIPSERVER=1"); //build TCP Server OK_config(); Serial.println("Initialize the server!"); digitalWrite(13,HIGH); OK_config(); //wait Client to send OK; access to Client } /////////////////////////////////////////////////////////////////////// void setup() { Serial.begin(115200); mySerial.begin(115200); pinMode(13,OUTPUT); digitalWrite(13,LOW); esp8266_config(); } void loop() { mySerial.println("AT+CIPSEND=0,9"); delay(1000); mySerial.println("arduino"); digitalWrite(13,LOW); delay(1000); digitalWrite(13,HIGH); delay(1000); } ////////////////////////////////////////////////////////////////////////// Note: The code USES the AT instruction of esp-01 to realize the required functions. Please refer to the specific AT instructions mentioned below.3.1.4 Use and Result A. connect the UNO R3 main board to the computer via USB port with a square USB cable; then open the Arduino IDE to upload the test code to UNO R3.B. Unplug the USB cable; connect the esp-01 module to UNO R3 main board using jumper wires according to the connection diagram.C. Supply the power to UNO R3 main board via black DC power jack with 2-cell 18650 batteries; wait for a few seconds, LED labeled L on the UNO R3 will normally turn on. Otherwise, pull out the power cable and repower again.3.2 Set ESP-01 as Client and connect server3.2.1 Tools(1) Prepare the hardware components as follows:Computer *1; TTL USB to serial port module *1; Esp-01 module *1;Mini USB cable *1(2) Software: using esp8266 debugging tool 3.2.2 Connection Connect ESP-01 module to TTL USB-to-serial port module: 3.2.3 Detailed debuggingA. Follow the connection diagram to connect ESP-01 module to TTL USB-to-serial port module;B. Connect the TTL USB-to-serial port module to the computer using a mini USB cable.SPECIAL NOTE: need to program the corresponding drive to the TTL USB-to-serial port module before use.C. Open the USR-TCP232-Test debug tool, click Options (O) select the language, select the proper USB port and set the baud rate to 115200; set the Recv Options, open the serial port. As shown below. D. AT+CWMODE=3 set the ESP-01 module as mode 3: Special attention: 1 : To fill in the instruction, a newline character should be added after the instruction is typed, as shown in the figure above. All subsequent instructions should be operated in this way.2 : To send instructions to esp-01.3 : The information returned after the instruction is received by esp-01. E. AT+CWJAP="KEYES_server","123456789" connect to server ESP-01 WIFI: F. AT+CIPAP_CUR="192.168.1.20","192.168.1.20" modify the IP of client ESP-01 AP; modifying the IP of AP is to avoid the conflict between client AP’s IP and server AP’s IP. As figure shown below. G. AT+CIPSTART="TCP","192.168.4.1", 333 connect to server ESP-01, as shown below. H. Send the AT+CIPMODE=1 command to set the client ESP-01 as pass-through mode. As shown below. I. Send the AT+CIPSEND command means the client ESP-01 send the data instruction to the server ESP-01. As shown below. J. Client ESP-01 sends the “OK” character to server ESP-01; trigger the server ESP-01 to send the “Arduino” character to client ESP-01 all the time. As figure shown below. K. At this moment, the LED labeled L on the UNO R3 main board connected to server ESP-01 will turn on normally, which illustrates it always send the data to client ESP-01.4. Basic AT Commands4.1 Test the ATSyntax Rules: Parameter Definition: 4.2.2 List out Access Point: AT+CWLAPSyntax Rules: Parameter Definition: 4.2.3 Add Access Point: AT+CWJAPSyntax Rules: Parameter Definition: 4.2.4 Exit Access Point: AT+CWQAPSyntax Rules: 4.2.5 Set the AP Mode: AT+CWSAPSyntax Rules: Parameter Definition: 4.3 TCPIP AT Command4.3.1 Build TCP/UDP Connection: AT+CIPSTARTSyntax Rules: Parameter Definition: 4.3.2 Get TCP/UDP Connection Status: AT+CIPSTATUSSyntax Rules: Parameter Definition: 4.3.3 Start Multilink: AT+CIPMUXSyntax Rules: Parameter Definition: 4.3.4 Send Data: AT+CIPSENDSyntax Rules: Parameter Definition: 4.3.5 Close TCP/UDP Connection: AT+CIPCLOSESyntax Rules: Parameter Definition: 4.3.6 Get Local IP Address: AT+CIFSRSyntax Rules: Parameter Definition: 4.3.7 Select TCPIP Mode: AT+CIPMODESyntax Rules: Parameter Definition: 4.3.8 Set the Sever Timeout: AT+CIPSTOSyntax Rules: Parameter Definition: 4.3.9 Set the Baud Rate: AT+CIOBAUDSyntax Rules: The default baud rate is 9600. Parameter Definition: 5. AT Command SettingsWhen setting the AT command, you should use a USB to Serial module, that is FT232 module, and a WIFI to serial shield. Connect well and then connect them to your computer using mini USB cable. Connected successfully, open the ESP8266 debugging tool, set the baud rate to 115200, click to open the Serial Port, and click Test the AT. You should see the data received window will print out AT OK. To set other AT commands, the method is similar. 6. Firmware ProgrammingWhen setting the AT command, you should use a USB to Serial module, that is FT232 module, and a WIFI to serial shield. Connect well and then connect them to your computer using mini USB cable. Then open flash_download_tools_v3.6.5software, click to open. Wait for a minute, pop up the below interface, click the ESP8266 Download Tool. Pop up the interface to set the firmware burning. This is the address of firmware burning. Hold the FLASH button on the shield, and Tap START button, then press RST button on the shield, release the FLASH button. The module will enter the download mode. Shown below. Firmware download completed, can enter the corresponding software to set the AT command.