Topics

Setting up auto time with draws gps #ntp #chrony #gps #clock #battery


Bob Orrett <boborrett@...>
 

Hello everyone and Merry Christmas,
This has most likely been covered before but I can't find it. How do I get the system time to automatically set from the draws gps at bootup without internet connection.
I enter "cgps -s" in the terminal window and the time sets after about 30 seconds for reasons that escape me. There must be a way to have this done automatically. 
    I expect you can tell that I am a newbie to RPi and linux so I need clear simple  step by step instructions. Please do not assume I will understand linux jargon. Someday I hope to be there but I am not there yet.  I dont mean to sound rude, I just dont want anyone to waste their time on me because they are afraid of insulting my intelligence.  Go ahead, insult me. 
Bob ve3obo


Art - KC7SDA
 

i think you have to have the battery installed for the rtc.... it takes a bit to get the signal and then set the clock.

I'm assuming you did the chrony and gps install as described in the wiki?


 

As has been discussed previously.  NTP services like chrony slowly adjust the system clock based on information obtained from both ntp servers and refclocks (like the GPS and PPS).

Basil has created a script that verifies time at ~/n7nix/gps/verify_time.sh

The command line to do a quick update of the clock is:   sudo chronyc makestep

You can verify your clocks with: chronyc sources -v

The battery backed RTC in the GPS must be set by the GPS once it has acquired the time reference from the satellites. 

In my opinion, NTP time synchronization works best if the computer is not powered down and the Raspberry Pi is well suited to continuous operation at low power consumption.  With the computer running continuously the chrony daemon can keep the system clock well synchronized whether using the GPS/PPS and/or network connections.  (It ignores sources that are not reporting or are way out of sync.)

 


On Wed, Dec 26, 2018, 16:16 Art - KC7SDA <nouse4anick@... wrote:
i think you have to have the battery installed for the rtc.... it takes a bit to get the signal and then set the clock.

I'm assuming you did the chrony and gps install as described in the wiki?


Budd Churchward
 

My experience with NTP service is that you need to keep it active. If you let it set the clock on the Rpi and then keep running without the internet connection the time on the clock gets pretty far off quite quickly. Like one day later it is way off.
 
Budd WB7FHC
 

Sent: Wednesday, December 26, 2018 5:34 PM
Subject: Re: [udrc] Setting up auto time with draws gps
 
As has been discussed previously.  NTP services like chrony slowly adjust the system clock based on information obtained from both ntp servers and refclocks (like the GPS and PPS).
 
Basil has created a script that verifies time at ~/n7nix/gps/verify_time.sh
 
The command line to do a quick update of the clock is:   sudo chronyc makestep

You can verify your clocks with: chronyc sources -v

The battery backed RTC in the GPS must be set by the GPS once it has acquired the time reference from the satellites.
 
In my opinion, NTP time synchronization works best if the computer is not powered down and the Raspberry Pi is well suited to continuous operation at low power consumption.  With the computer running continuously the chrony daemon can keep the system clock well synchronized whether using the GPS/PPS and/or network connections.  (It ignores sources that are not reporting or are way out of sync.)

 
 
On Wed, Dec 26, 2018, 16:16 Art - KC7SDA <nouse4anick@... wrote:
i think you have to have the battery installed for the rtc.... it takes a bit to get the signal and then set the clock.

I'm assuming you did the chrony and gps install as described in the wiki?


Basil Gunn
 

Budd Churchward <budd@...> writes:

My experience with NTP service is that you need to keep it active. If
you let it set the clock on the Rpi and then keep running without the
internet connection the time on the clock gets pretty far off quite
quickly. Like one day later it is way off.
It's a little confusing because the DRAWS image uses chronyd for the NTP
service and NOT ntpd.
So there are 3 situations:

No gps antenna
No Internet connection
No gps antenna or Internet connection

I have a script that dumps the world for chrony here:
n7nix/gps/verify_time.sh

It's also good to see how many satellites the gps is picking up with:
gpsmon

