GPS module setup

36 views
Skip to first unread message

Scott Baker

unread,
Dec 26, 2023, 5:49:38 PM12/26/23
to dorkbotpdx-blabber
Hi,

I have a GPS module that connects serially at 9600 baud.
By default it spews out lots of info that I don't need.

e.g.

GNGGA,222834.000,4533.27299,N,12251.66723,W,1,15,0.8,72.8,M,-21.1,M,,*46
GNGSA,A,3,02,07,08,13,14,15,17,21,22,30,,,1.4,0.8,1.1,1*34
GPGSV,3,1,12,01,,,23,02,18,079,30,07,38,113,28,08,17,042,25,0*58
GPGSV,3,3,12,19,17,188,,21,17,066,09,22,66,259,29,30,70,106,33,0*63
BDGSV,2,2,06,35,40,088,25,42,12,207,,0*77
GNVTG,18.46,T,,M,0.00,N,0.00,K,A*18
GPTXT,01,01,01,ANTENNA OK*35
GNGLL,4533.27299,N,12251.66723,W,222835.000,A,A*5C
GNGSA,A,3,14,24,26,33,35,,,,,,,,1.4,0.8,1.1,4*38.

I only need the GGA type sentences.

According to the spec, you can send a command to limit the
output to only GGA sentences with this command:

"$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n"

However, after sending this command to the GPS module, 
there is no effect on the output. It is still spewing out the same
amount of excess data as before.

Anyone have any experience with controlling GPS module output?
What am I forgetting?

Thanks,
Scott

Kenny

unread,
Dec 26, 2023, 8:19:24 PM12/26/23
to dorkbotpd...@googlegroups.com
You probably tried all of this already but here are a few things that
come to mind. Have you tested UART TX with the PMTK_TEST command?

$PMTK000*32\r\n

You should get a PMTK_ACK (PMTK001) back. Also, what response do you
get when you issue the PMTK314 command? What GPS module are you working
with? I see 17 data fields in your command. 17 is right for some
chipsets while others like MT3318, MT3329 and MT3339 expect 19 data
fields for PMTK314.

$PMTK605*31 should help to identify the chip if its origins are
suspect.

After sending your 314, you can confirm the setting took effect by
issuing $PMTK414*33 which should return a 514 with data fields matching
your 314.

Is there any chance the module is browning out after your 314? Settings
are not saved across resets.

In case you haven't already found a checksum tool
like http://www.hhhh.org/wiml/proj/nmeaxor.html or just want something
local, here is a quick python snippet:

def checksum(s):
x = 0
for c in s:
x ^= ord(c)
return f'{x:02X}'

def mtk_nmea(s):
return f'${s}*{checksum(s)}\\r\\n'

print(mtk_nmea('PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'))

produces:
$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n

Good luck!
--
Kenny
-+---+++-++-++++--+------+-+-++--++--+-+-++--+++-++----+-++-+++---+----
+--+----+

Scott Baker

unread,
Dec 26, 2023, 9:53:36 PM12/26/23
to dorkbotpdx-blabber
Hi Kenny,

I get no response from either $PMTK000*32 or $PMTK605*31 or $PMTK414*33
The GPS module just continues to spew out the same output as before.

I also tried $PMTK161,0*28 which is supposed to put the module into standby mode.
But this command also seems to have no effect.

Scott

Kenny

unread,
Dec 26, 2023, 11:47:00 PM12/26/23
to dorkbotpd...@googlegroups.com
Sounds like you are doing all of the right things. Hopefully it is
something simple like a loose physical connection. The most common
issues I would tripple-check for:

- UART interface/MCU voltage matches module I/O voltage
- UART interface/MCU TX is connected to the right module pin
- Baud should be good since you are seeing clean text
- 8-N-1 serial configuration unless otherwise specified
- End of line characters are sent in the correct order

If that all still looks good but no response is observed, then try
probing the module with a tool that should theoretically just-work. The
gpsd package includes gpsctl. Try something like this but adjust device
path as needed:

gpsctl -f -n -s 9600 /dev/ttyUSB0

If that does work, then there is probably something fishy with your
command or EOL formatting. Maybe a cheap logic analyzer can help.
gpsctl also takes a -e to echo out the commands that it would send to
your module.

If gpsctl also fails to interact with the module, then it may be time
to try a different UART interface.

