ESP32-C2 module transparent transmission example

WIFI-TTL transparent transmission module description

V 1.0 2022-11-24

1 Introduction

The WiFi-TTL transparent transmission module is developed based on our DT-ESPC2-12 module, which leads to serial port TTL, EN, STATE and other pins. The product has built-in the latest version  of our company's serial port transparent transmission firmware, which can complete the real-time transparent transmission of data from the device's TTL port to WiFi/cloud. This module can directly replace the original wired serial port to realize data acquisition and control of embedded devices.

TTL-WiFi module features are as follows:

l Based on Bluetooth and Cozylife distribution network, the network distribution is fast and the success rate is high

l Based on Cozylife applet configuration, no need to input IP configuration through browser, better user experience

l Real-time seamless transparent transmission of serial port and WiFi data

l The serial port supports setting baud rate, data bits, parity, stop bits, flow control

l Support baud rate 300, 600, 1200, 2400, 4800, 9600, 19200, 28800, 38400, 57600, 74880, 115200, 128000, 230400, 256000, 460800, 921600, 1843200, 3686400

l 支持TCP Server、TCP Client、UDP Server、UDP Client

l Application scenarios: smart home , wireless data collection and transparent transmission, smart car control, wireless serial printer, outdoor

LED  lights, industrial control , etc.

2 Module parameters

general parameters

lChip  : ESP32 - C2 

l Dimensions: 16mm24mm3mm

Wi-Fi  characteristics

l IEEE 802.11 b/g/n compatible

l Channel frequency: 2412 ~ 2484 MHz

nBluetooth  features

l Bluetooth LE: Bluetooth 5, Bluetooth mesh

l Speed: 125 Kbps, 500 Kbps, 1 Mbps, 2 Mbps

nPeripheral  interface _

l RXD

l TXD

l STATUS

l VCC

l GND

l FR

nWorking  temperature  :  -40℃-85℃

nWorking  temperature  :  -40℃-105℃ (optional)

3 Interface definition

Figure 31 Interface definition

serial number interface Function
1 TXWIFI GPIO1, TTL-WIFI transparent data transmission pin
2 RXWIFI GPIO2, TTL-WIFI transparent transmission data receiving pin
3 STATUS GPIO3, Socket connection status output pin, output high level when Socket is connected, output low level when not connected
4 IN IN
5 VCC 3V3 power supply port
6 GND GND
7 GND GND

Note: The GPI O0-GPIO2, GPIO6GPIO10, GPIO18GPIO20 pins on the original module are not used.

4 Device distribution network

When the module is powered on, the module that is not connected for the first time will directly enter the distribution network mode

If the module has been configured, it is necessary to restart the module 5 times in a row, and the restart interval is about 1 second, and the module will re-enter the distribution network mode;

Open the Cozylife app, click "Discover 1 device"

Select the discovered device and click "Next"

Figure 41 Discovering devices

Figure 42 Select device

Mobile phone connection 2. 4G  WIFI;

Enter the WIFI SSID and password, click "Connect", and wait for the device to automatically configure the network;

Figure 43 Enter WIFI password

Figure 44 Waiting for network configuration

After the device is successfully configured, click "Finish" to enter the device control page, where you can configure the serial port and Socket parameters;

Figure 45 The configuration is successful

AT commands

data direction instruction illustrate
STA status query
MCU ->WII module AT+STATUS Check the STA mode status
WiFi module -> MCU STA:OK The WiFi module replies that the STA connection is successful
WiFi module -> MCU STA: DISCONNECT WiFi module replies STA connection failure
Get IP and MAC in STA mode
MCU->WiFi module AT+STAINFO Get WiFi module IP and MAC
WiFi module -> MCU 192.168.5.153 10:97:bd:f3:62:24
Query the connection status in TCP Client mode
MCU->WiFi module AT+TCPCLIENT Query the connection status in TCP Client mode, meaningless in other modes
WiFi module -> MCU TCP:OK The TCP client is already connected
WiFi module -> MCU TCP: DISCONNECT TCP client disconnected
restart module
MCU->WiFi module AT+RST Restart wifi module
WiFi module -> MCU RST:OK Respond immediately when receiving instructions
reset
MCU->WiFi module AT+RESTORE WiFi module restore factory settings
WiFi module -> MCU RESTORE:OK Respond immediately when receiving instructions

6 Factory reset

See AT command - restore factory settings command

Or restart the module 5 times continuously, the restart interval is about 1 second, and the module will re-enter the distribution network mode;

7 Device configuration

7.1 Description of configuration interface

Figure 71 Configuration interface

The configuration interface is divided into 4 areas:

