element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog Setting up the Raspberry Pi for High Speed GPS (5Hz, 10Hz etc)
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: bobalexander
  • Date Created: 14 Aug 2015 1:41 PM Date Created
  • Views 3879 views
  • Likes 4 likes
  • Comments 4 comments
  • raspberry_pi_gps_kit
  • raspberrypi
  • gps
  • raspberry_pi_geocaching
  • raspberry_pi_projects
Related
Recommended

Setting up the Raspberry Pi for High Speed GPS (5Hz, 10Hz etc)

bobalexander
bobalexander
14 Aug 2015

If you want to use your GPS for more real time applications or for doing some software accuracy improvement you will most likely need a higher output speed.

To get a higher output speed from the L80 GPS module you need to increase the rate/frequency. The default is 1Hz or 1 PPS (pulse per second - for timing applications).

This gives you 1 NMEA coordinate sentence per second (GPGLL - Lat/Lon).


All of these echo commands are performed from the Linux shell/bash prompt.


First, Set Baud Rate

To be able to go above 1Hz you will need to switch to a higher baud rate:

echo -e "\$PMTK251,57600*2C\r\n" > /dev/ttyAMA0

Supported speeds are:

4800,9600,14400,19200,38400,57600,115200


Don't forget to update your tools connection speed to 57600!

    For example /usr/lib/python3/dist-packages/microstacknode/gps/l80gps.py (line 47)

 

To go back to 9600bps:

echo -e "\$PMTK251,9600*17\r\n" > /dev/ttyAMA0

 

Second, Set NMEA Update Speed

This will set the GPS to send 5 pulses per second (5Hz):

echo -e "\$PMTK220,200*2C\r\n" > /dev/ttyAMA0

For some reason I didn't need to change my TTY speed to execute this command even though the GPS should now be in 57.6kbps mode and the terminal *should be* at 9600.

To confirm the change, you can watch the data in Minicom both before and after; just make sure you change the baud rate or you will just see garbage.


If you are having problems perhaps you will need to change the baud on your console?

stty -F /dev/ttyAMA0 57600 clocal cread cs8 -cstopb -parenb

 

For reading serial port settings use:

stty -F /dev/ttyAMA0 -a

Mine reads this:

speed 57600 baud; rows 0; columns 0; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 0;

-parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8

-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke

I have no idea what it was set to before I started. Perhaps it is auto detecting? I doubt it.

 

 

 

Note: According to the datasheet a cold boot (if the GPS loses power and the backup battery is dead or not present) the baud rate and output frequency will go back to the default.

To do this right and make it permanent/reliable, the commands should probably be written into your program or added to the library and ran as part of the initialization/setup routine.

The fact that this is a volatile setting makes me think this is only written to RAM and therefore setting it each time the program runs (once) shouldn't do anything adverse such as prematurely wear out an EEPROM/flash chip.

 


Other update rates:

100mHz  "$PMTK220,10000*2F" // Once every 10 seconds, 100 millihertz

200mHz  "$PMTK220,5000*1B"  // Once every 5 seconds, 200 millihertz

1HZ  "$PMTK220,1000*1F"

5HZ  "$PMTK220,200*2C"

10HZ "$PMTK220,100*2F"


If you want to keep a lower baud rate and still increase the frequency you can try removing some of the unneeded NMEA sentences and just spit out the relevant position data.

These are the default messages the L80 is spitting out:

GPGGA

GPGSA

GPGSV

GPGSV

GPGSV

GPGSV

GPGLL

GPTXT

GPRMC

GPVTG

 

References:

Microstackimage GPS Reference

PMTK command packet reference

Handy Adafruit GPS.h file

NMEA data

  • Sign in to reply

Top Comments

  • screamingtiger
    screamingtiger over 10 years ago +1
    Excellent information Bob! Thanks for all the help.
  • bobalexander
    bobalexander over 10 years ago in reply to screamingtiger +1
    No problem - I had just been fighting the same problem when I saw your post. Figured if two people were having issues I should throw together a little document on how to do it.
  • screamingtiger
    screamingtiger over 10 years ago +1
    I do recommend if you want real high speed to go with a lower level option such as C++. Check out my post here to see what I am doing. Geocaching using C++ http://www.element14.com/community/community…
  • quique_b
    quique_b over 9 years ago

    Hi, thanks for the information. I'm a linux new user and I'm working with the module.

     

    Do you know how I can change the GPS rate at the start of my program?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • screamingtiger
    screamingtiger over 10 years ago

    I do recommend if you want real high speed to go with a lower level option such as C++.  Check out my post here to see what I am doing.

     

    Geocaching using C++

    http://www.element14.com/community/community/raspberry-pi/raspberrypi_projects/geocaching/blog/2015/08/14/geocaching-using-c

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • bobalexander
    bobalexander over 10 years ago in reply to screamingtiger

    No problem - I had just been fighting the same problem when I saw your post. image

    Figured if two people were having issues I should throw together a little document on how to do it.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • screamingtiger
    screamingtiger over 10 years ago

    Excellent information Bob!  Thanks for all the help.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube