The WT32C3-S5 is a WiFi module developed by Wireless-Tag Technology Co., Ltd., enabling connectivity between embedded systems and the IoT, utilising the ESP32-C3 WiFi chip, which was developed by Espressif. Third-party developers, such as Wireless-Tag Technology Co., Ltd., develop various PCBs, each with specific electronic components such as an indicator LED, tactile buttons, a USB port, an antenna port, etc., in addition to an ESP chip. Modules that have a USB port enable downloading/flashing of firmware onto the ESP, requiring no additional components. The WT32C3-S5, on the other hand, requires additional electronic components, such as that shown in the IoT Laboratory. Table 1 lists the UART ports in the WT32C3-S5 module and associated functions.

UART PortPinFunctionGPIO9
#Name
UART021GPIO20 (RXD0)DownloadLOW
22GPIO21 (TXD0)Log output
UART17GPIO6 (RXD1)AT commandHIGH
16GPIO7 (TXD1)Response
Table 1: UART Ports

The UART0 port is used for downloading and logging data, while the state of GPIO9 is LOW. The UART1 port is used for receiving AT commands and sending responses accordingly, while the state of GPIO9 is HIGH.

To setup an IoT system that utilises the ESP32-C3, a number of steps need to be taken:

  • Download firmware onto the ESP32-C3
  • Send AT commands to the ESP32-C3 to configure operating characteristics
  • Setup a Dynamic Domain Name System (DDNS) to maintain a connection with a router
  • Enable port forwarding in a router to allow incoming traffic to the ESP32-C3
  • Remote communication

Download Firmware

Video 1 demonstrates how to download AT firmware (factory) onto the ESP32-C3.

Video 1: Firmware Download (Factory)

Table 2 lists various timestamps with a description.

TimestampDescription
PreparationEnsure that slide switch (S1) is switched ON (GPIO9: LOW) to enable download mode. Download the “ESP32-C3-MINI-1-AT” firmware from the Espressif website. Download and open the latest version of the Espressif Flash Tool as the administrator.
0:07The ChipType is ESP32-C3, the WorkMode is Develop, and the LoadMode is UART. Click “OK”.
0:20Ensure that the correct COM port for the USB to RS232 cable and BAUD rate (115200 bps) are selected, then click “ERASE.” This will erase the current firmware on the ESP32-C3. Note that for most of these Wi-Fi modules, the default BAUD rate is 115200 bps. Dots may start appearing on the prompt (black screen). Press and release the tactile switch (SW1) to initiate a reset, which in turn will initiate the erase cycle. Once the erase cycle is complete, click “STOP.”
0:46Click “START” to start reading the details of the ESP32-C3, which will be listed under “DetectedInfo.” Once the detected information is displayed, click “STOP.”
1:02Enter the memory address 0x0 followed by selecting the firmware binary file (factory_MINI-1.bin). Ensure that the corresponding checkbox is checked.
1:19Click “START” to start downloading. Wait some time for the progress bar to complete with a “FINISH.” Close the tool and ensure that slide switch (S1) is switched OFF (GPIO9: HIGH) to enable command mode.
1:47Run MikroC Pro or a serial terminal software as the administrator. Set the correct COM port and BAUD rate (115200 bps).
2:05Click “Connect” and press and release the tactile switch (SW1). If the message “waiting for download” appears in the “Receive” window, this indicates that the slide switch (S1) is tying the GPIO9 pin of the ESP32-C3 to GND. Set S1 such that the GPIO9 pin is pulled to VCC via the pull-up resistor. Press and release the tactile switch (SW1).
2:22The “Receive” window displays a “ready” prompt at the bottom, indicating that the ESP32-C3 is ready to receive commands.
2:25Within the Send window, send “AT” while enabling the “Append New Line” (carriage return + line feed) (\13\10). If received successfully, the ESP32-C3 will respond with an “OK,” indicating that “AT” commands can be sent.
2:32Send “AT+GMR.” If received successfully, the ESP32-C3 will respond with the version of the firmware that was uploaded.
Table 2: ESP-12F Setup

For further details regarding downloading firmware onto the ESP32-C3 and sending AT commands, refer to the ESP32-C3 User Guide.

AT Commands

Table 3 lists AT commands that can be use to configure the ESP32-C3 to be communicated with, remotely, via the internet.

CommandParametersDescription
Test AT Startup

AT
Check Version Information

AT+GMR
Bluetooth Low Energy (BLE) Initialisation

