smilanko
Posts: 12
Joined: Tue Mar 22, 2016 5:59 pm

Raspberry Pi3 and GPS

Mon Apr 18, 2016 6:32 pm

I have a raspberry pi 3 and the adafruit ultimate gps breakout board. I am connecting the two together, and everything is working fine. This is the link for the guide: https://learn.adafruit.com/adafruit-ult ... rything-up

I am using some python code, as shown in this thread here https://learn.adafruit.com/adafruit-ult ... g-your-gps to print out the latitude and longitude as soon as possible. Currently, my GPS fetches new data every second or so, but their documentation states that we can get up to 10Hz refresh rate, or 10 times a second.

Is it possible for me to set the update rate by issuing a GPSD command? Or is it possible for me to set this in the python code from the above script?

I cant seem to find a solution exactly tailored to my issue.

paulie
Posts: 275
Joined: Thu Jan 19, 2012 6:51 pm

Re: Raspberry Pi3 and GPS

Mon Apr 18, 2016 7:46 pm

I have found info on the chipset used (mtk3339), and a webpage with a link to the data sheet:
http://bodgitandscarper.co.uk/arduino/ ... mate-gps/

Use the another datasheet link :-)

And sorry, I don't yet know how to send the commands to the GPS to change anything :-(
But you should be able to work it out from there :-)
It has been my custom to use Xeyes

paulie
Posts: 275
Joined: Thu Jan 19, 2012 6:51 pm

Re: Raspberry Pi3 and GPS

Mon Apr 18, 2016 7:49 pm

I have found info on the chipset used (mtk3339), and a webpage with a link to the data sheet:
http://bodgitandscarper.co.uk/arduino/ ... mate-gps/

Use the another datasheet link :-)

And sorry, I don't yet know how to send the commands to the GPS to change anything :-(
But you should be able to work it out from there :-)

Remember that the Pi3 uses the GPIO UART differently to earlier models.
It has been my custom to use Xeyes

rcomito
Posts: 1
Joined: Tue Mar 01, 2016 1:27 pm

Re: Raspberry Pi3 and GPS

Mon Apr 18, 2016 8:17 pm

Hi smilanko - I used that GPS module to build a clock a while ago. The commands to
change the GPS polling rate are:

"$PMTK300,1000,0,0,0,0*1C" // Sets rate to 1HZ
"$PMTK300,200,0,0,0,0*2F" // Sets rate to 5HZ
"$PMTK300,100,0,0,0,0*2" // Sets rate to 10HZ

Hope that helps.

Rick Comito

bigbuilder
Posts: 6
Joined: Wed Nov 26, 2014 3:20 am

Re: Raspberry Pi3 and GPS

Thu Apr 21, 2016 12:39 pm

The chip/board is putting out 10 fixes per second (10Hz). That's fixed. You can choose to ignore fixes, and effectively resample at slower rates. You cannot speed it up.

Efficient code that uses gpsd should see 10 Hz output. gpsd can do the resampling for you, as previously posted, above.

smilanko
Posts: 12
Joined: Tue Mar 22, 2016 5:59 pm

Re: Raspberry Pi3 and GPS

Fri Apr 22, 2016 12:37 pm

rcomito wrote: "$PMTK300,1000,0,0,0,0*1C" // Sets rate to 1HZ
"$PMTK300,200,0,0,0,0*2F" // Sets rate to 5HZ
"$PMTK300,100,0,0,0,0*2" // Sets rate to 10HZ
Rick Comito
This solved the issue for me.

First, I had to follow a few posts to configure gps module to work through ttyS0. This post, the answer by mastermushi, shows how to get this complete. viewtopic.php?t=51788&p=399137
Note, I did not start the gpsd, as my python code conencts to the serial port, defines the baud rate, refresh rate, and the measurement speed.

Second, I created a python script to do something like this:

Code: Select all

from time import sleep
import serial
ser=serial.Serial('/dev/ttySO',9600)

class GPS:  
        def __init__(self):
            UPDATE_100_msec=  "$PMTK220,100*2F\r\n"
            MEAS_200_msec= "$PMTK300,200,0,0,0,0*2F\r\n"
            BAUD_115200 = "$PMTK251,115200*2C\r\n"

            ser.write(BAUD_115200)   #Set Baud Rate to 115200
            sleep(1) 
            ser.baudrate=115200
            ser.write(UPDATE_100_msec)
            sleep(1)
            ser.write(MEAS_200_msec) 
            sleep(1)

myGPS=GPS()
while(1):
        ser.flushInput()
        ser.flushInput()
        while ser.inWaiting()==0:
                pass
        data=ser.readline() 
The complete tutorial on how this can be used is here, in case the code above doesn't work for you. http://www.toptechboy.com/tutorial/beag ... ps-module/

chaderick9
Posts: 1
Joined: Fri Aug 28, 2015 2:27 pm

Re: Raspberry Pi3 and GPS

Sun Apr 24, 2016 5:58 pm

I am not having success with the Raspberry Pi 3 getting the following product to work: https://www.adafruit.com/product/746
Following this tutorial: https://learn.adafruit.com/downloads/pd ... rry-pi.pdf
Using UART instead of USB, installed latest version of Jessie. Any suggestions?
I can get it to work fine on my RaspberryPi 1 running Wheezy over UART, no problem.

*Edit Should I buy this instead of trying over UART: https://www.adafruit.com/products/954

https://redd.it/4g8ngy

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2941
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Raspberry Pi3 and GPS

Mon Apr 25, 2016 8:54 am

If you had just read the previous post you would have seen the link to this reply carefully listing the steps required: viewtopic.php?p=947968#p947968

NatePiVision
Posts: 72
Joined: Fri Apr 29, 2016 5:38 am
Location: Pittsburgh
Contact: Website

Re: Raspberry Pi3 and GPS

Wed Nov 09, 2016 12:07 pm

Hey Guys,

I'm trying to change the polling rate as discussed above but I'm doing it from within an application written in C++, not python. The function I'm using is send(), which is a member of the gpsmm class. The code looks something like this:

gpsmm gps_rec("localhost", DEFAULT_GPSD_PORT);

//Set poll rate 5hz
gps_rec.send("$PMTK300,200,0,0,0,0*2F");

I've tried several variations of above, with and without a trailing \r\n, and it seems to still only respond at 1 hz. Additionally, I've tried the commands for changing the measuring time as well. Is it possible to use this function? If so, do I need to send two commands, one to change the poll rate and the other the measure rate? And for either, do I need the trailing \r\n ?

Thanks,
-Nate
Current Pi based projects:
https://github.com/nategreco/DAPrototype - Advanced Driver Assist System (ADAS)
https://github.com/nategreco/StereoVisionTest - Stereo vision (CM3) test setup

Videos:
https://youtu.be/WRAR0lgYsj8
https://youtu.be/SyvCJLRw1UQ

Return to “General discussion”