GP-20U7

From Sketching with Hardware at LMU Wiki
(Redirected from Team5 gps)
Jump to navigation Jump to search

The GP-20U7 GPS receiver is a compact solution for getting global position data. It is capable of delivering position, velocity, and time data. The low power consumption and its small size make the GP-20U7 the ideal choice for small, portable projects like smartwatches.

Technical Specifications[edit]

  • 56-Channel Receiver (22 Channel All-in-View)
  • Sensitivity : -162dBm
  • 2.5m Positional Accuracy
  • Cold Start : 29s (Open Sky)
  • 40mA @ 3.3V
  • 3-pin JST Terminated Cable

Pins[edit]

Pin # Name Description
1 RX UART Serial Data Input
2 TX UART Serial Data Output
3 GND Ground
4 VCC Power Supply (3.3V)

Connecting the GP-20U7[edit]

  • Connect VCC to the power supply (3.3V)
  • Connect GND to the ground
  • Connect TX to a RX pin
  • Connect RX to a TX pin (not necessary for read position data only)

In our example, we use a Raspberry Pi 3 with VCC connected to 3V3(OUT) (Pin 1), GND connected to GND (Pin 9) and TX connected to GPIO15 (Pin 10) which is an UART-Pin.

Code Examples[edit]

Get data from the GP-20U7[edit]

# Source: https://forum.sparkfun.com/viewtopic.php?t=45669

import serial

# Initialize serial
ser = serial.Serial(port='/dev/ttyS0', baudrate=9600, timeout=None,parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,rtscts=False,xonxoff=False,dsrdtr=False) # 9600bps, 8 bit data, 1 stop bit, no parity

while True :
    data=ser.readline().decode("utf-8")
    print(data)

Make the output more human readable[edit]

# Source: https://forum.sparkfun.com/viewtopic.php?t=45669

import serial

# Initialize serial
ser = serial.Serial(port='/dev/ttyS0', baudrate=9600, timeout=None,parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,rtscts=False,xonxoff=False,dsrdtr=False) # 9600bps, 8 bit data, 1 stop bit, no parity

while True :
    w = ser.readline().decode("utf-8")
    data = w.split(',')
    if data[0] == '$GPGGA':
        msgID,UTC,Latitude,NSindicator,Longitude,EWindicator,PosFixInd,NbSatellites,HDOP,Altitude,Units,Gsep,Units,w,checksum = data
        hh = UTC[0:2]
        mm = UTC[2:4]
        ss = UTC[4:6]
        print('UTC time = %s:%s:%s, Latitude = %s%s, Longitude = %s%s, altitude = %s%s, %s satellites' % (hh,mm,ss,Latitude,NSindicator,Longitude,EWindicator,Altitude,Units,NbSatellites))