AT+BLEINIT
<init>0Deinitialise BLE
1Client role
2Server role
=0Example
Set RF TX Power

AT+RFPOWER
<wifi_power>x * 0.25 dBmWiFi power determined by variable (x)
<ble_adv_power>0: -27 dBmRF TX Power of BLE advertising

(If using BLE, set AT+BLEINIT to 1 or 2)
1: -24 dBm
2: -21 dBm
3: -18 dBm
4: -15 dBm
5: -12 dBm
6: -9 dBm
7: -6 dBm
8: -3 dBm
9: -0 dBm
10: 3 dBm
11: 6 dBm
12: 9 dBm
13: 12 dBm
14: 15 dBm
15: 18 dBm
<ble_scan_power>Same parameters as <ble_adv_power>
<ble_conn_power>Same parameters as <ble_adv_power>
=78Example
Set WiFi Country Code

AT+CWCOUNTRY
<country_policy>0Country code same as AP
1Country code no change (code set by command)
<country_code>Country code maximum 3 characters
<start_channel>Channel number to start (1 – 14)
<total_channel_count>Total number of channels
=1,”AU”,1,131Example
Set WiFi Mode

AT+CWMODE
<mode>0Null mode (WiFi disabled)
1Station mode
2SoftAP mode
3SoftAP + Station mode
<auto_connect>0ESP32-C3 not automatically connect to an AP
1ESP32-C3 automatically connects to an AP
=1,0Example
WiFi Protected Setup (WPS)

AT+WPS
<enable>1Enable WPS
0Disable WPS
<auth floor>0Open (default)
1WEP
2WPA_PSK
3WPA2_PSK
4WPA_WPA2_PSK
5WPA2_ENTERPRISE
6WPA3_PSK
7WPA2_WPA3_PSK
=1,7Example
Set hostname of ESP32-C3 Station

AT+CWHOSTNAME
<hostname>Hostname of ESP32-C3 Station (max. length 32 bytes)
=”ESP32-C3″Example
Automatically Connect to AP

AT+CWAUTOCONN
<enable>1Enable automatic connection to AP when powered on (default)
0Disable automatic connection to AP when powered on
=0Example
List Available APs

AT+CWLAP
Connect to AP

AT+CWJAP
<ssid>SSID of AP
<pwd>
Password (64 characters MAX)
<bssid>MAC address of AP
<pci_en>0Connect using encryption methods (including OPEN and WEP)
1
Connect using encryption methods (not including OPEN and WEP)
<reconn_interval>0ESP will not reconnect to AP when disconnected
1

7200
ESP will reconnect to AP at specified interval when disconnected (default 1)
<listen_interval>1

100
Interval of listening to AP’s beacon (default 3)
<scan_mode>0Fast scan to connect to first AP (ends after AP is found)
1All channel scan to connect to AP with strongest signal (ends after all channels are scanned)
<jap_timeout>3

600
Maximum timeout for this command (default 15)
<pmf>0Connect to APs that do not require PMF
1Connect to APs that require PMF
=”SSID”,”Password”Example
Query WiFi State and Information

AT+CWSTATE?
Set IP Address of ESP32-C3 Station

AT+CIPSTA
<“ip”>IPv4 address of ESP32-C3 Station
<“gateway”>IPv4 address of router
<“netmask”>
<“ipv6 addr”>
=”192.168.0.XX”,”192.168.0.1″,”255.255.255.0″Example
Obtain Local IP and MAC Address

AT+CIFSR

Multiple Connections

AT+CIPMUX
<mode>0Single connection
1Multiple connections
=1Example
TCP/SSL Server

AT+CIPSERVER
<mode>0Delete server
1Create server (AT+CIPMUX = 1)
<param2><mode> = 1Port number (0 – 65,535) (default 333)
<mode> = 00Shutdown server and keep connections (default)
1Shutdown server and close connections
<“type”>TCPTransmission Control Protocol (TCP) over IPv4 (default)
TCPv6TCP over IPv6
SSLSecure Sockets Layer (SSL) over IPv4
SSLv6SSL over IPv6
<CA enable>0Disable CA
1Enable CA
=1,XXXXX,”TCP”,0Example
Table 3: AT Commands

1 Note that copying and pasting commands that contain curly “quotations” will result in an error as straight quotations need to be used. This is due to the formatting nature of this website that displays curly quotes.

