In this tutorial we will learn how to get GPS data using 3G, 4G/LTE shield.

GPS(Global Positioning System) also known as NavStar indicates the position of an individual on the earth. The Satellites orbiting around the earth sends precise details of their positions at a regular interval of time. Once information are received by a GPS receiver, a GPS receiver can pinpoint the location.

There are also navigation systems which support in their in specific regions like GLONASS provided in Russia.

For this tutorial we will need
a. Raspberry Pi
b. 3G, 4G/LTE Shield
c. 3G, 4G/LTE module (for 3G UC20 and for 4G EC25 is used)
d. PCB Mobile Antenna (2x)
e. GPS Antenna
Here it goes


1. Connect EC25 module to the shield.


Sixfab 3G,4G/LTE shield and EC25 module


EC25 module connected to shield

2. Insert SIM in the sim slot


Inserting Sim

3. Connect the shield to a Raspberry Pi


Shield attached to Raspberry Pi 3

4. Now connect antenna to the ports as shown in the figure below


Connecting Antenna

5. Now connect a microUSB to the shield from Raspberry Pi.


Tracker setup

So the setup is ready for tracking.

Now we can power our Raspberry Pi and control trough terminal as done in previous tutorials.

GPS data can be obtained either using minicom or writing your own python code.


6a. Type

to bring up the minicom settings screen

7Opening minicom

6b. Select Serial port setup


minicom configuration screen

6c. Make the following changes

Serial Device : /dev/ttyUSB2

Hardware Flow Control : No


Configuring Serial Port Setup

6d. Now Exit from the setting screen


Exiting from minicom configuration screen

6e. Check connectivity with ‘AT’ which in response gives ‘OK’ or returns an error.

minicom screen


minicom screen

6f. Now type ‘AT+QGPS=1’ turns on the GNSS(Global Navigation Satellite Systems) engine.


minicom screen

6g. Again go to minicom settings > Serial Port Setup and make the following changes.

Serial device : /dev/ttyUSB1  

Hardware Flow Control : No


Configuring Serial Port Setup

6h. Exit from the settings screen which will bring up following screen with GPS NMEA data.


GPS Data



Now we will write a python code to obtain the GPS values

7a. First create a python file by the following command.


Opening .py file


7b. Now type the following python code in the file and save it.


7c. After saving it we will run the code with following command.


Running .py file


GPS data received

Similarly depending on the code required values from the data can be extracted.


11 thoughts on “GPS Tracker with 3G, 4G/LTE shield”

  1. I’m getting the broken pipe error when running the serial.Serial function from the script, any idea on this one? It works fine from the minicom though.

  2. I am using same code as mention, but getting following error.
    Can you please guide.

    [email protected]:~ $ sudo python
    Connecting port
    Receiving GPS data
    raw: $GPVTG,,T,,M,,N,,K,N*2C

    —–Parsing GPRMC—–
    Traceback (most recent call last):
    File “”, line 48, in
    File “”, line 14, in parseGPS
    time = sdata[1][0:2] + “:” + sdata[1][2:4] + “:” + sdata[1][4:6]
    UnboundLocalError: local variable ‘sdata’ referenced before assignment
    [email protected]:~ $

    1. The issue is related to the indentation of the code:
      – lines 12 and 13 should be more indented in order to be considered part of the “if” statement at line 11
      – lines 14 to 29 should be indented at the same level as line 10 and 11. Doing that will make lines 14 to 29 part of the same block as sdata (line 10) and thus will resolve the issue.

      I also had to change “degreeChecksum” at line 25 from index 11 to 12

  3. When my pi loses power it seems the minicom setting are resetting. how to make theses setting persistent?

  4. I’m trying to enable gpsoneXTRA on the EC25-E and I’m having a hard time with it. When I say enable XTRA I’m actually referring to the process of uploading the xtra2.bin file into the EC25’s RAM module.

    The process that’s failing on me is composed of the following steps:
    1. Running AT+QFUPL=”RAM:xtra2.bin”,<>,<> – by the way, the serial port has the HW control enabled.
    2. Get the CONNECT message.
    3. Sending the file and when it finishes sending it, I don’t get any OK from the module. This is where it fails. Even the keyboard is “jammed” for a couple of seconds before I regain the control over it.

    Do you have any experience regarding this? There’s absolutely nothing on the web to help me out with this, so I’m asking you since you already wrote a tutorial on the EC25-E for the GPS.


Leave a Reply

Your email address will not be published. Required fields are marked *