l [Device IP information area] is the actual IP after the device is connected to the network, and it is used as the IP to connect to the server in the server mode;

l [TTCL serial port configuration area], you can configure the baud rate, data bits, parity bits, stop bits, flow control and other information of the serial port

l [Socket configuration area], you can configure parameters such as the type of Socket transparent transmission, IP address and port number of different transparent transmission protocols.

l [Parameter save and upload button], used to save the parameters to the device. It will not be lost even if the device is powered off after saving.

7.2 TTL serial port configuration

l Click the "Baud Rate" number to choose a variety of supported baud rates, including:

300/600/1200/2400/4800/9600/19200/38400/57600/74880/115200/230400/460800/921600/1843200/3686400

l Click "Data Bit" to choose 5/6/7/8 data bits

l Click "Parity" to select "Disable", EVEN, ODD

l Click "stop bit" to choose 1, 1.5, 2 stop bit

l Click "Flow Control" to select "Disable", RTS_CTS, CTS, RTS

Figure 72 Baud rate selection

Figure 73 Data bit selection

Figure 74 Parity selection

Figure 75 Stop bit selection

Figure 76 Flow control selection

7.3 Transparent transmission Socket type configuration

The transparent transmission socket can choose:

l Not set

l TCP server

l TCP client

l UDP server

l UDP client

Figure 77 Socket type selection

7.4 Set Socket parameters

After selecting the Socket transparent transmission type, you can configure the corresponding Socket parameters.

When filling in the port value, you should note that the port value is an integer not greater than 65535. If you fill in a wrong value, the system will prompt an error. At this time, the error should be corrected, otherwise the wrong parameter will not be saved.

Figure 78 port input error

When filling in the IP, it should be noted that the correct format of the IP is "xxx.xxx.xxx.xxx", where xxx is an integer between 0 and 255, and non-host addresses such as broadcast addresses, multicast addresses, and network addresses should not be filled in.

Figure 79 IP input error

7.5 Save parameters

After configuration, click the "Save" button to save the parameters.

After saving, all configurations will be stored on the device side, and the configuration will not be lost if the device is powered off, restarted and upgraded.

After modifying the serial port parameters, modify the serial port parameters of other devices connected to the device at the same time.

After modifying the Socket parameters, ensure that the parameters of the peer host or server are configured consistently.

7.6 Other options

Click the pencil icon in the upper right corner to view device details.

Figure 710 Device details

In the device details, if there is a new firmware, the firmware can be updated online. When updating, ensure that the device is powered on and the network is unblocked.

Figure 711 Device Information and Updates

8 configuration example

8.1 Software used

Computer side: NetAssist, SerialTool, Netcat.

8.2 TCP server transparent transmission example

The Cozylife APP configuration enables the TCP server function and configures the TCP server port number. Click "Save".

Figure 81 TCP server configuration

Open the NetAssist network debugging assistant on the computer, select TCP Client for the protocol type, and fill in the IP address and configured port number displayed on the CozyLife APP for IP and port.

Network debugging assistant and SerialTool transparent transmission

Figure 82 Network debugging assistant, SerialTool interface

8.3 Example of transparent transmission of TCP client through tcp .doit.am**** transit service

http://tcp.doit.am provides tcp client message transfer service, the specific content can be found on http://tcp.doit.am website.

[]()http://tcp.doit.am provides services using the IP address and port number of 115.29.109.104:6548.

The Cozylife APP configuration enables the TCP client function, and configures the IP address of the peer TCP server to be connected to 115.29.109.104 and the port number to 6548. Click "Save".

Figure 83 Configure TCP client parameters

Open the NetAssist network debugging assistant on the computer, select TCP Client for the protocol type, and fill in the information on http://tcp.doit.am for the IP and port.

Figure 84 Network debugging assistant interface

8.4 UDP **** server transparent transmission example

The Cozylife APP configuration enables the UDP server function and configures the port number to be monitored. Click "Save".

Figure 85 Configure UDP server

Enter the nc command line on the computer side, use the "-u" parameter to configure the udp mode, and connect to the device IP and port. like:

netcat-win32-1.12>nc64 -u 192.168.100.239 6110

Enter characters in the sending area of ​​​​SerialTool, and it will be transparently transmitted to the nc terminal;

Enter characters at the nc terminal, and it will be transparently transmitted to the SerialTool terminal.

8.5 UDP**** client transparent transmission example

Cozylife APP configuration enables the UDP client function, and configures the IP address and port number of the peer UDP server to be connected, which is the address of the local machine in this example. Click "Save".

Figure 86 Configure UDP client

