×
INDI Library v1.8.5 Released (19 Apr 2020)

April 2020 release of INDI Library v1.8.5 introduces new drivers while providing fixes and improvements to existing devices and core framework.

Raspberry real time (SOLVED)

3 months 3 weeks ago 3 months 1 week ago by KillRoyCool.
KillRoyCool
Fresh Boarder
Fresh Boarder
Posts: 7
More
Topic Author
Raspberry real time (SOLVED) #49335
good evening everyone

I have a raspberry Pi with KStars Indi Ekos installed on it. Everything works wonderfully in "remote". On the other hand, the drawback of the Raspberry is that it does not have a battery to save the time and the date. As I am in "hotspot" the date and time of the system are at my last internet connection. When I launch KStars, my usb GPS is taken into account and changes the date and time but just for KStars. THE Raspberry is still the old date. THE problem is that my saved photos are at the date and time of the RaspBerry. So here is my question: Can we set the Raspberry on time with the GPS? I did not find anything on the net ...
Thanks

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

3 months 3 weeks ago
Avocette
Expert Boarder
Expert Boarder
Posts: 107
More
Raspberry real time (SOLVED) #49336
The answer to your question is Yes ....and No! Have a look in the Astroberry area of the forum.

Currently running KStars/Ekos/Indi on a Raspberry Pi 4B 2GByte under Raspbian thanks to Astroberry
Sky-Watcher ED80 Pro with 0.85x FR/Corrector with Canon DSLR on AZ-EQ5 GT mount
Other Sky-Watcher scopes - SkyMax 150 Pro Maksutov Cassegrain and Explorer 150p Newtonian

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

3 months 3 weeks ago 3 months 3 weeks ago by Ihoujin.
Ihoujin
Platinum Boarder
Platinum Boarder
Posts: 875
Karma: 3
More
Raspberry real time (SOLVED) #49345
Yes you can. I have my Pi setup to correctly set the system time from GPS. It is a little bit of work to set up. You need GPSD and NTP. The tricky part is configuring GPSD to use the signal time when is greater than 1000 seconds off of the system time.
Install GPSD and NTP and optionally some additional tools.
*Disclaimer, it has been some time since I last set this up and I may miss something below.
sudo apt-get install gpsd gpsd-clients ntp ntpstat

Configure the following:
/etc/default/gpsd
DEVICES="/dev/ttyS0"
GPSD_SOCKET="/var/run/gpsd.sock"
# Other options you want to pass to gpsd
GPSD_OPTIONS="-D 5 -N -n"

/etc/ntp.conf
# Kernel-mode PPS ref-clock for the precise seconds
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0 refid PPS stratum 0

# Server from shared memory provided by gpsd
server 127.127.28.0 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.0 refid NMEA stratum 3 time 1 0.000

/etc/systemd/timesyncd.conf
[Time]
NTP=127.127.28.0

INDI/KStars on Raspberry Pi 4, 4gb
Raspbian Buster with AstroPi3 script configuration
Skywatcher HEQ5 Pro Mount
Canon 600D Camera
Orion SSAG/ASI120mm @280mm Guide Scope
PHD2
Adafruit Motor Hat shield
Adafruit GPS Module
Generic Bluetooth Joystick.
Startech 7 port powered USB Hub.
The following user(s) said Thank You KillRoyCool

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

3 months 3 weeks ago
phomer60
Gold Boarder
Gold Boarder
Posts: 189
More
Raspberry real time (SOLVED) #49347
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 KillRoyCool

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

3 months 3 weeks ago
hy
Gold Boarder
Gold Boarder
Posts: 242
Karma: 2
More
Raspberry real time (SOLVED) #49348
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

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

3 months 3 weeks ago
Avocette
Expert Boarder
Expert Boarder
Posts: 107
More
Raspberry real time (SOLVED) #49349
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........

Currently running KStars/Ekos/Indi on a Raspberry Pi 4B 2GByte under Raspbian thanks to Astroberry
Sky-Watcher ED80 Pro with 0.85x FR/Corrector with Canon DSLR on AZ-EQ5 GT mount
Other Sky-Watcher scopes - SkyMax 150 Pro Maksutov Cassegrain and Explorer 150p Newtonian

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

3 months 3 weeks ago 3 months 3 weeks ago by Avocette. Reason: spelling
Avocette
Expert Boarder
Expert Boarder
Posts: 107
More
Raspberry real time (SOLVED) #49350

Ihoujin wrote: Yes you can. I have my Pi setup to correctly set the system time from GPS. It is a little bit of work to set up. You need GPSD and NTP. The tricky part is configuring GPSD to use the signal time when is greater than 1000 seconds off of the system time.
Install GPSD and NTP and optionally some additional tools.
*Disclaimer, it has been some time since I last set this up and I may miss something below.

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"

Currently running KStars/Ekos/Indi on a Raspberry Pi 4B 2GByte under Raspbian thanks to Astroberry
Sky-Watcher ED80 Pro with 0.85x FR/Corrector with Canon DSLR on AZ-EQ5 GT mount
Other Sky-Watcher scopes - SkyMax 150 Pro Maksutov Cassegrain and Explorer 150p Newtonian

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

3 months 3 weeks ago
ChrisRowland
Platinum Boarder
Platinum Boarder
Posts: 459
Karma: 9
More
Raspberry real time (SOLVED) #49355

hy wrote: 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


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.

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

3 months 3 weeks ago
Avocette
Expert Boarder
Expert Boarder
Posts: 107
More
Raspberry real time (SOLVED) #49361

KillRoyCool wrote: When I launch KStars, my usb GPS is taken into account and changes the date and time but just for KStars. THE Raspberry is still the old date.

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......

Currently running KStars/Ekos/Indi on a Raspberry Pi 4B 2GByte under Raspbian thanks to Astroberry
Sky-Watcher ED80 Pro with 0.85x FR/Corrector with Canon DSLR on AZ-EQ5 GT mount
Other Sky-Watcher scopes - SkyMax 150 Pro Maksutov Cassegrain and Explorer 150p Newtonian

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

3 months 3 weeks ago 3 months 3 weeks ago by Ihoujin.
Ihoujin
Platinum Boarder
Platinum Boarder
Posts: 875
Karma: 3
More
Raspberry real time (SOLVED) #49378

Avocette wrote: 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"


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/

INDI/KStars on Raspberry Pi 4, 4gb
Raspbian Buster with AstroPi3 script configuration
Skywatcher HEQ5 Pro Mount
Canon 600D Camera
Orion SSAG/ASI120mm @280mm Guide Scope
PHD2
Adafruit Motor Hat shield
Adafruit GPS Module
Generic Bluetooth Joystick.
Startech 7 port powered USB Hub.
The following user(s) said Thank You KillRoyCool

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

3 months 2 weeks ago
KillRoyCool
Fresh Boarder
Fresh Boarder
Posts: 7
More
Topic Author
Raspberry real time (SOLVED) #49659
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.

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

3 months 2 weeks ago
dmsummers
Gold Boarder
Gold Boarder
Posts: 177
Karma: 1
More
Raspberry real time (SOLVED) #49670
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/

RASA11, Celestron CGX-L, ASI183mc Pro, 60mm guider + ASI290mm mini, ASI EAF focuser, PPB, Rpi4-4Gb+SSD, Powered USB3 hub, hardwire Ethernet.
The following user(s) said Thank You KillRoyCool

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

Time to create page: 0.881 seconds