Adding GPS

Tony
Site Admin
Posts: 957
Joined: Tue Jul 24, 2012 8:05 pm

Adding GPS

Post by Tony »

This has been asked a few times so I though I would post a quick how-to.

The easiest module to use on a cylinder clock is the Skylab SKM 53, it's small enough to just about fit inside and sensitive enough to work indoors away from a window.

You'll need to connect the 5V pin to the left hand end of R8, ground to one of the large holes drilled for SK1 (just next to R7) and RXD to the top of R7 (just below R8), so all 3 connections are in the same area making it simple to tag it on above the clock PCB. Fit a 100R resistor in place for R7.
jmmcg
Posts: 56
Joined: Sat Apr 11, 2020 2:45 pm

Re: Adding GPS

Post by jmmcg »

Can you recommend a wifi-to-gps converter that would be suitable? Or a newer GPS module?
Tony
Site Admin
Posts: 957
Joined: Tue Jul 24, 2012 8:05 pm

Re: Adding GPS

Post by Tony »

Not just yet but an ESP-based mod is in the works. Easiest way to just set time and date is to emulate the NMEA time packet but there is code in there to allow any memory location to be modified by serial data over that input - one of the things that caused problems at time with the IR clock-to-clock link.
jmmcg
Posts: 56
Joined: Sat Apr 11, 2020 2:45 pm

Re: Adding GPS

Post by jmmcg »

https://www.allaboutcircuits.com/upload ... asheet.pdf This is a pretty ancient piece of kit: the copyright is from 2010. Newer stuff should be more sensitive, smaller, use GLONASS, BEIDOU, etc.... I note that in the documentation, the SKM53: "The module default NMEA-0183 output is set up GGA, GSA, GSV, RMC and default baud rate is set up 9600bps" - GGA contains the time format. Now exactly what can the clock software handle? Should the output of any alternative be *exactly* the same as the SKM53 default? Can it read ZDA messages? Or only GGA?
jmmcg
Posts: 56
Joined: Sat Apr 11, 2020 2:45 pm

Re: Adding GPS

Post by jmmcg »

Might a Beitian BN-220T https://www.banggood.com/Beitian-BN-220 ... rehouse=CN or GPS-622F https://uk.rs-online.com/web/p/gps-chip ... s/7043300/work also?

I bought the Beitian BN-220T module & it outputs NMEA0183 (that NTP understands, tested on GNU/Linux), so fingers crossed it is compatible with the clock...
Last edited by jmmcg on Fri Jun 19, 2020 6:01 pm, edited 1 time in total.
Tony
Site Admin
Posts: 957
Joined: Tue Jul 24, 2012 8:05 pm

Re: Adding GPS

Post by Tony »

It wasn't quite as ancient when I designed it :)

Any module with a NMEA serial TTL output between 2400 and 9600 bps will work so just about any on the market. Sensitivity and size will vary, I just recommended the SKM53 as I know it fits and works.
jmmcg
Posts: 56
Joined: Sat Apr 11, 2020 2:45 pm

Re: Adding GPS

Post by jmmcg »

Tony wrote:It wasn't quite as ancient when I designed it :)
Arrrrrrr..... Them's were the dayz, laddie!
Tony wrote: Any module with a NMEA serial TTL output between 2400 and 9600 bps will work so just about any on the market. Sensitivity and size will vary, I just recommended the SKM53 as I know it fits and works.
I was worried as I read in another of the forums here that if the NMEA message was not of a certain format the PIC could crash. So I wanted to know if there were any specifics regarding the content of the NMEA message. From your response, I presume not.

I'd still rather have a wifi module that spits out the right format message for the clock from the global NTP pool. (Block of flats in London, in the central-core section, anyone?)
Tony
Site Admin
Posts: 957
Joined: Tue Jul 24, 2012 8:05 pm

Re: Adding GPS

Post by Tony »

That was a bug in an earlier version of the code, if the packet was larger than expected it would cause a buffer overflow despite a pointer check.

It wouldn't be too difficult to connect up an ESP8266 programmed to spit out an emulated packet. Sadly just keeping up with work after our house/workshop move is enough for now.
jmmcg
Posts: 56
Joined: Sat Apr 11, 2020 2:45 pm

Re: Adding GPS

Post by jmmcg »

Now this is interesting: http://doc.ntp.org/current-stable/drivers/driver20.html... Perhaps I should route the data to the USB too, so then the clock can act as a stratum 1 time source!!
jmmcg
Posts: 56
Joined: Sat Apr 11, 2020 2:45 pm

Re: Adding GPS

Post by jmmcg »