Enter the nc command line on the computer side, and use the "-ul" parameter to configure the udp server listening mode. like:

netcat-win32-1.12>nc64 -ul -p 7000

Enter characters in the sending area of ​​​​SerialTool, and it will be transparently transmitted to the nc terminal;

Enter characters at the nc terminal, and it will be transparently transmitted to the SerialTool terminal.

9-module minimal system

Figure 91 Minimum system

The module is powered by 3.3V DC.

The MCU is cross-connected with the TTL serial cable of the module.

The module and MCU should share the same ground.

10-module Socket state-aware minimum system

Figure 101 System with Socket state awareness

The module is powered by 3.3V DC.

The MCU is cross-connected with the TTL serial cable of the module.

The MCU uses pin 1 as the input IN pin and connects the module STATUS output pin; when the Socket connection is normal, the STATUS will output a high level, otherwise it will output a low level.

The module and MCU should share the same ground.

[]()

11 Appearance and Dimensions

The module uses DT-ESPC2-12 hardware , which has the same shape and size.

Figure 111 Appearance

Figure 112 Top View Dimensions

Figure 113 Side View Dimensions

Figure 114  PCB layout

12 []() recommended product module installation

This module can be directly soldered on the PCB board, in order to improve the RF performance, please leave blank for the PCB antenna area.

There are 3 ways to use this module:

Method 1: The module is placed on the side of the PCB. The antenna is completely exposed, and no metal objects can be placed around it, including but not limited to wires, metal casings, metal weights, etc.

Method 2: The module is placed in the PCB frame, and the antenna area is hollowed out. Keep at least 5mm distance between the antenna and the PCB. No metal objects can be placed around, including but not limited to wires, metal casings, metal weights, etc.

Method 3: The module is placed on the PCB, and the area around the antenna is completely vacant, and the PCB cannot be covered with copper in this area.

Figure 121 Mode 1

Figure 122 Mode 2

Figure 12-3 Mode 3

13 Technical parameters

13.1  Electrical Characteristics

Parameters Condition Min Classical Max Unite
Store Temperature - -40 Normal 150
Sold Temperature IPC/JEDEC J-STD-020 - - 260
Working Voltage - 3.0 3.3 3.6 V
I/O WILL - -0.3 - 0.25*VDD
HIV - 0.75*VDD - VDD+0.3
VOL - - - 0.1*VDD
VOH - 0.8*VDD - -
Electrostatic release quantity (Human model) TAMB=25℃ - - 2 KV
Electrostatic release quantity (Human model) TAMB=25℃ - - 0.5 KV

Table 131 Electrical Characteristics

13.2  Energy Consumption

Parameters Min Classical Max Unit
RX 11b /g/n, HT20 - - 82 mA
RX 11n,HT40 - 84
TX 11b, 1Mbps@21dBm - 350
TX 11g, 54Mbps@19dBm - - 295 mA
TX 11n, HT20, MCS7, @18.5dBm - - 290 mA
TX 11n, HT40, MCS7, @18.5dBm - - 290 mA
Modem-sleep, CPU is powered on @80MHz - 15 - mA
Light-sleep - 130 - uA
Deep-sleep, RTC timer + RTC memory - 5 - uA
Power off, CHIP_PU is set to low level - 1 0 uA

Table 132 Energy Consumption

13.3 WIFI RF Characteristics

以下参数为3.3V时室温环境测得。

Parameters Min Classical Max Unit
Input frequency 2412 - 2484 MHz
802.11b @1Mbps,11Mbps - 20.5 - dBm
802.11g @6Mbps - 20.0 - dBm
802.11g @54Mbps - 18.0 - dBm
802.11n,HT20 MCS0 - 19.0 - dBm
802.11n,HT40 MCS0 - 18.5 - dBm
EVM @11b,1Mbps@21dBm - -24.5 - dBm
EVM @11g,54Mbps@19dBm - -28 - dBm
EVM @11n,[email protected] - -30.5 - dBm
EVM @11n, HT40, [email protected] - -30.5 - dBm

表 133 WIFI RF特性

Table.6.2 Wi-Fi RX Sensitivity

Parameters Min Classical Max Unit
802.11b,1Mbps - -98 - dBm
802.11b,11Mbps - -88. - dBm
802.11g,6Mbps - -92 - dBm
802.11g,54Mbps - -76 - dBm
802.11n,HT20,MCS0 - -92 - dBm
802.11n,HT20,MCS3 - -85 - dBm
802.11n,HT20,MCS7 - -74 - dBm
802.11n,HT40,MCS0 - -90 - dBm
802.11n,HT40,MCS3 - -81 - dBm
802.11n,HT40,MCS7 - -71 - dBm

