How to get GPS location on Panel PC

Using SIM7600E Module and TouchBerry Pi 10" Panel PC control
May 19, 2021 by
How to get GPS location on Panel PC
Boot & Work Corp. S.L., Fernandez Queralt Martinez

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

                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:

                1. Communicate with your GPS and GPRS modules using AT commands.
                2. Get location from GPS coordinates.

                So, let's start!

                First of all, ensure that the hardware is right connected like so:

                How to get GPS location on Panel PC








                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:

                Read >>


                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! :)

                Check out the following link to learn how to get GPS coordinates with a Google Maps Widget,  using Node-RED: 

                ​Search in our Blog

                How to get GPS location on Panel PC
                Boot & Work Corp. S.L., Fernandez Queralt Martinez May 19, 2021
                Share this post

                Looking for your ideal Programmable Logic Controller?

                Take a look at this product comparison with other industrial controllers Arduino-based. 

                We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


                Industrial PLC comparison >>>