Skip to main content
ESPBoards

ESP32 SIM5320 3G WCDMA/HSDPA Module

The SIM5320 is a versatile 3G WCDMA/HSDPA module that provides reliable communication capabilities for various applications. Its compact design, high-speed data connectivity, and multiple interfaces make it an ideal choice for projects requiring cellular and GPS functionalities.

Jump to Code Examples

Arduino Core Image
ESP-IDF Image
ESPHome Image
PlatformIO Image
MicroPython Image

Quick Links

SIM5320 3G WCDMA/HSDPA Module Datasheet ButtonSIM5320 3G WCDMA/HSDPA Module Specs ButtonSIM5320 3G WCDMA/HSDPA Module Specs ButtonSIM5320 3G WCDMA/HSDPA Module Specs Button

SIM5320 Price

SIM5320 3G WCDMA/HSDPA Module
Normally, the SIM5320 3G WCDMA/HSDPA Module costs around 31.16$ per Psc.
The prices are subject to change. Check current price:

Amazon com

Amazon de logo

Aliexpress logo

About SIM5320 3G WCDMA/HSDPA Module

The SIM5320 is a dual-band HSDPA/WCDMA and quad-band GSM/GPRS/EDGE module designed for a wide range of applications, including smartphones, PDAs, industrial handhelds, machine-to-machine communication, and vehicle applications. It supports HSDPA with downlink speeds up to 3.6 Mbps, providing robust and high-speed data connectivity.

If you are still choosing the SIM Module and would like to know more about different available LTE, 3G, GPRS Modules, check the ESP32 SIM Modules Comparison Table.

SIM5320 Sensor Technical Specifications

Below you can see the SIM5320 3G WCDMA/HSDPA Module Technical Specifications. The sensor is compatible with the ESP32, operating within a voltage range suitable for microcontrollers. For precise details about its features, specifications, and usage, refer to the sensor’s datasheet.

  • Protocol: UART
  • Frequency Bands: WCDMA 850/1900 MHz; GSM 850/900/1800/1900 MHz
  • Data Rates: HSDPA: 3.6 Mbps (DL); WCDMA: 384 Kbps (DL/UL); EDGE: 236.8 Kbps (DL/UL); GPRS: 85.6 Kbps (DL/UL)
  • Operating Voltage: 3.3V to 4.2V
  • Operating Temperature: -40°C to +85°C
  • Dimensions: 30mm x 30mm x 2.9mm

SIM5320 Sensor Pinout

Below you can see the pinout for the SIM5320 3G WCDMA/HSDPA Module. The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32!

The SIM5320 pinout includes:

  • VBAT: Power supply input (3.3V to 4.2V).
  • GND: Ground connection.
  • TXD: UART Transmit Data (connects to microcontroller RX).
  • RXD: UART Receive Data (connects to microcontroller TX).
  • PWRKEY: Power on/off control (active low).
  • NETLIGHT: Network status indication.
  • STATUS: Module operating status indication.
  • ANT_MAIN: Main antenna connection for WCDMA/GSM.
  • ANT_GPS: Antenna connection for GPS.
  • SIM_VDD: SIM card power supply.
  • SIM_DATA: SIM card data I/O.
  • SIM_CLK: SIM card clock.
  • SIM_RST: SIM card reset.

SIM5320 Wiring with ESP32

Below you can see the wiring for the SIM5320 3G WCDMA/HSDPA Module with the ESP32. Connect the VCC pin of the sensor to the 3.3V pin on the ESP32 or external power supply for power and the GND pin of the sensor to the GND pin of the ESP32. Depending on the communication protocol of the sensor (e.g., I2C, SPI, UART, or analog), connect the appropriate data and clock or signal pins to compatible GPIO pins on the ESP32, as shown below in the wiring diagram.

