# KS0339 Keyestudio 8266 WIFI Module 2PCS Download Resources : [Resources](./Resources.7z) ![](media/image-20260114154301498.png) ## 1. Product Overview **1.Overview** The package includes 2pcs of ESP8266 WIFI module. It is an ultra-low-power UART-WiFi 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. **2.Features** - Support wireless 802.11 b/g/n standard - Support three working modes: STA/AP/STA+AP - Built-in TCP/IP protocol stack to support multiple TCP Client connections - Support various Socket AT commands - Support UART/GPIO data communication interface - Support Smart Link intelligent networking function - Support remote firmware upgrade (OTA) - Built-in 32-bit MCU, able to double as an application processor - Ultra low consumption, suitable for battery powered applications. - 3.3V single power supply **3.Basic Parameters** ![](media/1.png) ![](media/3.png) **4.Hardware Introduction** ESP8266 hardware has plentiful interfaces, and can support UART,IIC,PWM,GPIO,ADC and more, suited for mobile devices and IoT applications. - **Module pins diagram:** ![](media/image-20260114154803678.png) - **Pins definition:** ![](media/5.png) **5.Power Consumption** The 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. ![](media/6.png) **6.Radio Frequency Indicator** The following data are measured at indoor temperature when the voltage is 3.3v. ![](media/7.png) **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 Description **1.Main Function** ESP8266 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.Working Mode** ESP8266 module supports three working modes: STA/AP/STA+AP - **STA 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.Applications** - Serial port CH340 to Wi-Fi; - Industrial transparent transmission DTU; - Wi-Fi remote monitoring/control; - Toy field - Color LED control; - Integrated management of fire protection and security intelligence; - Smart card terminals, wireless POS machines, Wi-Fi cameras, handheld devices, etc ## 3. Example Use ### 3.1 Use Uno R3 and ESP-01 as server **Tools** **(1)**Prepare the hardware components as follows: - Computer *1; - UNO R3 development board*1; - Esp-01 module *1; - Square USB cable *1 - 2-cell 18650 lithium battery case with batteries *1 **(2)**Software: using arduino IDE. **Connection** Connect Uno R3 to ESP-01 module: ![](media/image-20260114160152022.png) **Test Code** ```c #include 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. **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 server **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 or USR-TCP232-Test debug tool. **Connection** Connect ESP-01 module to TTL USB-to-serial port module: ![](media/image-20260114160803349.png)**Detailed debugging** - A、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. - Open the USR-TCP232-Test debug tool, click![](media/image-20260114160940527.png)to select the language, select the proper USB port and set the baud rate to **115200**; set the Recv Options ![](media/image-20260114161005360.png)A、 , open the serial port. As shown below. ![](media/image-20260114161025617.png) ![](media/image-20260114161032892.png) - D、**AT+CWMODE=3** set the ESP-01 module as mode 3: ![](media/image-20260114161056121.png) 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: ![](media/image-20260114161241279.png) - 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. ![](media/image-20260114161258858.png) - G、AT+CIPSTART="TCP","192.168.4.1",333 connect to server ESP-01, as shown below. ![](media/image-20260114161320440.png) - H、Send the AT+CIPMODE=1 command to set the client ESP-01 as pass-through mode. As shown below. ![](media/image-20260114161342347.png) - I、Send the AT+CIPSEND command means the client ESP-01 send the data instruction to the server ESP-01. As shown below. ![](media/image-20260114161401190.png) - 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. ![](media/image-20260114161417009.png) - 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 Commands ### 4.1 Test the AT - **Syntax Rules:** ![](media/8.png) ### 4.2 WiFi Function AT Command **Select WiFi Application Mode: AT+CWMODE** - **Syntax Rules:** ![](media/9.png) - **Parameter Definition:** ![](media/10.png) **List out Access Point: AT+CWLAP** - **Syntax Rules:** ![](media/11.png) - **Parameter Definition:** ![](media/12.png) **Add Access Point: AT+CWJAP** - **Syntax Rules:** ![](media/13.png) - **Parameter Definition:** ![](media/14.png) **Exit Access Point: AT+CWQAP** - **Syntax Rules:** ![](media/15.png) **Set the AP Mode: AT+CWSAP** - **Syntax Rules:** ![](media/16.png) - **Parameter Definition:** ![](media/17.png) ### 4.3 TCPIP AT Command **Build TCP/UDP Connection: AT+CIPSTART** - **Syntax Rules:** ![](media/18.png) - **Parameter Definition:** ![](media/19.png) **Get TCP/UDP Connection Status: AT+CIPSTATUS** - **Syntax Rules:** ![](media/20.png) - **Parameter Definition:** ![](media/21.png) **Start Multilink: AT+CIPMUX** - **Syntax Rules:** ![](media/22.png) - **Parameter Definition:** ![](media/23.png) **Send Data: AT+CIPSEND** - **Syntax Rules:** ![](media/24.png) - **Parameter Definition:** ![](media/25.png) **Close TCP/UDP Connection: AT+CIPCLOSE** - **Syntax Rules:** ![](media/26.png) - **Parameter Definition:** ![](media/27.png) **Get Local IP Address: AT+CIFSR** - **Syntax Rules:** ![](media/28.png) - **Parameter Definition:** ![](media/29.png) **Select TCPIP Mode: AT+CIPMODE** - **Syntax Rules:** ![](media/30.png) - **Parameter Definition:** ![](media/31.png) **Set the Sever Timeout: AT+CIPSTO** - **Syntax Rules:** ![](media/32.png) - **Parameter Definition:** ![](media/33.png) **Set the Baud Rate: AT+CIOBAUD** - **Syntax Rules:** ![](media/34.png) The default baud rate is 9600. - **Parameter Definition:** ![](media/35.png) ## 5. AT Command Settings When 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. ![](media/image-20260114170554312.png) Connected successfully, open the ESP8266 debugging tool, set the baud rate to 115200, click to open the Serial Port, and click Test the AT. ![](media/image-20260114170706110.png) ## 6. Firmware Programming When 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. ![](media/image-20260114170802663.png) Then open flash_download_tools_v3.6.5software, click to open![](media/image-20260114170815119.png). ![](media/image-20260114170852725.png) Wait for a minute, pop up the below interface, click the ESP8266 Download Tool. ![](media/image-20260114171050532.png) Pop up the interface to set the firmware burning. This is the address of firmware burning.![image-20260114171107256](media/image-20260114171107256.png) ![](media/image-20260114171113162.png) 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. ![](media/image-20260114171133654.png) ![](media/image-20260114171139246.png) Firmware download completed, can enter the corresponding software to set the AT command.