×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Raspberry real time (SOLVED)

  • Posts: 437
  • Thank you received: 31

Replied by Paul on topic Raspberry real time

KillRoyCool,

An alternative to uisng GPS is to install a Real Time Clock (RTC) in the Raspberry Pi or to set it manually from the command line.

I have never been able to get my Raspberry Pi to read the RTC but when I have time I will have another go.

Paul
The following user(s) said Thank You: Juhin Christophe
4 years 2 months ago #49347

Please Log in or Create an account to join the conversation.

  • Posts: 1221
  • Thank you received: 565

Replied by Hy Murveit on topic Raspberry real time

The easiest, but of course least elegant answer, though is that you can set the time manually (each time you boot).
I have no RTC nor GPS, but rarely use it in the field. When I do, I look at my phone, and then type something like the following

sudo date -s "10 feb 2012 8:57pm"

I believe that's right, but unfortunately I can't test right now.
Google search seems to confirm, e.g.
www.garron.me/en/linux/set-time-date-tim...me-command-line.html
4 years 2 months ago #49348

Please Log in or Create an account to join the conversation.

  • Posts: 326
  • Thank you received: 50

Replied by Avocette on topic Raspberry real time

I agree with your manual workaround, but with everything else automated and indi drivers for auxiliary functions like indi_gpsd available, it just seems a shame to be struggling in the dark........
4 years 2 months ago #49349

Please Log in or Create an account to join the conversation.

  • Posts: 326
  • Thank you received: 50

Replied by Avocette on topic Raspberry real time

Just wondered if this is unique to the Adafruit GPS Module or would work with a USB GPS dongle? When my USB GPS has worked I have normally set up /etc/default/gpsd with DEVICES="/dev/ttyACM0"
Last edit: 4 years 2 months ago by Avocette. Reason: spelling
4 years 2 months ago #49350

Please Log in or Create an account to join the conversation.

  • Posts: 554
  • Thank you received: 138

Replied by Chris Rowland on topic Raspberry real time


Could this be scripted with the time obtained from the INDI device?

I've done something like that in the ASCOM/Windows world.

Or, if your mobile phone has a data connection, use it as a hotspot. That way the internet time would be available through the phone.
4 years 2 months ago #49355

Please Log in or Create an account to join the conversation.

  • Posts: 326
  • Thank you received: 50

Replied by Avocette on topic Raspberry real time

I have just made a new installation from the AstroPi3 script on Raspbian (newly updated to 3.2). This does not behave like the older version I have used for some months which did update the system time as well as the KStars time and geographic position from the USB GPS.
I have the feeling that there are several bugs in the latest KStars releases which seem to interact in unhelpful ways. These bugs appear to be identical to those I found in the Astroberry 2.0.1 image so don't seem to have been introduced when Radek was building that image. I am not knowledgable enough to investigate what's going on myself, but if someone wishes me to feedback logs etc. I would be happy to follow instructions......
4 years 2 months ago #49361

Please Log in or Create an account to join the conversation.

  • Posts: 1309
  • Thank you received: 226

Replied by Andrew on topic Raspberry real time


Ah, yes, this is just my configuration. You will have to enter your own device location accordingly.
Also it appears one additional aspect I have implemented was missing, a python script that is run at startup via a line in rc.local
github.com/AltJ/gpstime/blob/master/gpstime.py
import os
import sys
import time
from gps import *
 
print 'Attempting to access GPS time...'
 
try:
	gpsd = gps(mode=WATCH_ENABLE)
except:
	print 'No GPS connection present. TIME NOT SET.'
	sys.exit()
 
while True:
	gpsd.next()
	if gpsd.utc != None and gpsd.utc != '':
		gpstime = gpsd.utc[0:4] + gpsd.utc[5:7] + gpsd.utc[8:10] + ' ' + gpsd.utc[11:19]
		print 'Setting system time to GPS time...'
		os.system('sudo date -u --set="%s"' % gpstime)
		print 'System time set.'
		sys.exit()
	time.sleep(1)

This is an alternative method that may work as well.
blog.petrilopia.net/linux/raspberry-pi-set-time-gps-dongle/
The following user(s) said Thank You: Juhin Christophe
Last edit: 4 years 2 months ago by Andrew.
4 years 2 months ago #49378

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 1
Thank you for your contributions . But none of the solutions work for me. I am running Ubuntu Mate 16.04 with a Raspberry 3B +.
In hotspot, I will continue to set the time manually.
4 years 2 months ago #49659

Please Log in or Create an account to join the conversation.

  • Posts: 398
  • Thank you received: 117

Replied by Doug S on topic Raspberry real time

A simple and inexpensive solution would be to get a HW based clock for the Pi. See links for a couple of approaches:
www.amazon.com/gp/product/B01A78GA1W
www.raspberrypi-spy.co.uk/2015/05/adding...to-the-raspberry-pi/
The following user(s) said Thank You: Juhin Christophe
4 years 2 months ago #49670

Please Log in or Create an account to join the conversation.

  • Posts: 348
  • Thank you received: 69

Replied by Giles on topic Raspberry real time


The following chronyd.conf configuration, take the time from whatever is available GPS, Network or whatever, and syncs your system clock to it:
# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usuable directives.
pool 2.debian.pool.ntp.org iburst
 
# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys
 
# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift
 
# Uncomment the following line to turn logging on.
#log tracking measurements statistics
 
# Log files location.
logdir /var/log/chrony
 
# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0
 
# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync
 
# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3
refclock SHM 0 offset 0.5 delay 0.2 refid GPS

Taken from the default Astroberry 2.0.1 configuration.
The following user(s) said Thank You: Matteo
4 years 2 months ago #49675

Please Log in or Create an account to join the conversation.

  • Posts: 174
  • Thank you received: 27

Replied by Alex Varakin on topic Raspberry real time

Here is another approach which does not require additional hardware: setup laptop as ntp server and get RPi to sync time from laptop.
4 years 2 months ago #49737

Please Log in or Create an account to join the conversation.

  • Posts: 301
  • Thank you received: 46

Replied by Markku on topic Raspberry real time

Hi guys,

I just tried this : www.raspberrypi.org/forums/viewtopic.php?t=161133
I used OSMC for the test and it worked, but it seems that the networkmanager in OSMC is not very happy when booting without any network connection and doesn't bring up the NIC but the time and date is set, I didn't do any debugging about the problem for now so I guess I have to try using Raspian also.

Br,
/Markku
The following user(s) said Thank You: Juhin Christophe
4 years 2 months ago #49782

Please Log in or Create an account to join the conversation.

Time to create page: 1.175 seconds