It is recommended to first use serial software, such as that found in MikroC Pro, before using an MCU to send these commands, ensuring they are functioning as intended. Refer to Table 4 for a summary of the AT commands, in order, to establish a platform for IoT communication.

CommandConfig.Example
Test AT StartupN/AAT
Set WiFi Country CodeYesAT+CWCOUNTRY=1,”AU”,1,13
Set WiFi ModeNoAT+CWMODE=1,0
WiFi Protected Setup (WPS)YesAT+WPS=1,7
Set hostname of ESP32-C3 StationNoAT+CWHOSTNAME=”ESP32-C3″
List Available APsYesAT+CWLAP1
Connect to APYesAT+CWJAP=”SSID”,”Password”
Set IP Address of ESP32-C3 StationYesAT+CIPSTA=”192.168.0.XX”,”192.168.0.1″,”255.255.255.0″
Multiple ConnectionsYesAT+CIPMUX=1
TCP/SSL ServerYesAT+CIPSERVER=1,XXXXX,”TCP”,0
Table 4: AT Commands Summary

1 Note that a few minutes need to lapse before the command “AT+CWLAP” can be executed.

The column “Config.” lists commands that cannot be configured (N/A), do not need to be configured (No), and need to be configured (Yes). Commands that cannot be configured are just used for querying. Commands that do not need to be configured are not critical, generally speaking, to establish an IoT platform. Commands that need to be configured are critical, generally speaking, to establish an IoT platform.

DDNS

A DDNS can be used to maintain a remote connection to a router with a dynamic Internet protocol (IP) address. The address of the DDNS is updated by pointing to the IP address of the router. The noip offers a free DDNS service, which is used in this page. After signing up for an account, click on the “Dynamic DNS” drop down menu, click on “No-IP Hostnames”, and then click on “Create Hostname”, as shown in Figure 1.

Figure 1: NO-IP DDNS Part A

Under “Hostname”, enter a desired name. Under “Record Type”, select “DNS Host (A)” to point the hostname to an IPv4 address. Under “Domain”, select “ddns.net”. The public and dynamic IPv4 address of the router used will appear under “IPv4 Address”. This is blanked out for security reasons. Click on “Create Hostname”.

Figure 2: NO-IP DDNS Part B

The created hostname should be visible, in this case it is esp32-c3.ddns.net, as shown in Figure 3.

Figure 3: NO-IP DDNS Part C

The “Active” button on the bottom left is a reminder that free hostnames must be confirmed every 30 days for the free version of an account. To keep NO-IP up-to-date with the latest public and dynamic IPv4 address of the router, the router can configured as shown in Figure 4.

Figure 4: NO-IP Router

All that needs to be done is entering in the login details for NO-IP, after which a “Success” message should appear at the bottom.

Port Forwarding

To enable port forwarding, first log into a router. Go to the firewall settings and look for “Port Forwarding”, as shown in Figure 5.

Figure 5: Port Forwarding

Select “Servers” to match the intended function of the ESP32-C3, i.e., a TCP server. Use a name to identify the port to be forwarded. The TCP protocol is selected to match the TCP server of the ESP32-C3 as previously set by the AT+CIPSERVER command. The WAN and LAN port both share the same value as previously set by the AT+CIPSERVER command. The destination IP is the IPv4 address of the ESP32-C3 station as previously set by the AT+CIPSTA command. This address has been blanked out for security reasons.

Testing the port forward can be achieved using the PortCheckTool as shown in Figure 6.

Figure 6: PortCheckTool

The “Your IP?” field should be automatically filled with the router’s current public IP address. In the “What Port?” field, enter the port number that is port forwarded. Click “Check Your Port”. If a “Success!” message appears, the port is successfully forwarded. In conjunction to this, the receive window of microC Pro for PIC should display messages similar to that shown in Figure 7.

Figure 7: mikroC PRO for PIC (PortCheckTool)

The PortCheckTool establishes a connection with the ESP32-C3, i.e., “0, CONNECT”, after which it immediately disconnects, i.e., “0, CLOSED”.

Remote Communication

Download the Termux Android app to remotely send messages to the ESP32-C3. In the command window, type nc esp32-c3.ddns.net <port number> (without the brackets). If successful, the Receive window of the serial monitor will display “+IPD,0,27:nc esp32-c3.ddns.net <port number>”, as shown in Figure 8.

Figure 8: mikroC PRO for PIC (Termux)

After this, type a string such as “test” and the Receive window will display “+IPD,0,5:test”, indicating that the IoT ESP32-C3 is functioning as intended.