INTRODUCTION
The SIM800L module is the integrated module for the use of GPRS/GSM in Industrial Shields PLC.
The SIM7600E is multi-band LTE-TDD/LTE-FDD/HSPA + and GSM/GPRS/EDGE module solution for downlink data transfer. It has a strong extension capability with rich interfaces including UART, USB2.0, I2C, GPIO, etc. The module provides much flexibility and ease of integration for customer's application.
So, let's see how to test our Touchberry Pi 10 with GPS and GPRS modules for industrial monitoring!
Requirements
- TouchBerry PI 10'1" hmi industrial
- SIM800L module
- SIM7600E 4G Hat module
- GPS Antenna
- 12V to 24V Power Supply
Explanation
In this post, you will learn how to get GPS location on your Raspberry Pi based Industrial Panel PC monitoring. By doing this, you will learn how to:
- Communicate with your GPS and GPRS modules using AT commands.
- Get location from GPS coordinates.
So, let's start!
First of all, ensure that the hardware is right connected like so:
1. Once the hardware is ready, let's check that we communicate to the GPS/GPRS modules through the Serial Port.
So, open up a terminal window in your TouchBerry Pi 10, and go to raspi-config:
sudo raspi-config
Then, go to the Interface Options > Serial port and disable the login shell and enable the serial interface.
2. Now, let's check that your device can recognize the USB ports.
By running the following command:
ls /dev/ttyUSB*
you should see the following:
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3 /dev/ttyUSB4
3. Install the screen tool to be able to read the data through the Serial Port:
sudo apt-get update sudo apt-get install screen
4. Now, open the /dev/ttyUSB2 at 115200 as baudrate, and let's start using the AT commands to communicate with our modules:
screen /dev/ttyUSB2 115200
5. Run the following commands:
AT <--- Send to get module connection
OK <--- Receive
AT+CGPS=1,1 <--- Send to enable GPS
OK <---- Receive
AT+CGPSINFO: (Your GPS coordinates should appear here)
Click on the link below to know more about AT commands:
6. Open the /dev/ttyUSB1 port to get the GPS data:
screen /dev/ttyUSB1 115200
GPS Daemon
Another way of getting GPS data is by installing GPS Daemon.
1. So, let's install a GPS Daemon so that it understands the serial data that our GPS module is providing via Serial Port.
sudo apt-get update sudo apt-get install gpsd gpsd-clients
2. Now, run gps data service in background:
sudo gpsd /dev/ttyUSB1 -F /var/run/gpsd.sock
3. Finally, run the command below to get GPS data through a monitor that watches packets and displays them along with diagnostic information.
gpsmon
If you get any error, try the following:
1. Kill the gpsd processes:
sudo killall gpsd
2. Restart the gpsd socket and service
sudo systemctl restart gpsd.socket gpsd.service
3. Run gpsd data service in background.
sudo gpsd /dev/ttyUSB1 -F /var/run/gpsd.sock
So, if you did it right, you should see all GPS data coming to the Serial Port of your Industrial Panel PC for industrial automation! :)
How to get GPS location on Panel PC