ESP32-S3-A-SIM7670X-4G HAT
| ||
Overview
Introduction
The ESP32-S3-A-SIM7670X-4G HAT (the development board) is a multifunctional, high-performance microcontroller development board designed by Waveshare. It integrates an A/SIM7670X 4G communication module, a universal OV camera interface, a TF card slot, RGB colorful lights, an 18650 battery slot, a battery voltage measurement IC, a solar charging interface, and other peripherals. It employs the ESP32-S3R2, a system-level chip (SoC) that integrates low-power Wi-Fi and BLE5.0. Additionally, it comes with an external 16MB Flash and 2MB PSRAM. The SoC incorporates a hardware encryption accelerator, RNG, HMAC, and digital signature modules, meeting the security requirements of the Internet of Things (IoT).
The A/SIM7670X 4G communication module provides mobile network capabilities, enabling functionalities like portable Wi-Fi and IoT data transmission when combined with the ESP32-S3R2. Its various low-power operating modes cater to power consumption demands in IoT, mobile devices, outdoor monitoring, smart home applications, and other scenarios.
Features
- Comes with high-performance Xtensa® 32-bit LX7 dual-core processor with up to 240MHz.
- Support 2.4GHz WiFi (802.11 b/g/n) and Bluetooth® 5 (LE) with onboard antenna.
- Built-in 512 SRAM, 384KB ROM, 2MB PSRAM, and with external 16MB Flash.
Hardware Description
- Onboard ESP32-S3 USB connects to A/SIM7670X USB connector, using TinyUSB protocol for PPP dial-up networking as a portable WiFi function.
- Onboard 18650 battery interface for 3.7V single-cell 18650 lithium batteries, pay attention to the lithium battery interface's positive and negative labels.
- This development board mainly includes two parts: ESP32-S3 and 7670 series 4G Cat-1 module.
- ESP32-S3
- Camera function: 24pin camera interface, the supported cameras as shown below:
- ESP32-S3
Model | Max Resolution | Color Type | Len Size |
---|---|---|---|
OV2640 | 1600 x 1200 | color | 1/4" |
OV3660 | 2048 x 1536 | color | 1/5" |
OV5640 | 2592 x 1944 | color | 1/4" |
OV7670 | 640 x 480 | color | 1/6" |
OV7725 | 640 x 480 | color | 1/4" |
NT99141 | 1280 x 720 | color | 1/4" |
GC032A | 640 x 480 | color | 1/10" |
GC0308 | 640 x 480 | color | 1/6.5" |
GC2145 | 1600 x 1200 | color | 1/5" |
BF3005 | 640 x 480 | color | 1/4" |
BF20A6 | 640 x 480 | color | 1/10" |
SC101IOT | 1280 x 720 | color | 1/4.2" |
SC030IOT | 640 x 480 | color | 1/6.5" |
SC031GS | 640 x 480 | color | 1/6" |
- Onboard C3 antenna, use 0R shorting optional external antenna.
- Onboard TF-Card slot, supports FTP transfer of files and pictures.
- Onboard USB to UART chip and automatic download circuit, you can burn programs and firmware after connecting the Type-C cable.
- Development board reserved GPIO can be used for external device connection and can be flexibly configured to I2C, SPI, and other peripheral functions.
- A/SIM7670X
- Onboard GNSS IPX 1 connector for GNSS positioning function using related commands after power-on.
- Onboard microphone and speaker header, the A7670 series development board supports phone call function.
- Onboard solar power charging function and the input voltage can change according to different resistors. When solar power is charging, the onboard green LED will be on.
- Onboard dial-up switch for powering on cameras, USB HUB circuits, and 4G modules, and can switch the USB circuit of 4G modules.
- Onboard circuit switch for controlling the circuits with 18650 batteries power supply.
- Onboard 18650 battery anti-reverse function and the onboard yellow LED will be on when the batteries are reversely connected.
- Onboard battery voltage measurement IC, can be used for battery level reminder when working outdoors without an external power supply.
Module Selection
SIM7670G
- SIM7670G is a Qualcomm solution, which can realize GNSS and digital transmission function, SIM7670G itself can't be used to receive phone calls.
A7670X
- A7670X R2 is a solution for China to realize GNSS and phone call functions.
Hardware Connection
This development board's ESP32-S3 UART to USB module and 4G module USB use the same Type-C interface, and you can select the USB interface of the 4G module, ESP32-S3 USB connector, or the Type-C interface through the dip switch on the back of the development board. This function is mainly used when the ESP32-S3 uses Tiny USB 4G module communication as a portable WiFi, wireless hotspot.
Working with ESP-IDF
This chapter introduces the setup of the ESP-IDF environment, including the installation of Visual Studio, the Espressif IDF plugin, program compilation and download, as well as testing of sample programs. It aims to help users gain proficiency with the development board for secondary development.
Environment Setup
Download and Install VSCode
- Open the download page of the official VSCode website, and select the corresponding system and system bit to download.
- After running the installation package, the rest can be installed by default, but here for the subsequent experience, it is recommended to check boxes 1, 2, and 3
- After the first and second items are enabled, you can open VSCode directly by right-clicking files or directories, which can improve the subsequent user experience.
- After the third item is enabled, you can select VSCode directly when you choose how to open it.
Installing the Espressif IDF Plugin
- The "online installation" is generally recommended for installing the Espressif IDF plugin. If online installation is not possible due to network issues, then "offline installation" can be used.
- For the tutorial on installing the Espressif IDF plugin, please refer to: Install Espressif IDF Plugin Tutorial
Run the First ESP-IDF Demo
New Project
Create Demo
- Using the shortcut F1, enter esp-idf:show examples projects
- Select your current IDF version
- Take the Hello world demo as an example
①Select the corresponding demo
②Its readme will state what chip the demo applies to (how to use the demo and the file structure are described below, omitted here)
③Click to create the demo
- Select the path to save the demo, and require that the demos cannot use folders with the same name
Modify COM port
- The corresponding COM ports are shown here, click to modify them
- Please select the COM ports according to your device (You can view it from the device manager)
- In case of a download failure, please press the Reset button for more than 1 second or enter download mode, and wait for the PC to recognize the device again before downloading once more
Modify driver object
- Select the object we need to drive, which is our main chip ESP32S3
- Choose the path to openocd, it doesn't affect us here, so let's just choose one
Introduction to other status bar functions
①.ESP-IDF Development Environment Version Manager, when our project requires differentiation of development environment versions, it can be managed by installing different versions of ESP-IDF. When the project uses a specific version, it can be switched to by utilizing it
②.Device flashing COM port, select to flash the compiled program into the chip
③.Select set-target chip model, select the corresponding chip model, for example, ESP32-P4-NANO needs to choose esp32p4 as the target chip
④.menuconfig, click it to Modify sdkconfig configuration file Project configuration details
⑤.fullclean button, when the project compilation error or other operations pollute the compiled content, you can clean up all the compiled content by clicking it
⑥.Build project, when a project satisfies the build, click this button to compile
⑦.Current download mode, the default is UART
⑧.flash button, when a project build is completed, select the COM port of the corresponding development board, and click this button to flash the compiled firmware to the chip
⑨.monitor enable flashing port monitoring, when a project passes through Build --> Flash, click this button to view the log of output from flashing port and debugging port, so as to observe whether the application works normally
⑩.Debug
⑪.Build Flash Monitor one-click button, which is used to continuously execute Build --> Flash --> Monitor, often referred to as “little flame”
Compile, flash and serial port monitor
- Click on the all-in-one button we described before to compile, flash and open the serial port monitor.
- It may take a long time to compile especially for the first time
- During this process, the ESP-IDF may take up a lot of CPU resources, so it may cause the system to lag
- If it is the first time to flash the program for a new project, you will need to select the download method, and select UART
- This can also be changed later in the Download methods section (click on it to pop up the options)
- As it comes with the onboard automatic download circuit, it can be downloaded automatically without manual operation
- After successful download, it will automatically enter the serial monitor, you can see the chip output the corresponding information and be prompted to restart after 10S
Use the IDF demos
Open in the software
- Open VScode software and select the folder to open the demo
- Select the provided ESP-IDF example and click to select the file (located in the Examples/Demo/ESP-IDF path)
Open from outside the software
- Select the project directory correctly and open the project, otherwise it will affect the compilation and flashing of subsequent programs
- After connecting the device, select the COM port and model, click below to compile and flash to achieve program control
ESP-IDF Project Details
- Component: The components in ESP-IDF are the basic modules for building applications, each component is usually a relatively independent code base or library, which can implement specific functions or services, and can be reused by applications or other components, similar to the definition of libraries in Python development.
- Component reference: The import of libraries in the Python development environment only requires to "import library name or path", while ESP-IDF is based on the C language, and the importing of libraries is configured and defined through
CMakeLists.txt
. - The purpose of CmakeLists.txt: When compiling ESP-IDF, the build tool
CMake
first reads the content of the top-levelCMakeLists.txt
in the project directory to read the build rules and identify the content to be compiled. When the required components and demos are imported into theCMakeLists.txt
, the compilation toolCMake
will import each content that needs to be compiled according to the index. The compilation process is as follows:
- Component reference: The import of libraries in the Python development environment only requires to "import library name or path", while ESP-IDF is based on the C language, and the importing of libraries is configured and defined through
Demo
Demo | Basic Description |
---|---|
Wireless_USB_flash_drive | The ESP32-S3-GEEK can be used as a USB disk with wireless access capabilities |
Wireless_USB_flash_drive
Program Description
- This routine allows the ESP32-S3-GEEK to be used as a USB disk with wireless access capabilities. When combined with SD card storage, it can become a high-capacity wireless storage device. Additionally, you can connect to the ESP32-S3-GEEK's hotspot to upload and download via an HTTP file server, greatly facilitating user operations. It is suitable for learning the USB MSC functionality of the ESP32, as it can act as a storage device connected to a USB host, supporting various storage methods, with callback functions to handle various events, and testing for stability and reliability
- To exit the program, simply press the boot button and power cycle the device
Hardware connection
- Insert the TF card into the development board
- Connect the development board to the computer
Code analysis
- init_fat():Initializes the FAT file system. Depending on the configuration, it mounts either the internal flash memory or an external TF card
- If using internal flash memory, a specific function is selected for mounting based on the ESP-IDF version
- If using an external TF card, it is initialized and mounted according to the interface type (SPI or SDIO)
- app_main ():The main function that coordinates the initialization of various parts of the program, including file storage, Wi-Fi (if configured), and USB MSC
- Calls
init_fat
to initialize file storage - If Wi-Fi is configured, it initializes and starts the file server
- Initializes tinyUSB and installs the driver
- Calls
Code Burning
- Ensure the TF card is installed
- Select the model (esp32s3) and port
- Download via UART
- Burn the program
Result demonstration
- After programming, unplug and plug the ESP32-S3-GEEK again, and you can see a new USB flash driver
- You can open the USB drive to browse through the files on the TF card and perform various operations such as adding, deleting, modifying, and checking files
- Enter the PC's WIFI setting, connect to the ESP32-S3-GEEK's AP, and input the password of "Waveshare"
- After connecting successfully, open the browser, and log in to IP: 192.168.4.1
- After login successfully, you can upload and download files wirelessly
Demo Explaination
ESP32-S3 Application
Camera
This demo is based on the CameraWebServer demo of the ESP32.
- Firstly, you need to set the WiFi name and password and switch the hardware to ESP32S3 by default.
- Please turn on CAM of the DIP switch on the back of the development board, and connect to the supported cameras.
- Please check CameraPins:
#define PWDN_GPIO_NUM -1 #define RESET_GPIO_NUM -1 #define XCLK_GPIO_NUM 34 #define SIOD_GPIO_NUM 15 #define SIOC_GPIO_NUM 16 #define Y9_GPIO_NUM 14 #define Y8_GPIO_NUM 13 #define Y7_GPIO_NUM 12 #define Y6_GPIO_NUM 11 #define Y5_GPIO_NUM 10 #define Y4_GPIO_NUM 9 #define Y3_GPIO_NUM 8 #define Y2_GPIO_NUM 7 #define VSYNC_GPIO_NUM 36 #define HREF_GPIO_NUM 35 #define PCLK_GPIO_NUM 37
- Program the demo Burn the code and open the terminal to access the prompted IPs:
TF-Card
- Insert the TF card into the TF card slot.
- Define the pins:
const int SDMMC_CLK = 5; const int SDMMC_CMD = 4; const int SDMMC_DATA = 6; const int SD_CD_PIN = 46;
- Program the demo, and open the terminal to display the file content:
RGB
Onboard a WS2812b RGB LED, and the signal pin is 38.
After programming the sample demo, the LED light is expected to display a gradient color.
BAT
This development board utilizes the MAX17048 as the battery charge measurement IC.
- First, confirm the I2C pin:
- Program the code and change the threshold:
4G Cat-1 Application
A7670X Series
HTTP
AT Command |
Command Description |
Return Value |
AT+HTTPINIT |
Enable HTTP service |
OK |
AT+HTTPPARA="URL", https://www.waveshare.cloud/api/sample-test/ |
Connect to the remote server |
OK |
AT+HTTPDATA=5,1000 |
Input data |
DOWNLOAD <Key enter hello OK |
AT+HTTPACTION=0 |
Enable HTTP request, 0: GET; 1: POST; 2: HEAD; 3: DELETE; 4: PUT |
OK +HTTPACTION: 0,200,54 |
AT+HTTPTERM |
Disable HTTP service |
OK |
AT+HTTPPARA |
Set HTTP parameters |
OK |
AT+HTTPHEAD |
Read the HTTP response header |
OK |
AT+HTTPREAD |
Read HTTP response information |
OK |
MQTT
AT Command |
Command Description |
Return Value |
AT+CMQTTSTART |
Enable MQTT service |
OK |
AT+CMQTTACCQ=0,"Waveshare-Sim7028",0 |
Apply for MQTT client |
OK |
AT+CMQTTCONNECT=0,"tcp://mqtt.easyiothings.com",20,1 |
Send MQTT request, connect the private MQTT server (MQTTS) |
OK |
AT+CMQTTTOPIC=0,11 |
Input the message topic to be published |
>sim7028test OK |
AT+CMQTTPAYLOAD=0,9 |
Input the published message |
OK >waveshare |
AT+CMQTTPUB=0,0,60 |
Publish the message |
OK +CMQTTPUB: 0,0 |
AT+CMQTTSUB=0,4,1 |
Subscribe to the message topics |
>test OK +CMQTTSUBTOPIC: 0,0 [10:03:39.665]receive ←◆ +CMQTTRXSTART: 0,4,18 +CMQTTRXTOPIC: 0,4 test +CMQTTRXPAYLOAD: 0,18 { "msg": "hello" } +CMQTTRXEND: 0 |
AT+CMQTTSTOP |
Stop MQTT service |
OK |
AT+CMQTTREL |
Release client terminal |
OK |
AT+CMQTTUNSUBTOPIC |
Release the subscribed topics |
OK |
AT+CMQTTUNSUB |
Release Subscription |
OK |
GNSS (only for A7670E)
AT+CGNSSPWR=1,1,1 | Enable GNSS function | +CGNSSPWR: READY! |
AT+CGNSSTST=1 | Enable GNSS data output | OK |
Voice Call
- Connect the configured speaker to the development board:
ATD10086; | Dial phone numbers | OK VOICE CALL: BEGIN |
ATA | Answer | OK VOICE CALL: BEGIN |
ATH | Hang off | OK VOICE CALL: END: 000017 |
SIM7670X Series
HTTP
AT Command |
Command Description |
Return Value |
AT+HTTPINIT |
Enable HTTP service |
OK |
AT+HTTPPARA="URL", https://www.waveshare.cloud/api/sample-test/ |
Connect to the remote server |
OK |
AT+HTTPDATA=5,1000 |
Input the data |
DOWNLOAD <Key enter hello OK |
AT+HTTPACTION=0 |
Enable HTTP request, 0: GET; 1: POST; 2: HEAD; 3: DELETE; 4: PUT |
OK +HTTPACTION: 0,200,54 |
AT+HTTPTERM |
Disable HTTP service |
OK |
AT+HTTPPARA |
Set HTTP parameters |
OK |
AT+HTTPHEAD |
Read HTTP header |
OK |
AT+HTTPREAD |
Read the HTTP response message |
OK |
MQTT
AT Command |
Command Description |
Return Value |
AT+CMQTTSTART |
Enable MQTT Service |
OK |
AT+CMQTTACCQ=0,"Waveshare-Sim7028",0 |
Request MQTT client |
OK |
AT+CMQTTCONNECT=0,"tcp://mqtt.easyiothings.com",20,1 |
Send MQTT request, connect to MQTT server (MQTTS) |
OK |
AT+CMQTTTOPIC=0,11 |
Enter message publishing topic |
>sim7028test OK |
AT+CMQTTPAYLOAD=0,9 |
Enter the content of the published message |
OK >waveshare |
AT+CMQTTPUB=0,0,60 |
Publish the message |
OK +CMQTTPUB: 0,0 |
AT+CMQTTSUB=0,4,1 |
Subscribe to the message topic |
>test OK +CMQTTSUBTOPIC: 0,0 [10:03:39.665]Receive ←◆ +CMQTTRXSTART: 0,4,18 +CMQTTRXTOPIC: 0,4 test +CMQTTRXPAYLOAD: 0,18 { "msg": "hello" } +CMQTTRXEND: 0 |
AT+CMQTTSTOP |
Stop MQTT service |
OK |
AT+CMQTTREL |
Release the client |
OK |
AT+CMQTTUNSUBTOPIC |
Unsubscribe from the topic |
OK |
AT+CMQTTUNSUB |
Release Subscription |
OK |
GNSS (Only for A7670E)
AT+CGNSSPWR=1 | Enable GNSS function | +CGNSSPWR: READY! |
AT+CGNSSTST=1 | Enable GNSS data output | OK |
Portable WiFi Demo Application
- SIM7670G only supports data transmission. There is a temporary bug in the portable WiFi demo.
- This demo application utilizes the TinyUSB protocol stack to communicate with the 4G Cat-1 module. It establishes internet access for the ESP32-S3 directly through PPP dial-up.
- This demo utilized the compiled firmware, and you can download it first.
- Download the firmware.
- Open the Flash Tools, select the development mode, choose the firmware, set the address to 0x0 as shown in the image, insert the SIM card, and proceed to download and start the demo.
- Turn on the 4G switch and turn off the USB on the back of the development board. Re-power the development board and wait for the colorful LED to display red. Open your phone and connect to the WiFi named 'ESP32-S3-A-SIM7670X-4G-HAT' with the password '12345678' to access the internet.
- Please click here to view the full project.
Resource
Document
Demo
Software
Datasheet
Support
Technical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)