Template: RPi demo

From Waveshare Wiki
Revision as of 09:53, 28 September 2022 by Eng52 (talk | contribs) (→‎Sample Program)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Raspberry Pi initialization settings

In order 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 program, 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, 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, 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 linux platform:

sudo apt-get install minicom

3. Execute minicom -D /dev/ttyS0 (ttyS0 is the serial port of Raspberry Pi 3B/3B+/4B).
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, 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.

Sample Program

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

wget https://www.waveshare.com/w/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 program. The relevant instructions are as follows (take the PhoneCall program as an example):

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

Use a combination of the above commands:

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

PHONECALL call demo


SMS text message sending and receiving demo


GPS Positioning Demo


TCP network communication demo


FTP download and upload demos