This is the API V2 documentation. To switch out of beta revert back to our API V1.

Open SidemenuDocs
Close Sidemenu

SIM7600-A Raspberry Pi 4G Hat Setupsim7600-a-raspberry-pi-4g-hat-setup

The SIM7600A 4G HAT is a 4G communication and GNSS positioning module, which supports LTE CAT4 up to 150Mbps for downlink data transfer. It is pretty low power consumption and can be attached to a Raspberry Pi to empower connectivity for IoT applications.

You can also connect this 4G module with a computer to surf the Internet. It has functionality for sending SMS, global positioning, and high speed internet connections via 4G.

Prerequisites to complete the SIM7600 4G HAT setupprerequisites-to-complete-the-sim7600-4g-hat-setup

  1. 1A Telnyx Portal account and active Telnyx SIM card with data plan. Check out this Quickstart Guide to get set up.
  2. 2Raspberry Pi 3 Model B or Raspberry Pi 4 (this guide will use 4 but the steps are the same).
  3. 3Internet connection for initial setup and configuration.

Alright, let's get started!

Preparation steps for the SIM7600 Raspberry Pi 4G HAT setuppreparation-steps-for-the-sim7600-raspberry-pi-4g-hat-setup

First, we are going to start by updating the Raspberry Pi so let's run these commands:

  • sudo apt update -y
  • sudo apt dist-upgrade -y
  • sudo rpi-update
    • You may see a prompt like this. Press Y and press enter:
      Preparation steps for the SIM7600 Raspberry Pi 4G HAT setup

Once all of the steps are complete, reboot your Pi using sudo reboot command.

With the updates out of the way, let's start on installing prerequisite software and libraries: libqmi-utils and udhcpc are first up. Install them by running this command: sudo apt install libqmi-utils && udhcpc

libqmi-utils installs libraries that allow you to interact with Qualcomm-based modems. SIM7600 comes with a Qualcomm MDM9607 chipset. udhcpc is used for modem DHCP leasing. The cellular network gives a unique IP to the HAT and the Pi will have its own IP. This is used to solve IP addressing conflicts between the Pi and the HAT.

Now we will enable UART to communicate with the device. To do that, run this command and then follow the prompts as shown:

  • sudo raspi-config
  • Choose Interfacing Options (5):
    SIM7600 Raspberry Pi 4G HAT setup - updating your raspberry pi
  • Choose P6 Serial:
    SIM7600 Raspberry Pi 4G HAT setup
  • Press No to the prompt below then Reboot.

Configuration of the SIM7600 moduleconfiguration-of-the-sim7600-module

Next, we're going to configure the SIM7600A module. To turn on the module we will be using the qmicli commands which are used to control Qualcomm devices. This command will activate the device: sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online'

Now let's verify that the module is online. These are sample commands you can send to the device:

  • qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
    • Response: Online or Offline
  • qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength
    • Response: Signal strength and signal quality values
  • qmicli -d /dev/cdc-wdm0 --nas-get-home-network
    • Response: Carrier name or carrier PLMN

You should now see a WWAN0 interface in net-stats (ifconfig). Unless specified by user, WWAN0 is the default interface this device uses.

We're now going to configure the module to use raw-ip protocol with the following commands:

  • sudo ip link set wwan0 down
  • echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip
  • sudo ip link set wwan0 up

And connecting to a mobile network:

sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qosheader' --wds-start-network="apn='YOUR_APN',username='YOUR_USERNAME',password='YOUR_PASSWORD',ip-type=4" --client-no-release-cid

Please replace the username and password field with the username/password that you use for your Pi.

Finally, let's set the default route and IP using udhcpc: sudo udhcpc -i wwan0 And tell the udhcpc library to receive a DHCP lease from the network using WWAN0: ip a s wwan0

You are connected to the Internet! Open up your web browser and browse away!

Was this page helpful?was-this-page-helpful