KS0339 Keyestudio 8266 WIFI Module 2PCS: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 187: Line 187:
* Mini USB cable *1
* Mini USB cable *1


'''(2)'''Software: using [https://drive.google.com/open?id=1UAYAhdqr2iXO49ibkLyV4c2Aieteihs6  esp8266 debugging tool]   <br>
'''(2)'''Software: using [https://drive.google.com/open?id=1UAYAhdqr2iXO49ibkLyV4c2Aieteihs6  esp8266 debugging tool] or [https://drive.google.com/open?id=1W6XbaJoVHgOlnexGbT5A5_P19jWlob8j  USR-TCP232-Test debug tool]  <br>


<br>
<br>
Line 201: Line 201:
* B、Connect the TTL USB-to-serial port module to the computer using a mini USB cable.<br>
* B、Connect the TTL USB-to-serial port module to the computer using a mini USB cable.<br>
<span style="color:red"> '''SPECIAL NOTE:''' need to program the corresponding drive to the TTL USB-to-serial port module before use.</span><br>
<span style="color:red"> '''SPECIAL NOTE:''' need to program the corresponding drive to the TTL USB-to-serial port module before use.</span><br>
* C、Open the esp8266 debug tool, select the proper USB port and set the baud rate to 115200; then open the serial port. As shown below.
* C、Open the [https://drive.google.com/open?id=1W6XbaJoVHgOlnexGbT5A5_P19jWlob8j  USR-TCP232-Test debug tool], click [[Image:0339-图片10.png|600px|frameless]] to select the language, select the proper USB port and set the baud rate to 115200; set the Recv Options[[Image:0339-图片11.png|600px|frameless]] , open the serial port. As shown below.
[[Image:0339图片-3.png|600px|frameless]]<br>
[[Image:0339-图片1.png|600px|frameless]]<br>
[[Image:0339-图片2.png|600px|frameless]]<br>


* D、'''AT+CWMODE=3'''  set the ESP-01 module as mode 3:
* D、'''AT+CWMODE=3'''  set the ESP-01 module as mode 3:
[[Image:0339图片-4.png|600px|frameless]]<br>
[[Image:0339-图片3.png|600px|frameless]]<br>


<span style="color:red">  Special attention:  </span><br>
<span style="color:red">  Special attention:  </span><br>
Line 213: Line 214:
   
   
* E、AT+CWJAP="KEYES_server","123456789" connect to server ESP-01 WIFI:
* E、AT+CWJAP="KEYES_server","123456789" connect to server ESP-01 WIFI:
[[Image:0339图片-5.png|600px|frameless]]<br>
[[Image:0339-图片4.png|600px|frameless]]<br>


* 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.
* 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.
[[Image:0339图片-6.png|600px|frameless]]<br>
[[Image:0339-图片5.png|600px|frameless]]<br>


* G、AT+CIPSTART="TCP","192.168.4.1",333 connect to server ESP-01, as shown below.
* G、AT+CIPSTART="TCP","192.168.4.1",333 connect to server ESP-01, as shown below.
[[Image:0339图片-7.png|600px|frameless]]<br>
[[Image:0339-图片6.png|600px|frameless]]<br>


* H、Send the AT+CIPMODE=1 command to set the client ESP-01 as pass-through mode. As shown below.  
* H、Send the AT+CIPMODE=1 command to set the client ESP-01 as pass-through mode. As shown below.  
[[Image:0339图片-8.png|600px|frameless]]<br>
[[Image:0339-图片7.png|600px|frameless]]<br>


* I、Send the AT+CIPSEND command means the client ESP-01 send the data instruction to the server ESP-01. 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.
[[Image:0339图片-9.png|600px|frameless]]<br>
[[Image:0339-图片8.png|600px|frameless]]<br>


* 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.
* 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.
[[Image:0339图片-10.png|600px|frameless]]<br>
[[Image:0339-图片9.png|600px|frameless]]<br>


* 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.
* 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.
Line 414: Line 415:
<br>
<br>
==Resources Download==
==Resources Download==
'''Download all the information here:''' <br>
https://drive.google.com/open?id=12Bbvwp4T9M1l1yXyZcdQzoXifMvhGZ4c


'''Download the PDF:'''<br>
'''Download all the tools here:''' <br>
https://drive.google.com/open?id=1NlO4T_7S_2yZ8S_k7Bzjs1TipCMJu_cm
https://fs.keyestudio.com/KS0339
 
 




<br>
<br>
==Buy from ==
==Buy from ==
*[https://www.keyestudio.com/2pcs-esp8266-esp-01-serial-wireless-wifi-transceiver-module-with-keyestudio-packing-box-for-arduino-p0358-p0358.html  '''Official Website''']
*[https://www.keyestudio.com/2pcs-esp8266-esp-01-serial-wireless-wifi-transceiver-module-with-keyestudio-packing-box-for-arduino-p0358-p0358.html  '''Official Website''']

Latest revision as of 15:52, 9 March 2021

keyestudio 8266 WIFI Module (2PCS)


Product Overview

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.


Features:

  • 1)Support wireless 802.11 b/g/n standard
  • 2)Support three working modes: STA/AP/STA+AP
  • 3)Built-in TCP/IP protocol stack to support multiple TCP Client connections
  • 4)Support various Socket AT commands
  • 5)Support UART/GPIO data communication interface
  • 6)Support Smart Link intelligent networking function
  • 7)Support remote firmware upgrade (OTA)
  • 8)Built-in 32-bit MCU, able to double as an application processor
  • 9)Ultra low consumption, suitable for battery powered applications.
  • 10) 3.3V single power supply


