0

I have a Raspberry Pi that has no access to internet. It is configured as an access point that I can connect to using my smartphone or tablet. Time on the Raspberry Pi is never correct after booting and I want it to automatically sync with the first device that connect to it. Those android devices (smartphone or tablet) will also have no internet access but their time will be correct. Is that possible?

I use the Raspberry Pi to control my telescope mount in a remote area hence the absence of internet. The tablet is just used as a VNC client displaying the Raspi's desktop.

Mehdi
  • 101
  • 1
  • "hotspot" with no Internet? Please explain what you mean by [hotspot](https://en.wikipedia.org/wiki/Hotspot). Have you considered using a GPS as time source? – Seamus Sep 28 '20 at 15:38
  • @Seamus I changed hotspot to "access point" if that is clearer – Mehdi Sep 28 '20 at 15:40
  • 1
    Ah - OK... I assume the requirement for accurate time on the Pi is that it's used to position your telescope somehow. Are you aware of [how the RPi maintains its time](https://raspberrypi.stackexchange.com/a/87921/83790)? So the fundamental problem for RPi timekeeping is that it has no Real Time Clock. Your phones probably do, but a transfer from Android to RPi won't last long. Have you considered a GPS unit for getting accurate time to your PI? – Seamus Sep 28 '20 at 15:50
  • Unless you are aware or can find or create a means to get the information *from the phone* -- by which I mean, something a connected device can do that *the phone will respond to* and provide the time, there's nothing to try. There may be something in the DHCP negotiation, although IP packets in and of themselves aren't timestamped. If so, you could probably hook into something using `dhcpcd` (see `man dhcpcd-run-hooks`). Beyond that, network programming for something like this is pretty simple on the Pi, but more complicated on Android. – goldilocks Sep 28 '20 at 16:27
  • I did a quick search for "NTP server Android" but did not find anything, most of the stuff is of course about how to connect to one. You could try asking somewhere like https://android.stackexchange.com/ -- you want an NTP server to that will work on a hotspot while the phone is otherwise off-line. I think Seamus's suggestion is the most robust (and probably easiest unless you find a pre-existing app for this): GPS information includes the time, does not require much power, and works pretty much anywhere on Earth above ground at this point, I think. – goldilocks Sep 28 '20 at 16:29
  • There is this https://apkpure.com/time-server/com.icecoldapps.timeserver no idea if the software is legit or safe so proceed with care. –  Sep 28 '20 at 20:01
  • You could enable NTP servers on all the Android devices OR install a $2 RTC on the Pi - which is what the rest of us do. – Milliways Sep 28 '20 at 23:19
  • The cheap rtc for the pi may drift a few seconds per day. Look at https://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html for a GPS time reference. – Ljm Dullaart Oct 06 '20 at 07:29

0 Answers0