×

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

Bi-monthly release with minor bug fixes and improvements

Getting rid of the GPS — an alternative for Raspberry Pi

  • Posts: 53
  • Thank you received: 11
I just wanted to share a quick workaround I found to setting time on remote Raspberry Pi (which is riding on the telescope and running the INDI server).

The premise is exactly that: we need INDI / Kstars / Ekos to know both the time and the location in order to drive the equipment correctly.
However, while it looks like both can be just set in Kstars and with "Kstars updates all devices" option propagated to the equipment, I have had experience where it was not sufficient: www.indilib.org/forum/ekos/13703-slewing...the-mount.html#95506
Long story short: to calculate the current LST the INDI driver for Takahashi Temma uses a libnova function that relies on the current OS time, which is not actually updated by Kstars running on a separate client computer.

I have no reason to think it is only the Temma driver that uses that function from libnova, so I assume many (if not all) other mount drivers will also rely on the underlying system time.
A USB GPS dongle has been a traditional way of ensuring system time accuracy, although not without ritual dancing around it: For me personally getting the GPS to obtain the fix has been the biggest issue. It takes very long, despite having good extension cables and open skies. Possibly, the abundance of metal guard rails around the balcony is not helping.

Anyway, the other day it finally occurred to me that I don't really need to bother:
  • I have a laptop which I use to connect to Raspberry Pi and control the process
  • This laptop always has correct time set (it regularly connects to wider networks and has a battery)
So why don't I just set the time on Raspberry Pi by sending it from the laptop? :lol:

The hostname of my Raspberry Pi is 0-astropi, so here is a simple alias that I added to my environment on the laptop:
alias astropi-setdate='ssh 0-astropi.local "sudo date -s \"`date`\""'

Obviously, instead of an alias, the command can be placed into an executable script and used that way too.
You just need to have date utility available, which will not be an issue on *nix-based systems (macOS in my case), but I'm sure it should be available in some way for Windows as well.

You may want to make sure SSH authentication is done using keys, because other wise while you are typing your password, the time this command is trying to pass and set to the remote machine is going to become outdated.
But really if it's just a few seconds, it shouldn't matter for the operation, that's why I said "may want".

So with that in place, my workflow becomes:
  • First thing when I connect the laptop to Raspberry Pi based Wi-fi, before starting Kstars, I run the astropi-setdate command defined as above. From this point on I know that on both the laptop and the Raspberry the time is correct.
  • In INDI settings, I use "Mount updates Kstars" because my mount remembers location, and only check "location" but uncheck "time"
  • GPSD is no longer a part of my Ekos profile

...and now I have 2 GPS dongles with no use (got the second one thinking the first one was not good enough, when really the issues with acquiring the fix were different).

I hope this helps someone. Despite being quite trivial, this solution took me time to find.
The following user(s) said Thank You: Wolfgang Reissenberger, Jerry Black
4 months 3 weeks ago #97512

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

Time to create page: 0.713 seconds