To interface the SIM5320 with a microcontroller, follow these steps:
  • Connect VBAT to a stable power supply within the range of 3.3V to 4.2V.
  • Connect GND to the system ground.
  • Connect TXD to the microcontroller's RX pin.
  • Connect RXD to the microcontroller's TX pin.
  • Control the PWRKEY pin to power the module on or off (active low).
  • Connect the ANT_MAIN to a suitable WCDMA/GSM antenna for network connectivity.
  • Optionally, connect the ANT_GPS to a GPS antenna for location services.
  • Connect the SIM card interface pins (SIM_VDD, SIM_DATA, SIM_CLK, SIM_RST) to a SIM card holder as per the hardware design guidelines.

Code Examples

Below you can find code examples of SIM5320 3G WCDMA/HSDPA Module with ESP32 in several frameworks:

If you encounter issues while using the SIM5320 3G WCDMA/HSDPA Module, check the Common Issues Troubleshooting Guide.

Arduino Core Image

ESP32 SIM5320 Arduino IDE Code Example

Example in Arduino IDE

Fill in your main Arduino IDE sketch file with the following code to use the SIM5320 3G WCDMA/HSDPA Module:

#include <SoftwareSerial.h>

SoftwareSerial sim5320(10, 11); // RX, TX
#define PWRKEY 9

void powerOnSIM5320() {
pinMode(PWRKEY, OUTPUT);
digitalWrite(PWRKEY, LOW);
delay(1000); // Hold PWRKEY low for 1 second
digitalWrite(PWRKEY, HIGH);
delay(5000); // Wait for the module to initialize
}

void setup() {
Serial.begin(9600);
sim5320.begin(9600);
powerOnSIM5320();

// Test AT command
sim5320.println("AT");
delay(1000);
while (sim5320.available()) {
Serial.write(sim5320.read());
}

// Set SMS text mode
sim5320.println("AT+CMGF=1");
delay(1000);
while (sim5320.available()) {
Serial.write(sim5320.read());
}

// Send SMS
sim5320.println("AT+CMGS=\"+1234567890\""); // Replace with recipient's number
delay(1000);
sim5320.print("Hello from SIM5320");
sim5320.write(26); // CTRL+Z to send
delay(5000);
while (sim5320.available()) {
Serial.write(sim5320.read());
}
}

void loop() {
// Add code to handle incoming messages or other functionalities
}

This Arduino sketch interfaces with the SIM5320 module using the SoftwareSerial library. The module is powered on by toggling the PWRKEY pin (GPIO9). An AT command is sent to test communication. The module is configured to SMS text mode using the AT+CMGF command, and an SMS is sent to a specified recipient using AT+CMGS. The message is finalized with CTRL+Z (ASCII 26) to trigger transmission. Additional functionalities, such as retrieving GPS data, handling incoming SMS, or establishing internet connectivity using GPRS or HSDPA, can be implemented in the loop.

Connect your ESP32 to your computer via a USB cable, Ensure the correct Board and Port are selected under Tools, Click the "Upload" button in the Arduino IDE to compile and upload the code to your ESP32.

ESP-IDF Image

ESP32 SIM5320 ESP-IDF Code Example
Example in Espressif IoT Framework (ESP-IDF)

If you're using ESP-IDF to work with the SIM5320 3G WCDMA/HSDPA Module, here's how you can set it up and read data from the sensor. Fill in this code in the main ESP-IDF file:

#include <stdio.h>
#include "driver/uart.h"
#include "driver/gpio.h"
#include "freertos/task.h"

#define TX_PIN 17
#define RX_PIN 16
#define PWRKEY_PIN 4
#define UART_PORT UART_NUM_1

