GP-20U7

From Sketching with Hardware at LMU Wiki
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]

 1 # Source: https://forum.sparkfun.com/viewtopic.php?t=45669
 2 
 3 import serial
 4 
 5 # Initialize serial
 6 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
 7 
 8 while True :
 9     data=ser.readline().decode("utf-8")
10     print(data)

Make the output more human readable[edit]

 1 # Source: https://forum.sparkfun.com/viewtopic.php?t=45669
 2 
 3 import serial
 4 
 5 # Initialize serial
 6 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
 7 
 8 while True :
 9     w = ser.readline().decode("utf-8")
10     data = w.split(',')
11     if data[0] == '$GPGGA':
12         msgID,UTC,Latitude,NSindicator,Longitude,EWindicator,PosFixInd,NbSatellites,HDOP,Altitude,Units,Gsep,Units,w,checksum = data
13         hh = UTC[0:2]
14         mm = UTC[2:4]
15         ss = UTC[4:6]
16         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))