[How-to Article] Using 4G in Embedded Linux Systems in AIoT Applications

1. Introduction

AIoT is the combination of AI and IoT, and presents new possibilities regarding the collection, analysis, and reaction to data. Indeed, AIoT could introduce smarter and faster decision-making capabilities and deliver benefits to diverse industries. 4G empowers AIoT to deliver its full potential, and may signal a new era of massive connectivity, revolutionizing how people live, work, and play. Analogously, keeping devices connected to the internet in such applications requires accesses to mobile network coverage. To this end, this article will present the configurations necessary to connect a device running Linux to the internet using a Point-to-Point Protocol (PPP) link.

2. Hardware Specification

In this article, we will be using the Advantech EPC-R7200, a NVIDIA Jetson compatible industrial grade barebones PC, alongside an Advantech AIW-342 4G module with compatible external antennas and coaxial cables*.

image

EPC-R7200 Features:

  • NVIDIA Jetson Module Compatible: Jetson Xavier™ NX, Jetson™ TX2 NX, and Jetson Nano™

  • Fanless ultra-compact Barebones PC (152 Ă— 137 Ă— 42 mm; 5.9 x 5.3 x 1.65 in) with thermal design for -20 ~ 70 °C (- 4 ~ 158 °F) operation

  • 2 x GbE LAN for connectivity, 2 x USB 3.2 Gen 1 ports, and 2 x M.2 slots for wireless modules (1 x 2230 Key E and 1 x 3042 Key B)
    *Rugged industrial design supports wide operating temperatures, power input, and vibration tolerance
    *AIM-Linux software service with peripheral driver integration supports NVIDIA JetPack SDK

The EPC-R7200 is designed with AI developers that use NVIDIA Jetson family modules in
mind. Its features make EPC-R7200 an excellent choice for the prototyping and mass deployment of edge AI applications in diverse industries.

This tutorial leverages an Advantech AIW-342 4G Module in industrial-grade M.2 B-Key form factor with the data plan activated. Users simply need to adapt the interface created at “/dev/” and check the “AT” commands supported and implemented on their modem as each modem has specific AT commands.

*Part numbers for compatible external antenna and coaxial antenna cables

3. Installing the AIW-342 on EPC-R7200

The M.2 B-Key expansion slot can be found on the bottom side of the EPC-R7200. Please remove the screw on the bottom cover and then lift the cover up to access the slot.

image

image

The M.2 B-Key expansion slot on the carrier board is highlighted in red below. Plug the AIW-342 4G module into the socket and tighten the screws to secure the module on the carrier board.

image

image

4. Install external antennas and coaxial cables on EPC-R7200

Install the two antennas with coaxial cables by following the directions below:

A. Remove the plastic plug from the SMA mounting hole on the chassis side panels of the EPC-R7200, and insert the SMA end of the adapter cable.
B. Secure the SMA connector with the included nut and washer.
C. Route the coaxial cable to the bottom side of the EPC-R7200.
D. Install the coaxial cables and their attached antennas to the Main RF antenna (ANT) and RX Diversity Antenna (DIV) receptacles from the left on the 4G LTE module as shown below.

image

â‘  RX Diversity Antenna (DIV)
② Main RF Antenna (ANT)
③ GNSS Antenna (GPS)

image

image

image

5. Operate AIW-342 on the EPC-R7200

5-1. Install wvdial tool

$sudo apt-get update  
$sudo apt-get install -y wvdial

Note: Firmware version (JetPack SDK) - JetPack SDK JetPack 4.5.1

5-2. Edit configuration file (The following example uses a Taiwan Chunghwa Telecom SIM card. Setting details may vary by 4G service provider. Please contact your 4G service provider for detailed connection parameters.)

 $ vi /etc/wvdial.conf 
 
 Init5 = AT+CGDCONT=1,"ip","internet" is for Chunghwa Telecom
 [Dialer Defaults]
 Init1 = ATZ
 Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
 Init5 = AT+CGDCONT=1,"ip","internet"
 Password = any
 Phone = *99#
 Modem Type = Analog Modem
 Stupid Mode = 1
 Baud = 9600
 New PPPD = yes
 Dial Command = ATDT
 Modem = /dev/ttyUSB5
 ISDN = 0
 Username = any

5-3. Update wvdial configuration file

Because the EPC-R7200 modem USB device is random, you need to complete this task before connecting to the internet. The Wvdialconf utility will find a suitable baud rate and modem port for you automatically.

$ wvdialconf

5-4. Connect to the Internet via the wvdial utility.

$ wvdial

image

5-5. Make sure the ppp0 interface is available. Keep the IP address in mind.

image

5-6. Add ppp0 IP to default gateway and ping to Internet

6. Conclusion

This article demonstrates the many network functionalities available to Linux systems. All that is needed to access to ppp0 network is the correct configuration. Please note that the programming method remains the similar regardless of the interface being used. The task of choosing the interface to use is made automatically by Linux depending on the routes. Using Linux in embedded systems is the best solution for those who require network connection in their projects and system flexibility.

4 Likes