Skip to main content

Mobile Internet for Your Pi - ECM Setup

Introduction

ECM (Ethernet Control Model) is a USB networking protocol that allows devices like the Quectel EG25-G 4G module to function as a network interface on a Raspberry Pi. By enabling ECM mode, the module provides cellular internet connectivity, making it ideal for IoT applications such as portable internet routers, IoT gateways, and remote monitoring systems. The Raspberry Pi communicates with the module via AT commands to manage features like ECM mode, GNSS, and SMS, ensuring reliable internet access in areas without wired or Wi-Fi networks.

Hardware Preparation

Raspberry Pi 5Raspberry Pi 4G LTE CAT4 HAT

The Hardware Setup

Setting up a Raspberry Pi for networking via ECM mode (Ethernet Control Model) using AT commands involves using Quectel Module.

note

If the necessary drivers for communicating with AT commands are not installed, you will need to install them.

Network Configuration

Step 1 : Open Minicom on Raspberry Pi

sudo minicom -D /dev/ttyUSB2
AT

Step 2 : Enable ECM Mode

AT+QCFG="usbnet",1

Step 3: Verify the mode

AT+QCFG="usbnet"?

It should return usbnet,1, indicating ECM mode is active.

Step 4: Check Network Interfaces

ifconfig

You should see a new interface, usb0 or eth1, which is the ECM mode network interface. In this case it is usb0.

Step 5: To configure the network interface for internet access, use DHCP:

sudo dhclient usb0
sudo ip link set usb0 up

Step 6: Ensure that your routing is set up correctly for internet access:

sudo ip route add default via 192.168.225.1 dev usb0

Change the gateway according to your usb0 IP.

Step 7: Add DNS entries for name resolution.

Edit the /etc/resolv.conf file to use Google's DNS:

sudo nano /etc/resolv.conf

Step 8: Add these 2 lines and save

nameserver 8.8.8.8
nameserver 8.8.4.4

Step 9: Make DNS settings persistent

sudo nano /etc/NetworkManager/NetworkManager.conf

Step 10: Add on [main] and save

dns=none

Step 11: Restart NetworkManager

sudo systemctl restart NetworkManager

Step 12: Test the Connection

ping -I usb0 8.8.8.8
nslookup google.com

Once successfully connected to the mobile network using the 4G LTE HAT, the possibilities are truly limitless. You can establish MQTT connections for IoT messaging, communicate seamlessly with cloud services for data processing, or set up an FTP server for remote file transfers. This setup transforms your Raspberry Pi into a powerful, portable gateway for diverse applications in IoT, automation, and beyond.

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...