--
Kenny
-+---+++-++-++++--+------+-+-++--++--+-+-++--+++-++----+-++-+++---+----
+--+----+

Scott Baker

unread,
Dec 27, 2023, 11:32:26 AM12/27/23
to dorkbotpdx-blabber
Hi Kenny,

gpsctl does recognize the module

  gpsctl -f -n -s 9600 /dev/ttyUSB0

  /dev/ttyUSB0 identified as a u-blox at 9600 baud.
  gpsctl:SHOUT: switching to mode NMEA.

Can I use gpsctl to send configuration commands to the module?

I tried adding -e to the above command, but it looks like it's sending binary?

Thanks,
Scott

Scott Baker

unread,
Dec 27, 2023, 12:46:01 PM12/27/23
to dorkbotpdx-blabber

I downloaded a program called ublox u-center which looks like it can be used to configure GPS modules.
I'm experimenting with that now.

Thanks,
Scott

Scott Baker

unread,
Dec 27, 2023, 2:38:41 PM12/27/23
to dorkbotpdx-blabber
Hi Kenny,

Using the the u-center program, I was able to configure the GPS module to only send the data that I need.

e.g.
19:30:10  $GNGGA,193010.000,4533.27183,N,12251.66317,W,1,14,0.8,79.8,M,-21.1,M,,*40
19:30:10  $GNRMC,193010.000,A,4533.27183,N,12251.66317,W,0.00,0.00,271223,,,A,V*1B
19:30:10  $GNZDA,193010.000,27,12,2023,00,00*47
19:30:10  $GPTXT,01,01,01,ANTENNA OK*35
19:30:11  $GNGGA,193011.000,4533.27183,N,12251.66316,W,1,14,0.8,79.8,M,-21.1,M,,*40
19:30:11  $GNRMC,193011.000,A,4533.27183,N,12251.66316,W,0.00,0.00,271223,,,A,V*1B
19:30:11  $GNZDA,193011.000,27,12,2023,00,00*46
19:30:11  $GPTXT,01,01,01,ANTENNA OK*35

I couldn't find a way to turn off the GPTXT message, but that's OK.

I still can't configure the GPS module from my Arduino program.
And I don't see a debug option that would show me what the u-center program is doing under the hood.

Anyway, there is some progress.

Thanks,
Scott

Scott Baker

unread,
Dec 27, 2023, 11:30:06 PM12/27/23
to dorkbotpdx-blabber
I connected a scope to the GPS module Rx input and recorded the data
being sent to it by the u-center program when it sends a configuration command.
It looks like it's sending binary and not ASCII
My scope doesn't have enough depth to see the whole data stream
but the first 2 bytes are 0xB5, 0x62 which is the first 2 bytes of a UBX-CFG-MSG packet.

Getting closer.

Russell Senior

unread,
Dec 27, 2023, 11:40:11 PM12/27/23
to dorkbotpd...@googlegroups.com
https://www.ebay.com/itm/155486357723 + pulseview should let you capture/decode everything you need to know.

--
Russell Senior

--
You received this message because you are subscribed to the Google Groups "dorkbotpdx-blabber" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dorkbotpdx-blab...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dorkbotpdx-blabber/647e255f-0c11-4ebf-afc9-145665c05911n%40googlegroups.com.

p.fer...@gmail.com

unread,
Dec 28, 2023, 7:58:17 AM12/28/23
to dorkbotpdx-blabber
I'm not sure if this applies to you. It took me very long time to figure out the magic echo -e.
  echo -e  "$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*29\r\n"

Scott Baker

unread,
Dec 28, 2023, 3:53:17 PM12/28/23
to dorkbotpdx-blabber
I was able to collect the needed data from the u-center program.
Sending these UBX commands seems to work :)

  0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x00,0x01,0xFB,0x10   // Enable  GGA
  0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x04,0x01,0xFF,0x18   // Enable  RMC
  0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x08,0x01,0x03,0x20   // Enable  ZDA
  0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x01,0x00,0xFB,0x11   // Disable GLL
  0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x02,0x00,0xFC,0x13   // Disable GSA
  0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x03,0x00,0xFD,0x15   // Disable GSV
  0xB5,0x62,0x06,0x01,0x03,0x00,0xF0,0x05,0x00,0xFF,0x19   // Disable VTG

Thanks,
Scott
Reply all
Reply to author
Forward
0 new messages