Basic Parameters:


0339图片2.png

0339图片3.png


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:


0339图片4.png


  • Pins definition:


0339图片5.png


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.


0339图片6.png


Radio Frequency Indicator:

The following data are measured at indoor temperature when the voltage is 3.3v.
0339图片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.


Function Description

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.


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.


Applications:

  • 1)Serial port CH340 to Wi-Fi;
  • 2)Industrial transparent transmission DTU;
  • 3)Wi-Fi remote monitoring/control;
  • 4)Toy field
  • 5)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



Example Use


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:
0339图片.png


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.


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.


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:
0339图片-2.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.

  • C、Open the USR-TCP232-Test debug tool, click 0339-图片10.png to select the language, select the proper USB port and set the baud rate to 115200; set the Recv Options0339-图片11.png , open the serial port. As shown below.

0339-图片1.png
0339-图片2.png

  • D、AT+CWMODE=3 set the ESP-01 module as mode 3:

0339-图片3.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:

0339-图片4.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.

0339-图片5.png

  • G、AT+CIPSTART="TCP","192.168.4.1",333 connect to server ESP-01, as shown below.

0339-图片6.png

  • H、Send the AT+CIPMODE=1 command to set the client ESP-01 as pass-through mode. As shown below.

0339-图片7.png

  • I、Send the AT+CIPSEND command means the client ESP-01 send the data instruction to the server ESP-01. As shown below.

0339-图片8.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.

0339-图片9.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.



Basic AT Commands

Test the AT

  • Syntax Rules:

thumb


WiFi Function AT Command

Select WiFi Application Mode: AT+CWMODE

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


List out Access Point: AT+CWLAP

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Add Access Point: AT+CWJAP

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Exit Access Point: AT+CWQAP

  • Syntax Rules:

thumb


Set the AP Mode: AT+CWSAP

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb



TCPIP AT Command

Build TCP/UDP Connection: AT+CIPSTART

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Get TCP/UDP Connection Status: AT+CIPSTATUS

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Start Multilink: AT+CIPMUX

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Send Data: AT+CIPSEND

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Close TCP/UDP Connection: AT+CIPCLOSE

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Get Local IP Address: AT+CIFSR

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Select TCPIP Mode: AT+CIPMODE

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Set the Sever Timeout: AT+CIPSTO

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


Set the Baud Rate: AT+CIOBAUD

  • Syntax Rules:

thumb


  • Parameter Definition:

thumb


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.
thumb

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.

You can download the ESP8266 debugging tool from the link below:
https://drive.google.com/open?id=1UAYAhdqr2iXO49ibkLyV4c2Aieteihs6


thumb



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.
thumb

Then open flash_download_tools_v3.6.5software, click to open thumb

You can download the flash download tools v3.6.5 from the link:
https://drive.google.com/open?id=1Zjg-lg7ySsmN4C3A0Oz9UJCdXqtkdf_R


thumb

Wait for a minute, pop up the below interface, click the ESP8266 Download Tool.
thumb

Pop up the interface to set the firmware burning. This is the address of firmware burning. thumb

thumb

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.
thumbthumb

Firmware download completed, can enter the corresponding software to set the AT command.



Resources Download

Download all the tools here:
https://fs.keyestudio.com/KS0339




Buy from