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:
Top Comments