Table.6.3 Wi-Fi RX Characteristics

Parameters Min Classical Max Unit
MAX RX Level @11b,1Mbps - 5 - dBm
MAX RX Level @11b,11Mbps - 5 - dBm
MAX RX Level @11g,6Mbps - 5 - dBm
MAX RX Level @11g,54Mbps - 0 - dBm
MAX RX Level @11n,HT20,MCS0 - 5 - dBm
MAX RX Level @11n,HT20,MCS7 - 0 - dBm
MAX RX Level @11n,HT40,MCS0 - 5 - dBm
MAX RX Level @11n,HT40,MCS7 - 0 - dBm
RX Adjacent Channel Rejection@11b,1Mbps - 35 - dB
RX Adjacent Channel Rejection@11b,11Mbps - 35 - dB
RX Adjacent Channel Rejection@11g,6Mbps - 31 - dB
RX Adjacent Channel Rejection@11g,54Mbps - 14 - dB
RX Adjacent Channel Rejection@11n,HT20,MCS0 - 31 - dB
RX Adjacent Channel Rejection@11n,HT20,MCS7 - 13 - dB
RX Adjacent Channel Rejection@11n,HT40,MCS0 - 19 - dB

13.4 BLE射频

Parameters Min Classical Max Unit
Gain control power - 3 - dBm
RF power control range -27 - 18 dBm
In-band emissions @F-F0±3MHz, LE 1M - -41.95 - dBm
In-band emissions @F-F0±>3MHz, LE 1M - -44.48 - dBm
Modulation characteristics @ △f1avg, LE 1M - 245 - kHz
Modulation characteristics @△f2max, LE 1M - 208 - kHz
Carrier frequency offset, LE 1M - -9 - kHz
In-band emissions @F-F0±5MHz, LE 2M - -45.26 - dBm
In-band emissions @F-F0±>5MHz, LE 2M - -47 - dBm
Modulation characteristics @ △f1avg, LE 2M - 497 - kHz
Modulation characteristics @△f2max, LE 2M - 398 - kHz
Carrier frequency offset, LE 2M - -9 - kHz
In-band emissions @F-F0±3MHz, LE 500K - -41.3 - dBm
In-band emissions @F-F0±>3MHz, LE 500K - -42.8 - dBm
Modulation characteristics @ △f1avg, LE 500K - 220 - kHz
Modulation characteristics @△f2max, LE 500K - 205 - kHz
Carrier frequency offset, LE 500K - -11.9 - kHz
Maximum received signal @30.8% PER - 10 - dBm

表 134 BLE射频

Table.7.2 RX Transmitter General Characteristics

Parameters Min Classical Max Unit
1M Sensitivity @30.8% PER - -96 -
Maximum received signal @30.8% PER - 10 - dBm
Co-channel C/I - 8 - dB
Image frequency - -29 - dB
Adjacent channel to image frequency @F =F image +1 - -38 - dB
Adjacent channel to image frequency @F =F image -1 - -34 - dB
Adjacent channel selectivity@ F =F0+1 - -4 -
Adjacent channel selectivity@ F =F0-1 - -3 - dB
Adjacent channel selectivity@ F ≥F0+3 - - - dB
Adjacent channel selectivity@ F ≤F0-3 - -39 - dB
2M Sensitivity @30.8% PER - -93 -
Maximum received signal @30.8% PER - 0 - dBm
Co-channel C/I - 10 - dB
Image frequency - -27 - dB
Adjacent channel to image frequency @F =F image +2 - -39 - dB
Adjacent channel to image frequency @F =F image -2 - - - dB
Adjacent channel selectivity@ F =F0+2 - -7 - dB
Adjacent channel selectivity@ F =F0-2 - -7 - dB
Adjacent channel selectivity@ F ≥F0+6 - -39 - dB
Adjacent channel selectivity@ F ≤F0-6 - -39 - dB
125K Sensitivity @30.8% PER - -104 -
Maximum received signal @30.8% PER - 10 - dBm
Co-channel C/I - 2 - dB
Image frequency - -34 - dB
Adjacent channel to image frequency @F =F image +1 - -44 - dB
Adjacent channel to image frequency @F =F image -1 - -37 - dB
Adjacent channel selectivity@ F =F0+2 - -40 - dB
Adjacent channel selectivity@ F =F0-2 - -42 - dB
Adjacent channel selectivity@ F ≥F0+3 - - - dB
Adjacent channel selectivity@ F ≤F0-3 - -46 - dB

Guess you like

Origin blog.csdn.net/DOIT_SZ/article/details/131396518