Usually if your clock is off by a lot & you are connected to the
Internet you can kick it in the butt as root with:

chronyc makestep

/Basil

Budd WB7FHC

From: John D Hays - K7VE
Sent: Wednesday, December 26, 2018 5:34 PM
To: udrc@nw-digital-radio.groups.io
Subject: Re: [udrc] Setting up auto time with draws gps

As has been discussed previously. NTP services like chrony slowly adjust the system clock based on information obtained from both ntp servers and refclocks (like the GPS and PPS).

Basil has created a script that verifies time at ~/n7nix/gps/verify_time.sh

The command line to do a quick update of the clock is: sudo chronyc makestep


You can verify your clocks with: chronyc sources -v


The battery backed RTC in the GPS must be set by the GPS once it has acquired the time reference from the satellites.

In my opinion, NTP time synchronization works best if the computer is not powered down and the Raspberry Pi is well suited to continuous operation at low power consumption. With the computer running continuously the chrony daemon can keep the system clock well synchronized whether using the GPS/PPS and/or network connections. (It ignores sources that are not reporting or are way out of sync.)



On Wed, Dec 26, 2018, 16:16 Art - KC7SDA <@nouse4anick wrote:

i think you have to have the battery installed for the rtc.... it takes a bit to get the signal and then set the clock.

I'm assuming you did the chrony and gps install as described in the wiki?


 

Budd,

If you have the GPS attached as a refclock, and it is active, it is actually a better time source than the Internet ntp servers.



On Wed, Dec 26, 2018 at 9:24 PM Budd Churchward <budd@...> wrote:
My experience with NTP service is that you need to keep it active. If you let it set the clock on the Rpi and then keep running without the internet connection the time on the clock gets pretty far off quite quickly. Like one day later it is way off.
 
Budd WB7FHC
 
Sent: Wednesday, December 26, 2018 5:34 PM
Subject: Re: [udrc] Setting up auto time with draws gps
 
As has been discussed previously.  NTP services like chrony slowly adjust the system clock based on information obtained from both ntp servers and refclocks (like the GPS and PPS).
 
Basil has created a script that verifies time at ~/n7nix/gps/verify_time.sh
 
The command line to do a quick update of the clock is:   sudo chronyc makestep

You can verify your clocks with: chronyc sources -v

The battery backed RTC in the GPS must be set by the GPS once it has acquired the time reference from the satellites.
 
In my opinion, NTP time synchronization works best if the computer is not powered down and the Raspberry Pi is well suited to continuous operation at low power consumption.  With the computer running continuously the chrony daemon can keep the system clock well synchronized whether using the GPS/PPS and/or network connections.  (It ignores sources that are not reporting or are way out of sync.)

 
 
On Wed, Dec 26, 2018, 16:16 Art - KC7SDA <nouse4anick@... wrote:
i think you have to have the battery installed for the rtc.... it takes a bit to get the signal and then set the clock.

I'm assuming you did the chrony and gps install as described in the wiki?



--


John D. Hays
Edmonds, WA
K7VE

   


Budd Churchward
 

Sorry for not making myself clear. The clock problem was something I saw while using the UDRC-II which has no GPS. The Rpi does a real lousy job of keeping time all by itself. One of the best things about the new DRAWS is that we now have a solution. The GPS and the RTC with back up battery are a welcome addition to the digital controller. It looks like we need to give the board a chance to see the satellites and set up the RTC. Then we can tuck DRAWS into our Go-Kit and it will be ready when we need it. The back up battery is an important part of this plan.

73 Budd WB7FHC

-----Original Message-----
From: Basil Gunn
Sent: Wednesday, December 26, 2018 10:30 PM
To: udrc@nw-digital-radio.groups.io
Subject: Re: [udrc] Setting up auto time with draws gps


Budd Churchward <budd@...> writes:

My experience with NTP service is that you need to keep it active. If
you let it set the clock on the Rpi and then keep running without the
internet connection the time on the clock gets pretty far off quite
quickly. Like one day later it is way off.
It's a little confusing because the DRAWS image uses chronyd for the NTP
service and NOT ntpd.
So there are 3 situations:

No gps antenna
No Internet connection
No gps antenna or Internet connection

I have a script that dumps the world for chrony here:
n7nix/gps/verify_time.sh

It's also good to see how many satellites the gps is picking up with:
gpsmon

Usually if your clock is off by a lot & you are connected to the
Internet you can kick it in the butt as root with:

chronyc makestep

/Basil

Budd WB7FHC

From: John D Hays - K7VE
Sent: Wednesday, December 26, 2018 5:34 PM
To: udrc@nw-digital-radio.groups.io
Subject: Re: [udrc] Setting up auto time with draws gps

As has been discussed previously. NTP services like chrony slowly adjust the system clock based on information obtained from both ntp servers and refclocks (like the GPS and PPS).

Basil has created a script that verifies time at ~/n7nix/gps/verify_time.sh

The command line to do a quick update of the clock is: sudo chronyc makestep


You can verify your clocks with: chronyc sources -v


The battery backed RTC in the GPS must be set by the GPS once it has acquired the time reference from the satellites.

In my opinion, NTP time synchronization works best if the computer is not powered down and the Raspberry Pi is well suited to continuous operation at low power consumption. With the computer running continuously the chrony daemon can keep the system clock well synchronized whether using the GPS/PPS and/or network connections. (It ignores sources that are not reporting or are way out of sync.)



On Wed, Dec 26, 2018, 16:16 Art - KC7SDA <@nouse4anick wrote:

i think you have to have the battery installed for the rtc.... it takes a bit to get the signal and then set the clock.

I'm assuming you did the chrony and gps install as described in the wiki?


 

On the go-kit.  The backup battery is only good for a cumulative 40 days with no power attached to the DRAWS™ HAT.  So if you have let it sit for 6-months, you will need to replace the battery and resync the RTC using the built-in GPS (w/Antenna).

I would suggest a blister pack of batteries in the go-kit.  They are relatively inexpensive and have decent shelf life.

On Thu, Dec 27, 2018 at 9:41 AM Budd Churchward <budd@...> wrote:
Sorry for not making myself clear. The clock problem was something I saw
while using the UDRC-II which has no GPS. The Rpi does a real lousy job of
keeping time all by itself. One of the best things about the new DRAWS is
that we now have a solution. The GPS and the RTC with back up battery are a
welcome addition to the digital controller. It looks like we need to give
the board a chance to see the satellites and set up the RTC. Then we can
tuck DRAWS into our Go-Kit and it will be ready when we need it. The back up
battery is an important part of this plan.

73 Budd WB7FHC
--


John D. Hays
Edmonds, WA
K7VE

   


Steve, N9VW
 

Wouldn't the almanac become stale as well, say after 6 months? Wouldn't that be about the same thing as a cold start when the system is booted back up?

73 de N9VW, Steve

On 12/27/2018 10:34 AM, John D Hays - K7VE wrote:
On the go-kit.  The backup battery is only good for a cumulative 40 days with no power attached to the DRAWS™ HAT.  So if you have let it sit for 6-months, you will need to replace the battery and resync the RTC using the built-in GPS (w/Antenna).

I would suggest a blister pack of batteries in the go-kit.  They are relatively inexpensive and have decent shelf life.

On Thu, Dec 27, 2018 at 9:41 AM Budd Churchward <budd@...> wrote:
Sorry for not making myself clear. The clock problem was something I saw
while using the UDRC-II which has no GPS. The Rpi does a real lousy job of
keeping time all by itself. One of the best things about the new DRAWS is
that we now have a solution. The GPS and the RTC with back up battery are a
welcome addition to the digital controller. It looks like we need to give
the board a chance to see the satellites and set up the RTC. Then we can
tuck DRAWS into our Go-Kit and it will be ready when we need it. The back up
battery is an important part of this plan.

73 Budd WB7FHC
--


John D. Hays
Edmonds, WA
K7VE

   



Art - KC7SDA
 

