Difference between revisions of "Template:RPi demo"

From Waveshare Wiki
Jump to: navigation, search
 
Line 61: Line 61:
 
2. Download the sample program to the /home/pi/ path;
 
2. Download the sample program to the /home/pi/ path;
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
wget https://www.waveshare.net/w/upload/2/29/SIM7600X-4G-HAT-Demo.7z
+
wget https://www.waveshare.com/w/upload/2/29/SIM7600X-4G-HAT-Demo.7z
 
sudo apt-get install p7zip-full
 
sudo apt-get install p7zip-full
 
7z x SIM7600X-4G-HAT-Demo.7z -r -o/home/pi
 
7z x SIM7600X-4G-HAT-Demo.7z -r -o/home/pi

Latest revision as of 09:53, 28 September 2022

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
GND GND
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

Sim7600CE-28.png

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
Interface18.png
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:

enable_uart=1

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:
Sim7600CE-20.png
* 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

Pnonecall.png

SMS text message sending and receiving demo

SMS.png

GPS Positioning Demo

GPSPOSTION3.png

TCP network communication demo

Tcp-network-3.png

FTP download and upload demos

FTP-DOWNLOAD3.png