Template: RPi demo

From Waveshare Wiki
Jump to: navigation, search

Hardware Connection

pin connection diagram with Raspberry Pi

SIM7600X 4G HAT has onboard Raspberry Pi GPIO interface, which can be directly inserted into various versions of Raspberry Pi; the following table shows the connection between Raspberry Pi pins and module pins (Raspberry Pi 3rd Generation B+):

SIM7600X 4G HAT Raspberry Pi
5V 5V
RXD TXD (corresponding to 14 of BCM)
TXD RXD (corresponding to 15 of BCM)
PWR P22 (corresponding to P6 of BCM)
FLIGHTMODE P7 (corresponding to P4 of BCM), enter flight mode when pulled high

* FLIGHTMODE is wired to pull up and will enter into flight mode.

Raspberry Pi initialization settings

To ensure that the SIM7600X 4G HAT can work normally after being connected to the Raspberry Pi, it is necessary to initialize the level output of some pins of the Raspberry Pi. The specific operations are as follows:

  • Download sample demo, after decompression, rename the c folder under the Raspberry folder to SIM7600X, Then copy the entire SIM7600X folder to the Raspberry Pi /home/pi directory.
  • The command line enters the /home/pi/SIM7600X directory and executes the command.
chmod 777 sim7600_4G_hat_init
  • Set the boot initialization script, and run the command:
sudo nano /etc/rc.local
  • Add before exit 0 (as shown below):
sh /home/pi/SIM7600X/sim7600_4G_hat_init


Raspberry Pi serial port configuration

Since the Raspberry Pi serial port is used for terminal debugging by default, if you need to use the serial port, you need to modify the Raspberry Pi settings. Execute the following command to enter the Raspberry Pi configuration:

sudo raspi-config

Select Interfacing Options ->Serial ->no -> yes to disable serial debugging.
Open the /boot/config.txt file, and find the following configuration statement to enable the serial port, if not, add it at the end of the file:


Restart to take effect.

Raspberry Pi minicom serial port debugging

1. Insert the module into the Raspberry Pi.
2. Install minicom, minicom is a serial debugging tool for the Linux platform:

sudo apt-get install minicom

3. Execute minicom -D /dev/ttyS0 (ttyS0 is the serial port of Raspberry Pi 3B/3B+/4B).
The default baud rate is 115200.
Raspberry Pi 2B/zero, the user serial device number is ttyAMA0, and the Raspberry Pi 3B/3B+/4B serial device number is ttyS0.
4. Take the AT synchronization test as an example, and send relevant commands, as shown in the following figure:
* minicom can enter setting mode by pressing Ctrl+A, then Z, and select X to exit.
5. Raspberry Pi 5 configures the ttyS0 serial port:

  • Edit config.txt file:
 sudo nano /boot/config.txt
  • Add the following and the statement at the end.
  • You can see ttyS0 after restarting.

Sample Demo

1. Insert the module into the Raspberry Pi.
2. Download the sample demo to the /home/pi/ path:

wget https://files.waveshare.com/upload/2/29/SIM7600X-4G-HAT-Demo.7z
sudo apt-get install p7zip-full
7z x SIM7600X-4G-HAT-Demo.7z -r -o/home/pi
sudo chmod 777 -R /home/pi/SIM7600X-4G-HAT-Demo

3. Go to the bcm2835 directory, compile, and install it.

chmod +x configure && ./configure && sudo make && sudo make install

Note: If there is a problem with the compilation, please refer to the instructions in the FAQ.
4. Go to the corresponding instance directory, compile, and run the demo. The relevant instructions are as follows (take the PhoneCall demo as an example):

sudo make clean //Clear the original executable file
sudo make //recompile
sudo ./PhoneCall //Run the demo

Use a combination of the above commands:

sudo make clean && sudo make && sudo ./PhoneCall



SMS Text Message Sending and Receiving Demo


GPS Positioning Demo


TCP Network Communication Demo


FTP Download and Upload Demos