I did the setup as described in the wiki.... with a battery installed and no gps antenna chronyc sources says that gps is unreachable

cgps shows no fix BUT it has the correct date/time

the time offset from cgps shows -1022.something (bounces between 2 numbers).

I also ran all commands in the verify_time.sh script. chronyd is running and the date/time is off (about half an hour or so as I shut the pi down several times).

please note that the reason for the clock to set itself on boot is because it might take minutes (or never) for the gps to acquire a signal, and that's a waste of time for the user who may never get their clock updated.


 

The gps realtime clock must be set by the gps (with antenna).  Then it should be able to provide a date/time at startup, even if the gps is not active (i.e. not receiving signals from satellites).

On Thu, Dec 27, 2018 at 6:27 PM Art - KC7SDA <nouse4anick@...> wrote:
I did the setup as described in the wiki.... with a battery installed and no gps antenna chronyc sources says that gps is unreachable

cgps shows no fix BUT it has the correct date/time

the time offset from cgps shows -1022.something (bounces between 2 numbers).

I also ran all commands in the verify_time.sh script. chronyd is running and the date/time is off (about half an hour or so as I shut the pi down several times).

please note that the reason for the clock to set itself on boot is because it might take minutes (or never) for the gps to acquire a signal, and that's a waste of time for the user who may never get their clock updated.



--


John D. Hays
Edmonds, WA
K7VE

   


Art - KC7SDA
 

I do have the battery installed, and the rtc does have the correct time, however chrony doesn't view the gps as online and receiving a valid time

this is what the sources looks like:
pi@draws:~ $ chronyc sources 
210 Number of sources = 6
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
#? GPS                           0   3     0     -     +0ns[   +0ns] +/-    0ns
#? PPS                           0   3     0     -     +0ns[   +0ns] +/-    0ns
^- dfw1.m-d.net                  2  10   377   679   -1023s[ -1023s] +/-   79ms
^- atl1.m-d.net                  2  10   377   194   -1023s[ -1023s] +/-   87ms
^- iad1.m-d.net                  2  10   377   825   -1023s[ -1023s] +/-   87ms
^- static-96-244-96-19.bltm>     2  10   175    80   -1023s[ -1023s] +/-   74ms

and as you can see from the screen shot, it does have the correct time



when i run the date command i get 12:08 gmt, so chrony isn't updating and I have left this on all night (so it should have updated at some point)


Julian OH8STN <julian@...>
 

Hi Art 
Try disabling the pool in chrony.conf, by adding a hashtag in front of that line. Save, restart chrony, give it some time, then check with  chonyc sources -v
73
Julian oh8stn 

Julian OH8STN
www.oh8stn.org
www.youtube.com/c/OH8STN

On 28 Dec 2018 14:26, Art - KC7SDA <nouse4anick@...> wrote:
I do have the battery installed, and the rtc does have the correct time, however chrony doesn't view the gps as online and receiving a valid time

this is what the sources looks like:
pi@draws:~ $ chronyc sources 
210 Number of sources = 6
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
#? GPS                           0   3     0     -     +0ns[   +0ns] +/-    0ns
#? PPS                           0   3     0     -     +0ns[   +0ns] +/-    0ns
^- dfw1.m-d.net                  2  10   377   679   -1023s[ -1023s] +/-   79ms
^- atl1.m-d.net                  2  10   377   194   -1023s[ -1023s] +/-   87ms
^- iad1.m-d.net                  2  10   377   825   -1023s[ -1023s] +/-   87ms
^- static-96-244-96-19.bltm>     2  10   175    80   -1023s[ -1023s] +/-   74ms

and as you can see from the screen shot, it does have the correct time



when i run the date command i get 12:08 gmt, so chrony isn't updating and I have left this on all night (so it should have updated at some point)


Art - KC7SDA
 

nope, it just took out the other 4 sources. for whatever reason it's not giving me a sample at all. this is a communication problem between chrony and gpsd


Basil Gunn
 

when i run the date command i get 12:08 gmt, so chrony isn't updating
and I have left this on all night (so it should have updated at some
point)
The chrony service does NOT change the time!

