ESP32-S3-A-SIM7670X-4G HAT

From Waveshare Wiki
Jump to: navigation, search
ESP32-S3-A-SIM7670X-4G HAT
300px

ESP32-S3R2
Type C UART
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

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

Development Environment Setup

  • The following development system is Windows by default, it is recommended to use VSCode plug-in for development.

ESP-IDF

  • It is recommended to develop with the VSC plug-in.

Develop with VSCode Plug-in

Install VSCode

1. Open the download page of the official VSCode website, and select the corresponding system and system bit to download.
ESP32-S3-Pico 05.jpg
2. 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.
ESP32-S3-Pico 06.jpg
    • 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.

Install Espressif IDF Plug-in

  • Note: The latest version of the current plug-in is V1.6.0, for a consistent experience, users can choose the same version as us.
1. Open VSCode and use the shortcut key Shift + Ctrl + X to enter the plugin manager.

ESP32-S3-Pico 07.jpg

2. In the search bar, type Espressif IDF, select the corresponding plug-in, and click install.

ESP32-S3-Pico 08.jpg

3. Press F1 to enter:
esp-idf: configure esp-idf extension

ESP32-S3-Pico 09.jpg

4. Choose express (This tutorial is for users who install it for the first time, so only the first general installation tutorial is covered.)

ESP32-S3-Pico 10.jpg

5. Open and display this screen.

ESP32-S3-Pico 11.jpg

6. Choose a server to download.

ESP32-S3-Pico 12.jpg

7. Select the ESP-IDF version you want now, we choose the latest V5.0.1 (note that ESP-IDF started to support ESP32-S3 only after V4.4).

ESP32-S3-Pico 13.jpg

8. The following two are the ESP-IDF directory installation address and the ESP-IDF required tools installation address respectively.

ESP32-S3-Pico 14.jpg

    • Note: If you have installed ESP-IDF before, or if it has failed, please make sure to delete the file completely or create a new path.
9. Once the configuration is finished, click "install" to download.

ESP32-S3-Pico 15.jpg

10. Enter the download page, and it will automatically install the corresponding tools and environment, just wait a moment.

ESP32-S3-Pico 15.jpg

11. After the installation is completed, it will enter the following screen, indicating that the installation is finished.

ESP32-S3-Pico 17.jpg

Official Demo Usage

  • Click here to view more details provided by the official ESP.
Creating a Demo
1. Using the shortcut F1, type:
esp-idf:show examples projects

ESP32-S3-Pico 18.jpg

2. Choose your current IDF version:

ESP32-S3-Pico 19.jpg

3. Take "Hello World" as an example:

ESP32-S3-Pico 20.jpg

4. Choose the corresponding demo.
5. The readme file will explain which chip the demo is suitable for (the following section will introduce how to use the demo and its file structure, which is omitted here).
6. Click to create the demo.
7. Choose the path to place the demo and ensure that there is no folder with the same name as the demo.

ESP32-S3-Pico 21.jpg

Modify COM Port
1. The corresponding COM port is displayed here, click on it to modify.

ESP32-S3-Pico 22.jpg

2. We check the device manager COM port, and select COM5, please select according to your corresponding COM port:

ESP32-S3-Pico 23.jpg

3. Choose the project and demo.

ESP32-S3-Pico 24.jpg

4. Then the COM port is modified.
Modify the Driver
1. Here shows the driver used, click here to modify the corresponding driver:

ESP32-S3-Pico 25.jpg

2. Choose the project or demo:

ESP32-S3-Pico 24.jpg

3. Wait for a few seconds after clicking.

ESP32-S3-Pico 27.jpg

4. Choose the driver we need, that is, the main chip ESP32S3.

ESP32-S3-Pico 28.jpg

5. Choose the openocd path, we can just choose one at random as it doesn't matter.

ESP32-S3-Pico 29.jpg

The Rest of the Status Bar Introduction

