Difference between revisions of "GPS (GP-20U7) + Raspberry Pi 2"
Jump to navigation
Jump to search
m (Ethanshry moved page GP-20U7 GPS with Raspberry Pi 2 to GPS (GP-20U7) + Raspberry Pi 2: Fall 2018 Wiki Reworks) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
=Wiring GPS= | =Wiring GPS= | ||
− | #'''Voltage and Ground''' - There will be 3 wires | + | [[File:13740-02.jpg|200px|thumb|left|Timeline]] |
− | #'''Locate serial pin on GPS''' - As with any GPS we need to locate the serial connection for the GPS. There should be one more serial wire connected to the rx or tx pin of the GPS | + | #'''Voltage and Ground''' - There will be 3 wires: a red one for voltage, usually indicated by VCC, and a black one for ground, indicated by GND. Connect the VCC to the 3.3V pin and the GND to the GND pin. |
+ | #'''Locate serial pin on GPS''' - As with any GPS, we need to locate the serial connection for the GPS. There should be one more serial wire connected to the rx or tx pin of the GPS. It should be tx if you wish to receive GPS data on the Raspberry Pi. | ||
#'''Connect to corresponding serial pin on Raspberry Pi''' - Once you know which GPS serial lead you have, connect it to the opposite serial pin on the Raspberry Pi so they may communicate data. (rx to tx, tx to rx) | #'''Connect to corresponding serial pin on Raspberry Pi''' - Once you know which GPS serial lead you have, connect it to the opposite serial pin on the Raspberry Pi so they may communicate data. (rx to tx, tx to rx) | ||
+ | [[File:RP2 Pinout.png|200px|thumb|left|Raspberry Pi 2 Model B pin layout]] | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | <br> | ||
+ | |||
=Connecting GPS to Serial Port= | =Connecting GPS to Serial Port= | ||
− | + | '''Open Serial Port using terminal commands below:''' | |
− | + | <blockquote> | |
− | + | <code>sudo rasps-config</code><br> | |
− | + | Select 8, A8, no, ok, finish<br> | |
− | + | Reboot<br> | |
− | + | <code>dmesg | grep tty</code><br> | |
− | + | </blockquote> | |
− | + | '''Configure for GPS by matching the baud rate, parity, stop bits, and bit size to the <span class="plainlinks"> [https://cdn.sparkfun.com/datasheets/GPS/GP-20U7.pdf data sheet]</span> values provided.''' | |
− | + | <source lang="python"> | |
+ | def set_up_gps(): | ||
+ | ser = serial.Serial( | ||
+ | port = '/dev/ttyAMA0', | ||
+ | baudrate = 9600, | ||
+ | parity = serial.PARITY_NONE, | ||
+ | stopbits = serial.STOPBITS_ONE, | ||
+ | bytesize = serial.EIGHTBITS, | ||
+ | timeout=1 | ||
+ | ) | ||
+ | counter=0 | ||
+ | return ser | ||
+ | </source> | ||
[[Category:HowTos]] | [[Category:HowTos]] | ||
+ | [[Category:Raspberry_Pi]] | ||
+ | [[Category:Electronics]] |
Latest revision as of 02:26, 17 August 2018
Wiring GPS
- Voltage and Ground - There will be 3 wires: a red one for voltage, usually indicated by VCC, and a black one for ground, indicated by GND. Connect the VCC to the 3.3V pin and the GND to the GND pin.
- Locate serial pin on GPS - As with any GPS, we need to locate the serial connection for the GPS. There should be one more serial wire connected to the rx or tx pin of the GPS. It should be tx if you wish to receive GPS data on the Raspberry Pi.
- Connect to corresponding serial pin on Raspberry Pi - Once you know which GPS serial lead you have, connect it to the opposite serial pin on the Raspberry Pi so they may communicate data. (rx to tx, tx to rx)
Connecting GPS to Serial Port
Open Serial Port using terminal commands below:
sudo rasps-config
Select 8, A8, no, ok, finish
Reboot
dmesg | grep tty
Configure for GPS by matching the baud rate, parity, stop bits, and bit size to the data sheet values provided.
def set_up_gps():
ser = serial.Serial(
port = '/dev/ttyAMA0',
baudrate = 9600,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS,
timeout=1
)
counter=0
return ser