void init_uart() {
uart_config_t uart_config = {
.baud_rate = 9600,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
};

uart_param_config(UART_PORT, &uart_config);
uart_set_pin(UART_PORT, TX_PIN, RX_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
uart_driver_install(UART_PORT, 1024, 0, 0, NULL, 0);
}

void power_on_sim5320() {
gpio_set_direction(PWRKEY_PIN, GPIO_MODE_OUTPUT);
gpio_set_level(PWRKEY_PIN, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS); // Hold PWRKEY low for 1 second
gpio_set_level(PWRKEY_PIN, 1);
vTaskDelay(5000 / portTICK_PERIOD_MS); // Wait for the module to initialize
}

void app_main(void) {
init_uart();
power_on_sim5320();

char *test_cmd = "AT\r\n";
uart_write_bytes(UART_PORT, test_cmd, strlen(test_cmd));

while (true) {
char data[128];
int len = uart_read_bytes(UART_PORT, data, sizeof(data), 100 / portTICK_PERIOD_MS);
if (len > 0) {
data[len] = '\0';
printf("Response: %s\n", data);
}
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}

This ESP-IDF example initializes UART communication with the SIM5320 module and powers it on using the PWRKEY pin (GPIO4). The UART interface is configured with GPIO17 as TX and GPIO16 as RX. An AT command is sent to test communication, and responses from the module are printed to the console. The code can be extended to include SMS sending, GPS data retrieval, or establishing internet connectivity via HSDPA.

Update the I2C pins (I2C_MASTER_SDA_IO and I2C_MASTER_SCL_IO) to match your ESP32 hardware setup, Use idf.py build to compile the project, Use idf.py flash to upload the code to your ESP32.

ESPHome Image

ESP32 SIM5320 ESPHome Code Example

Example in ESPHome (Home Assistant)

Fill in this configuration in your ESPHome YAML configuration file (example.yml) to integrate the SIM5320 3G WCDMA/HSDPA Module

uart:
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 9600

switch:
- platform: gpio
name: "SIM5320 Power"
pin:
number: GPIO4
inverted: true

switch:
- platform: template
name: "Send AT Command"
turn_on_action:
- uart.write: "AT\r\n"

sensor:
- platform: custom
lambda: |-
return {nullptr};
sensors:
- name: "SIM5320 Response"

This ESPHome configuration sets up UART communication with the SIM5320 module using GPIO17 (TX) and GPIO16 (RX) at 9600 baud. A GPIO-based switch is used to control the PWRKEY pin (GPIO4) for powering the module on or off. A template switch allows sending the AT command, and a custom sensor can be implemented to process responses from the module. Additional configurations can be added for SMS, GPS, or internet functionalities.

Upload this code to your ESP32 using the ESPHome dashboard or the esphome run command.

PlatformIO Image

ESP32 SIM5320 PlatformIO Code Example

Example in PlatformIO Framework

For PlatformIO, make sure to configure the platformio.ini file with the appropriate environment and libraries, and then proceed with the code.

Configure platformio.ini

First, your platformio.ini should look like below. You might need to include some libraries as shown. Make sure to change the board to your ESP32:

[env:sim5320]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200

ESP32 SIM5320 PlatformIO Example Code

Write this code in your PlatformIO project under the src/main.cpp file to use the SIM5320 3G WCDMA/HSDPA Module:

#include <HardwareSerial.h>
#include <Arduino.h>

HardwareSerial sim5320(1);
#define PWRKEY 4

void power_on_sim5320() {
pinMode(PWRKEY, OUTPUT);
digitalWrite(PWRKEY, LOW);
delay(1000); // Hold PWRKEY low for 1 second
digitalWrite(PWRKEY, HIGH);
delay(5000); // Wait for initialization
}

void setup() {
Serial.begin(115200);
sim5320.begin(9600, SERIAL_8N1, 16, 17); // RX, TX
power_on_sim5320();

// Test AT command
sim5320.println("AT");
delay(1000);
while (sim5320.available()) {
Serial.write(sim5320.read());
}

// Send SMS
sim5320.println("AT+CMGF=1"); // Set SMS to text mode
delay(1000);
sim5320.println("AT+CMGS=\"+1234567890\""); // Replace with recipient's number
delay(1000);
sim5320.print("Hello from SIM5320");
sim5320.write(26); // CTRL+Z to send SMS
delay(5000);
}

void loop() {
// Handle incoming data or other functionalities
}

This PlatformIO code interfaces with the SIM5320 module using HardwareSerial on an ESP32. The `power_on_sim5320` function toggles the PWRKEY pin (GPIO4) to activate the module. The AT command is sent to test communication, and SMS functionality is implemented in the setup. Additional functionalities, like GPS data retrieval or HSDPA internet connectivity, can be added in the loop.

Upload the code to your ESP32 using the PlatformIO "Upload" button in your IDE or the pio run --target upload command.

MicroPython Image

ESP32 SIM5320 MicroPython Code Example

Example in Micro Python Framework

Fill in this script in your MicroPython main.py file (main.py) to integrate the SIM5320 3G WCDMA/HSDPA Module with your ESP32.

from machine import UART, Pin
import time

# Initialize UART
uart = UART(2, baudrate=9600, tx=17, rx=16)
pwrkey = Pin(4, Pin.OUT)

def power_on_sim5320():
pwrkey.value(0)
time.sleep(1) # Hold PWRKEY low for 1 second
pwrkey.value(1)
time.sleep(5) # Wait for module to initialize

def send_at(command):
uart.write(command + '\r\n')
time.sleep(1)
while uart.any():
print(uart.read().decode('utf-8'), end='')

# Power on the module
power_on_sim5320()

# Test communication
send_at('AT')

# Send SMS
send_at('AT+CMGF=1') # Set SMS to text mode
send_at('AT+CMGS="+1234567890"') # Replace with recipient's number
uart.write("Hello from MicroPython" + chr(26))

This MicroPython code communicates with the SIM5320 module over UART. The `power_on_sim5320` function activates the module using the PWRKEY pin (GPIO4). The `send_at` function sends AT commands and prints the responses. The script initializes the module, tests communication, and demonstrates how to send an SMS. Additional logic for handling GPS or internet connectivity can be added.

Upload this code to your ESP32 using a MicroPython-compatible IDE, such as Thonny, uPyCraft, or tools like ampy.

SIM5320 3G WCDMA/HSDPA Module Troubleshooting

This guide outlines a systematic approach to troubleshoot and resolve common problems with the . Start by confirming that the hardware connections are correct, as wiring mistakes are the most frequent cause of issues. If you are sure the connections are correct, follow the below steps to debug common issues.

Module Fails to Power On

Issue: The SIM5320 module does not power up or respond to commands.

Possible causes include insufficient power supply, incorrect wiring, or faulty hardware.

Solution: Ensure the module is connected to a stable power source within the recommended voltage range of 3.4V to 4.2V. Verify that all connections are secure and correctly configured. If the problem persists, consider testing the module with a different power source or replacing it.

SIM Card Not Recognized

Issue: The module fails to detect or register the SIM card.

Possible causes include improper SIM card insertion, unsupported SIM card type, or SIM card lock.

Solution: Ensure the SIM card is properly inserted into the module's SIM card slot and is compatible with the GSM network. Verify that the SIM card is active and unlocked. If necessary, test the SIM card in another device to confirm its functionality.

Poor Network Signal or Connectivity Issues

Issue: The module experiences weak signal strength or fails to maintain a stable network connection.

Possible causes include improper antenna connection, environmental interference, or network coverage limitations.

Solution: Ensure the GSM antenna is securely connected to the module and positioned for optimal signal reception. Avoid placing the module near sources of electromagnetic interference. Check the network coverage in your area to ensure adequate signal strength.

AT Commands Not Responding

Issue: The module does not respond to AT commands sent from the microcontroller or computer.

Possible causes include incorrect baud rate settings, faulty serial connections, or improper command syntax.

Solution: Verify that the baud rate of the module matches that of the microcontroller or computer; the default baud rate is 115200 bps. Check that the TX and RX lines are correctly connected and that there are no loose connections. Ensure that AT commands are correctly formatted and terminated with a carriage return.

GPS Functionality Not Working

Issue: The SIM5320 module fails to acquire GPS signals or provide location data.

Possible causes include improper antenna connection, obstructed view of the sky, or GPS functionality not enabled.

Solution: Ensure the GPS antenna is properly connected and has a clear view of the sky to receive satellite signals. Verify that the GPS functionality is enabled by sending the appropriate AT commands to power on the GPS engine.

Conclusion

We went through technical specifications of SIM5320 3G WCDMA/HSDPA Module, its pinout, connection with ESP32 and SIM5320 3G WCDMA/HSDPA Module code examples with Arduino IDE, ESP-IDF, ESPHome and PlatformIO.