ESP32-S3-Pico 30.jpg

  • ① SDK configuration editor: many functions and configurations of ESP-IDF can be modified within it.
  • ② Clean up everything and delete all compiled files.
  • ③ Compile.
  • ④ Current download method, default is UART.
  • ⑤ Program the current firmware, please do it after compiling.
  • ⑥ Open the serial monitor to view serial information.
  • ⑦ Combined button for compiling, programming, and opening the serial monitor (most commonly used during debugging).
Compile, Program, and Serial Port Monitoring
1. Click on the Compile, Program, and Open Serial Monitor buttons we described earlier.

ESP32-S3-Pico 31.jpg

2. It may take a long time to compile, especially for the first time.

ESP32-S3-Pico 32.jpg

  • During this process, ESP-IDF may take up a lot of CPU resources and therefore may cause system lag.
3. Because we use CH343 as a USB to serial port chip, and the on-board automatic download circuit, it can be downloaded automatically without manual operation.

ESP32-S3-Pico 33.jpg

4. After successful download, it will automatically enter the serial monitor, and you can see the corresponding information output from the chip and prompt to reboot after 10s.

ESP32-S3-Pico 34.jpg

Arduino

  • If you do not use arduino-esp32 before, you can refer to this link.

Install Arduino IDE

1. Open the official software download webpage, and choose the corresponding system and system bits to download.

ESP32-S3-Pico 35.jpg

2. You can choose "Just Download", or "Contribute & Download".

ESP32-S3-Pico 36.jpg

3. Run to install the program and install it all by default.

Install arduino-esp32 Online

1. Open Preferences.

ESP32-S3-Pico 37.jpg

2. Add the corresponding board manager URLs and click the button.

ESP32-S3-Pico 38.jpg

3. Add the following content in the first blank.
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

ESP32-S3-Pico 39.jpg

4. Save the setting.
5. Open the board manager and enter ESP32 in the search bar.

ESP32-S3-Pico 40.jpg

6. Wait for downloading.

ESP32-S3-Pico 41.jpg

7. arduino-esp32 is downloaded.

ESP32-S3-Pico 42.jpg

Use Arduino Demo

1. Select the demo, here we choose the demo to get the chip ID.

ESP32-S3-Pico 43.jpg

2. Select the board as ESP32S3 Dev Module.

ESP32-S3-Pico 44.jpg

3. Choose the COM5 port of ESP32-S3 USB.

ESP32-S3-Pico 45.jpg

4. Click the download button, then it compiles and downloads automatically.

ESP32-S3-Pico 47.jpg

5. Finish.

ESP32-S3-Pico 48.jpg

6. Open the Serial Port Monitor.

ESP32-S3-Pico 49.jpg

7. See the chip ID of the loop output.

ESP32-S3-Pico 50.jpg

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:

ESP32-S3-A-SIM7670X-4G02.png

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:

ESP32-S3-A-SIM7670X-4G03.png

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. ESP32-S3-A-SIM7670X-4G-5.gif

BAT

This development board utilizes the MAX17048 as the battery charge measurement IC.

  • First, confirm the I2C pin:

ESP32-S3-A-SIM7670X-4G-08.png

  • Program the code and change the threshold:

ESP32-S3-A-SIM7670X-4G-09.png

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

ESP32-S3-A-SIM7670X-4G HAT-HTTP.png

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

ESP32-S3-A-SIM7670X-4G HAT-MQTT.png

GNSS (only for A7670E)

AT+CGNSSPWR=1,1,1 Enable GNSS function +CGNSSPWR: READY!
AT+CGNSSTST=1 Enable GNSS data output OK

ESP32-S3-A-SIM7670X-4G HAT-GNSS.png

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.

ESP32-S3-A-SIM7670X-4G HAT wIfI.png

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

ESP32-S3-A-SIM7670X-4G HAT wIfI-3.jpgESP32-S3-A-SIM7670X-4G HAT wIfI04.jpg

  • 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)