The misconception is that the chrony service is setting the time to the
one given by the NTP server. This is incorrect – what actually happens
is that based on the answer from the NTP server, chrony just tells the
system clock to go faster or slower. For this reason, sometimes even
though the time is wrong and the NTP server is working, the time does
not get corrected immediately.

If your system time, as displayed by the date command, is not correct
ie. off by hours/months/years then as root run:

chronyc makestep

Also refresh my scripts

cd
cd n7nix
git pull

and send me the output of:

gps/verify-time.sh

/Basil


Art - KC7SDA
 

partially true, i changed the line int he chrony.conf file from:
makestep 1 3
to
makestep 1 -1
when you change the makestep to 1 -1 it will instantly change the system time to whatever the time source it chooses (rtc/gps/internet), it doesn't slow down or speed up the clock at that point, its the same as running 'chronyc makestep'

Also, I just plugged the gps antenna back in, and it updated the time!



So my guess is that gpsd isn't compiled correctly to update the time from the internal RTC if the antenna isn't plugged in. This can be a huge issue for some people and needs to be addressed.

Here is my main scenario as to why this needs to be addressed: you go out to field day with your setup and you forgot your gps antenna! you have no cell signal so you have no internet access to update the system time! you can't set it manually because ft8 and other time sensitive modes needs a high precision clock.... also there is the matter of logging contacts for contests/events that require accurate times.

Also, I believe when the pi turns on it does set the time from chrony's source (internet/gps/rtc), and if the rtc isn't updating when no antenna is attached then the system time won't be right during startup (which i'm sure will be the cause of headaches for some niche users).


Basil Gunn
 

partially true, i changed the line int he chrony.conf file from:

makestep 1 3
to

makestep 1 -1
This config will break some apps, like 'make' which builds depending on
time stamps. I'm not sure what else it breaks but I don't recommend your
config change.

So my guess is that gpsd isn't compiled correctly to update the time
from the internal RTC if the antenna isn't plugged in. This can be a
huge issue for some people and needs to be addressed.
I'll look into it.

/Basil


Bob Orrett <boborrett@...>
 

I will confess that I don't understand the finer points in this discussion . But speaking as an operator who likes to operate out in the field with no Internet,  I am surprised that the gps seems to need the antenna. This is not the best set up for portable field work. It would seem easier to use a gps usb dongle. When I read that purchasing the antenna was optional,  I assumed that that meant that the reception of satellites would be enhanced by the antenna not dependent on the antenna. I did try portable operations with the Draws Hat with no gps antenna and I did not aquire any satellites and therefore could not set the time. When I plugged in the antenna,  all worked as I expected. Do I understand this correctly? Is there a way to receive gps satellites without the antenna?

Bob Orrett,  VE3OBO 


Basil Gunn
 

When I plugged in the antenna, all
worked as I expected. Do I understand this correctly?
Yes that is correct. It is a requirement to have some antenna connected
to the gps device on the DRAWS HAT. I have used a number of USB gps and I'm
impressed how well the DRAWS gps works (11 satellites discovered) compared to
the others based on SiRF IV chips.


Is there a way to
receive gps satellites without the antenna?
Do not think so.

/Basil


Steve Stroh
 

There is no GPS antenna built into the DRAWS board. That is by design as the DRAWS board is intended to be packaged (along with its host Raspberry Pi) into a metal case which would block an integrated antenna. 

On Sat, Dec 29, 2018 at 11:57 Basil Gunn <basil@...> wrote:

> When I plugged in the antenna,  all
> worked as I expected. Do I understand this correctly?

Yes that is correct. It is a requirement to have some antenna connected
to the gps device on the DRAWS HAT. I have used a number of USB gps and I'm
impressed how well the DRAWS gps works (11 satellites discovered) compared to
the others based on SiRF IV chips.


> Is there a way to
> receive gps satellites without the antenna?

Do not think so.

/Basil



--
Steve Stroh (personal / general): stevestroh@...