I have powered up the clock and see the time increment from 15:15. Now I have added the backup capacitor & plugged it in with my GPS device. It all powered up, the GPS took some time to lock (I can clearly see the GPS outputting various NMEA0183 format messages on my laptop). In the mean time the clock went through various displays and is now "stuck" displaying the Greek character "mu" for the seconds and the right-most digit displays "0" (all the rest are off). It does not seem to respond to the IR. Now with the backup capacitor, naturally this means I can no longer reset by power cycling. (I shall await the discharge, hopefully in hours, not days!) There is now no effect if the GPS unit is plugged in or not. I cannot find in your operating instructions what the code on the display means.
The backup cap discharged. Now booting fine, also the GPS locks in less than a second (a correlation?). (Odd: the lockup happened whilst the GPS unit had no lock, so the messages it would have put out would be different to when it had a lock. Wasn't there a mention about this in another one of the Lasermad forums?)
Sample NMEA0183 messages from the Beitian BN-220T GPS unit, with a lock:

Code: Select all

$GNVTG,,T,,M,0.126,N,0.234,K,A*3D
$GNGGA,134705.00,5203.45990,N,00016.30273,W,1,12,0.83,22.7,M,45.9,M,,*64
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,22,07,05,273,,08,82,270,22,10,52,073,28*73
$GPGSV,4,2,13,11,52,275,28,16,18,179,26,20,23,050,27,21,30,075,27*71
$GPGSV,4,3,13,22,11,204,20,27,60,128,24,28,06,329,,30,09,301,15*7E
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,37,046,29,66,37,133,33,67,01,170,,72,07,015,*6D
$GLGSV,3,2,10,73,06,353,,79,20,233,18,80,33,293,29,81,72,022,39*68
$GLGSV,3,3,10,82,37,293,30,88,28,086,25*62
$GNGLL,5203.45990,N,00016.30273,W,134705.00,A,A*66
$GNRMC,134706.00,A,5203.45992,N,00016.30273,W,0.015,,300620,,,A*7D
$GNVTG,,T,,M,0.015,N,0.028,K,A*33
$GNGGA,134706.00,5203.45992,N,00016.30273,W,1,12,0.83,22.8,M,45.9,M,,*6A
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,20,07,05,273,,08,82,270,21,10,52,073,26*7C
$GPGSV,4,2,13,11,52,275,27,16,18,179,24,20,23,050,25,21,30,075,26*7F
$GPGSV,4,3,13,22,11,204,18,27,60,128,22,28,06,329,,30,09,301,*77
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,37,046,27,66,37,133,28,67,01,170,,72,07,015,*69
$GLGSV,3,2,10,73,06,353,,79,20,233,18,80,33,293,29,81,72,022,34*65
$GLGSV,3,3,10,82,37,293,28,88,28,086,24*6A
$GNGLL,5203.45992,N,00016.30273,W,134706.00,A,A*67
$GNRMC,134707.00,A,5203.45994,N,00016.30274,W,0.023,,300620,,,A*78
$GNVTG,,T,,M,0.023,N,0.043,K,A*3B
$GNGGA,134707.00,5203.45994,N,00016.30274,W,1,12,0.83,22.8,M,45.9,M,,*6A
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,17,07,05,273,,08,82,270,20,10,52,073,25*7A
$GPGSV,4,2,13,11,52,275,26,16,18,179,24,20,23,050,23,21,30,075,25*7B
$GPGSV,4,3,13,22,11,204,,27,60,128,21,28,06,329,,30,09,301,*7D
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,37,046,25,66,37,133,28,67,01,170,,72,07,015,*6B
$GLGSV,3,2,10,73,06,353,,79,20,233,16,80,33,293,28,81,72,022,34*6A
$GLGSV,3,3,10,82,37,293,28,88,28,086,23*6D
$GNGLL,5203.45994,N,00016.30274,W,134707.00,A,A*67
$GNRMC,134708.00,A,5203.45991,N,00016.30276,W,0.171,,300620,,,A*76
$GNVTG,,T,,M,0.171,N,0.317,K,A*3F
$GNGGA,134708.00,5203.45991,N,00016.30276,W,1,12,0.83,22.9,M,45.9,M,,*63
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,17,07,05,273,,08,82,270,19,10,52,073,25*70
$GPGSV,4,2,13,11,52,275,25,16,18,179,22,20,23,050,22,21,30,075,23*79
$GPGSV,4,3,13,22,11,204,,27,60,128,20,28,06,329,,30,09,301,*7C
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,37,046,24,66,37,133,29,67,01,170,,72,07,015,*6B
$GLGSV,3,2,10,73,06,353,,79,20,233,15,80,33,293,27,81,72,022,34*66
$GLGSV,3,3,10,82,37,293,28,88,28,086,21*6F
$GNGLL,5203.45991,N,00016.30276,W,134708.00,A,A*6F
$GNRMC,134709.00,A,5203.45991,N,00016.30278,W,0.038,,300620,,,A*75
$GNVTG,,T,,M,0.038,N,0.070,K,A*31
$GNGGA,134709.00,5203.45991,N,00016.30278,W,1,12,0.83,22.9,M,45.9,M,,*6C
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,17,07,05,273,,08,82,270,19,10,52,073,25*70
$GPGSV,4,2,13,11,52,275,25,16,18,179,22,20,23,050,22,21,30,075,23*79
$GPGSV,4,3,13,22,11,204,,27,60,128,21,28,06,329,,30,09,301,*7D
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,37,046,24,66,37,133,29,67,01,170,,72,07,015,*6B
$GLGSV,3,2,10,73,06,353,,79,20,233,14,80,33,293,28,81,72,022,34*68
$GLGSV,3,3,10,82,37,293,28,88,28,086,20*6E
$GNGLL,5203.45991,N,00016.30278,W,134709.00,A,A*60
$GNRMC,134710.00,A,5203.45996,N,00016.30278,W,0.196,,300620,,,A*7F
$GNVTG,,T,,M,0.196,N,0.363,K,A*35
$GNGGA,134710.00,5203.45996,N,00016.30278,W,1,12,0.83,22.9,M,45.9,M,,*63
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,18,07,05,273,,08,82,270,19,10,52,073,25*7F
$GPGSV,4,2,13,11,52,275,25,16,18,179,22,20,23,050,22,21,30,075,24*7E
$GPGSV,4,3,13,22,11,204,,27,60,128,21,28,06,329,,30,09,301,*7D
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,37,046,24,66,37,133,29,67,01,170,,72,07,015,*6B
$GLGSV,3,2,10,73,06,353,,79,20,233,12,80,33,293,27,81,72,022,34*61
$GLGSV,3,3,10,82,37,293,29,88,28,086,20*6F
$GNGLL,5203.45996,N,00016.30278,W,134710.00,A,A*6F
$GNRMC,134711.00,A,5203.46001,N,00016.30278,W,0.147,,300620,,,A*76
$GNVTG,,T,,M,0.147,N,0.272,K,A*38
$GNGGA,134711.00,5203.46001,N,00016.30278,W,1,12,0.83,23.1,M,45.9,M,,*6F
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,18,07,05,273,,08,82,270,20,10,52,073,25*75
$GPGSV,4,2,13,11,52,275,25,16,18,179,22,20,23,050,23,21,30,075,24*7F
$GPGSV,4,3,13,22,11,204,,27,60,128,21,28,06,329,,30,09,301,*7D
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,36,046,23,66,37,133,29,67,01,170,,72,07,015,*6D
$GLGSV,3,2,10,73,06,353,,79,20,233,,80,33,293,27,81,72,022,34*62
$GLGSV,3,3,10,82,37,293,29,88,28,086,20*6F
$GNGLL,5203.46001,N,00016.30278,W,134711.00,A,A*6A
$GNRMC,134712.00,A,5203.46006,N,00016.30280,W,0.194,,300620,,,A*7B
$GNVTG,,T,,M,0.194,N,0.360,K,A*34
$GNGGA,134712.00,5203.46006,N,00016.30280,W,1,12,0.83,23.3,M,45.9,M,,*6E
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,16,07,05,273,,08,82,270,20,10,52,073,25*7B
$GPGSV,4,2,13,11,52,275,25,16,18,179,22,20,23,050,24,21,30,075,23*7F
$GPGSV,4,3,13,22,11,204,,27,60,128,22,28,06,329,,30,09,301,*7E
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,36,046,23,66,38,132,29,67,01,170,,72,07,015,*63
$GLGSV,3,2,10,73,06,353,,79,20,233,,80,33,293,27,81,72,022,34*62
$GLGSV,3,3,10,82,37,293,29,88,28,086,22*6D
$GNGLL,5203.46006,N,00016.30280,W,134712.00,A,A*69
$GNRMC,134713.00,A,5203.46001,N,00016.30285,W,0.284,,300620,,,A*7A
$GNVTG,,T,,M,0.284,N,0.525,K,A*31
$GNGGA,134713.00,5203.46001,N,00016.30285,W,1,12,0.83,23.4,M,45.9,M,,*6A
$GNGSA,A,3,08,27,10,11,21,20,16,,,,,,1.63,0.83,1.40*1C
$GNGSA,A,3,81,65,82,80,88,66,,,,,,,1.63,0.83,1.40*1E
$GPGSV,4,1,13,01,26,254,15,07,05,273,,08,82,270,20,10,52,073,25*78
$GPGSV,4,2,13,11,52,275,25,16,18,179,22,20,23,050,24,21,30,075,24*78
$GPGSV,4,3,13,22,11,204,,27,60,128,22,28,06,329,,30,09,301,*7E
$GPGSV,4,4,13,32,11,120,*49
$GLGSV,3,1,10,65,36,046,24,66,38,132,30,67,02,170,,72,07,015,*6F
$GLGSV,3,2,10,73,06,353,,79,20,233,,80,33,293,27,81,72,022,34*62
$GLGSV,3,3,10,82,37,293,29,88,28,086,23*6C
$GNGLL,5203.46001,N,00016.30285,W,134713.00,A,A*6A
Post Reply