4G

This article guides readers on configuring 4G modules on the Edge101 mainboard, explaining the PCIe pinout and providing example code for network time synchronization using an ESP32 controller.

8.8 4G

The Edge101 mainboard comes with a built-in standard 4G CAT1 communication module by default. You only need to install the 4G antenna included in the accessories to enable the 4G communication function.

PCIe pin assignment of the wireless module is as follows:

1 WAKEUP_OUT 2 VCC_3.3
3 U_BOOT 4 GND
5 NC 6 NC
7 NC 8 USIM_VCC
9 GND 10 USIM_DATA
11 VDD_EXT 12 USIM_CLK
13 NC 14 USIM_RST
15 GND 16 NC
17 NC 18 GND
19 WAKEUP_IN 20 NC
21 GND 22 RESET_IN
23 UART_RXD 24 VCC_3.3
25 UART_RTS 26 GND
27 GND 28 UART_CTS
29 GND 30 NC
31 UART_TXD 32 WAKEUP_OUT
33 RESET_IN 34 GND
35 GND 36 USB_DN
37 GND 38 USB_DP
39 VCC_3.3 40 GND
41 VCC_3.3 42 LED_WWAN
43 GND 44 NC
45 NC 46 NC
47 NC 48 NC
49 NC 50 GND
51 NC 52 VCC_3.3

Refer to the above PCIe pin assignment when equipping other wireless modules.

Sample codes for 4G functions are provided for your reference. The relevant library is built into the SDK of this product, which can be found in the example folder.

The following tutorial demonstrates acquiring network time via 4G network connection.

Note: Insert the SIM card before using the 4G function.

Example: Obtain Network Time

Hardware Preparation

Sample Code

#include "DFRobot_EG800AK.h"
#define NTP_SERVER "ntp.aliyun.com"
DFRobot_EG800AK EG800AK;

// Convert UTC time to Beijing Time (UTC+8) and format output as 2026/07/11 16:53:50
String formatBJTime(String raw)
{
  // Sample raw data: 26/07/11,08:53:50+32
  int year  = raw.substring(0,2).toInt();
  int month = raw.substring(3,5).toInt();
  int day   = raw.substring(6,8).toInt();
  int h     = raw.substring(9,11).toInt();
  int m     = raw.substring(12,14).toInt();
  int s     = raw.substring(15,17).toInt();

  // UTC + 8 hours = Beijing Time
  h += 8;
  // Handle date carry when crossing midnight
  if(h >= 24){
    h -= 24;
    day += 1;
  }

  char buf[32];
  sprintf(buf,"20%02d/%02d/%02d %02d:%02d:%02d",year,month,day,h,m,s);
  return String(buf);
}

void setup() {
  Serial.begin(115200);
  while (!Serial);
  EG800AK.begin(Serial1, eBaud115200);
  EG800AK.setBaudRate(eBaud115200);

  if (!EG800AK.checkSIMStatus()) {
    Serial.println("SIM card abnormal");
    while(1);
  }
  Serial.println("SIM card normal");

  EG800AK.activePDPContext();
  EG800AK.setNtpRetransParam(5,10);
  EG800AK.openNtpSynchronization(NTP_SERVER);
  delay(3000); // Extend waiting time to complete the initial NTP synchronization
  Serial.println("Start reading Beijing Time");
}

void loop() {
  char *timeStr = EG800AK.getCLK();
  if(timeStr != NULL){
    Serial.println(formatBJTime(String(timeStr)));
  }
  delay(2000);
}

Result

The real-time Beijing time is successfully obtained via the 4G network.

Was this article helpful?

TOP