HOWTO: Configuring a SIMCOM SIM7600G or SIM7600X hat with cellular data (internet connection)

This is a HowTo, so it may be more appropriately placed somewhere else. Mods please feel free to move. I’m posting to help others.

This document describes the full process of configuring a SIMCOM SIM7600G/SIM7600X Rpi hat to connect to a remote cellular connection and provide IP traffic via a PPP adapter. This is a cheap, easy to use solution for bringing the Libre computers online in remote locations.

Tested on AML-S905X-CC, but should work on other models too.

Hardware:

AML-S805X-CC
Generic SIM7600X 4G Hat
2A USB Micro B power supply
Activated SIM card with data plan, and plan APN

Software:

Raspbian 11 (bullseye)
Kernel: 6.1.26-05272-g26c406245a2c #1 SMP PREEMPT_DYNAMIC Thu Apr 27 10:15:40 UTC 2023 aarch64 GNU/Linux

Setup

  • Install SIM card into SIM7600X module (ensure to fully snap SIM carrier)
  • Attach SIM7600X module to GPIO header
  • From my tests, it is NOT NECESSARY to attach a USB cable to the SIM7600X module, as we will be using the buit-in UART for communications over the GPIO header, as well as providing power over the GPIO header.

Fully update Raspbian

sudo apt update -y
sudo apt upgrade -y
sudo reboot

Install necessary packages and tools
sudo apt -y install minicom ppp

Configure GPIO and UART
sudo raspi-config
Select 3: Interface Options, then I6 Serial Port. Select NO for Login Shell over Serial, then YES to enable serial.
Close and reboot.
Enable the uart-a profile on the GPIO header (you must do this every time you reboot, or add to /etc/local.rc file):
sudo ldto enable uart-a

Test modem
sudo minicom -b 115200 -D /dev/ttyAML6
Type the following commands to get responses from the SIM7600X modem:

at
OK
ati
... should show full details of SIM7600 module
OK
# Sim ready?
AT_CPIN?
+CPIN: READY
# Network available?
AT+COPS?
+COPS: 0,0,"D1"
# Network quality?
AT+CSQ
+CSQ: 4,0

Connect via PPP
Edit PPP config file:
sudo nano /etc/ppp/peers/rnet (You can replace ‘rnet’ with any filename, for example ‘tmobile’ if that is your carrier name)

Paste the following: Replace {APN} with your APN

#Set APN:
connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs -T {APN}"

#Port:
/dev/ttyAML6

# Baudrate
115200

# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault

# Try to get the name server addresses from the ISP.
usepeerdns

# Use this connection as the default route to the internet.
defaultroute

# Makes PPPD "dial again" when the connection is lost.
persist

# Do not ask the remote to authenticate.
noauth

# No hardware flow control on the serial link with GSM Modem
nocrtscts

# No modem control lines with GSM Modem
local

Edit the gprs file:
sudo nano /etc/chatscripts/gprs

It should already contain the following, but confirm:

# You can use this script unmodified to connect to cellular networks.
# The APN is specified in the peers file as the argument of the -T command
# line option of chat(8).

# For details about the AT commands involved please consult the relevant
# standard: 3GPP TS 27.007 - AT command set for User Equipment (UE).
# (http://www.3gpp.org/ftp/Specs/html-info/27007.htm)

ABORT   BUSY
ABORT   VOICE
ABORT   "NO CARRIER"
ABORT   "NO DIALTONE"
ABORT   "NO DIAL TONE"
ABORT   "NO ANSWER"
ABORT   "DELAYED"
ABORT   "ERROR"

# cease if the modem is not attached to the network yet
ABORT   "+CGATT: 0"

""  AT
TIMEOUT 12
OK  ATH
OK  ATE1

# +CPIN provides the SIM card PIN
#OK "AT+CPIN=1234"

# +CFUN may allow to configure the handset to limit operations to
# GPRS/EDGE/UMTS/etc to save power, but the arguments are not standard
# except for 1 which means "full functionality".
#OK AT+CFUN=1

OK  AT+CGDCONT=1,"IP","\T","",0,0
OK  ATD*99#
TIMEOUT 22
CONNECT ""

Connect via PPP:
sudo pon [name of your /etc/ppp/peers/ file that you created above] If you changed the name from rnet, use the new name.

Run ifconfig to see if the PPP0 connection is up:
ifconfig

Test pinging an internet address using the ppp0 connection:
ping -I ppp0 8.8.8.8
(pings Google’s DNS)

You can shut down the connection with sudo poff [name of ppp file] (rnet is the default)

Automatically connect at boot
I will add more info here after testing.

References
Thanks to many documents, but mostly to SIM7600E: Setup via PPP | Andino
Also
GitHub - libre-computer-project/libretech-wiring-tool
Get Started with Super SIM, the Raspberry Pi 4 and the Waveshare 4G Hat | Twilio
RaspberryPi, SIM7600, GPSd - DEV Community
https://www.waveshare.net/w/upload/b/b2/SIM7600_Series_Open_Linux_Development_Guide_V2.00.pdf
TCP/IP testing with Simcom SIM7500 and SIM7600 Modules | M2MSupport.net

2 Likes

Hi,

Thanks for this How To, been struggling to set this up and will try your method and let you know how it goes.

Out of a matter of interest this is not a normal mobile data router so how would you go about port forwarding?

My plan is to stream information from my Le Potatoe via this internet connection to an offsite server.

I have this working via WI-FI and port forwarding, but need to get this operational via 3G/4G. Any advice?

Sorry so late reply, I would recommend to make only outbound connections from the device to your server. Then you can disable all incoming ports on the LePotato using firewalld or other firewall app.

You can merge the overlay via sudo ldto merge uart-a. Then you don’t have to configure it every boot.

1 Like

Thank you. Can we move this answer to the question that it applies to: How to activate UART on ALL-H3-CC - #2 by librecomputer

@Ryan_Griggs do you have a what’s app or something I can reach out to you on? I need some help asap pleaseeee