×
INDI Library v1.8.7 Released (21 Nov 2020)

Nov. 2020 Release brings significant improvements to streaming and recording videos. Support for new drivers including Estatto focuser and Pegasus falcon rotator.

How to use smartphone GPS with INDI-GPSD

3 years 1 month ago 3 years 1 month ago by Vox45.
Vox45
Expert Boarder
Expert Boarder
Posts: 96
More
How to use smartphone GPS with INDI-GPSD #20438
I fear that there could be some conflicts here. I read on another thread on Astroberry that "if you don't have Internet connection NTP gets time from GPSD" and I read here that Jasem did not want to use GPSD.

Hopefully Kaczorek and Jasem are talking to each other ;) or there is no chance that this could cause issue if I use the new module on Astroberry ? I have a hard time connecting all the dots between all this GPSD/NMEA and all, but I it would be nice to clarify this either as a non-issue or address both scenrios in the documentation if it is not already there ...

"Some people are so poor, all they have is money"
SW Black Diamond 80ED | SW150MAK | Newton SW 200/1000 | Orion 50mm Guider with Helical Focuser |Sirius EQ-G Rowan Belt Mode
Canon 1000D moded | ZWO ASI185MC | Baader Mark III Zoom
INDI | Stellarmate on RPI3B+ | Stellarium | Pixinsight

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

3 years 1 month ago
knro
Administrator
Administrator
Posts: 8559
Karma: 51
How to use smartphone GPS with INDI-GPSD #20439
This is a separate driver for those who do not have a GPS dongle and want to use their mobile phone as the GPS. If you have GPS dongle, use GPSD.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
The following user(s) said Thank You Vox45

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

3 years 1 month ago
Kaczorek
Moderator
Moderator
Posts: 966
Karma: 6
More
How to use smartphone GPS with INDI-GPSD #20442
We talk to each other sometimes ;) But seriously... Kudos to Jasem for indi-gpsnmea driver. It fills the gap for people who use mobile phone's gps for setting location and time in KStars/Ekos. indi-gpsd does pretty much the same, however it is based on different approach. Both of the drivers set time and location (over INDI server) to other INDI drivers (e.g. mount) and clients (e.g. KStars), but:

indi-gpsnmea:
  • reads gps data stream from mobile phone's gps
  • requires network connection of the source of gps data stream i.e. phone running app, which enables gps sharing
  • does not set operating system time/date based on gps source
  • it is operating system independent

indi-gpsd:
  • reads gps data stream from gpsd service
  • requires gpsd service is running and properly configured as a systemwide service
  • ntpd service can read from gpsd service to synchronize operating system time/date to gps source
  • it is operating system dependent and can be used only on linux

There's no conflict between the two - NTP gets time from GPSD to set operating system time/date, not INDI drivers' and clients' time/date.
We can consider merging these drivers at some point in time, but for now you should run either indi-gpsnmea or indi-gpsd. Using both drivers at the same time makes no sense.

--
Radek Kaczorek
Astroberry Server | NEQ6 | Atik 460EX | Atik EFW2 | ASI 120MM
The following user(s) said Thank You knro, Vox45

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

3 years 1 month ago
knro
Administrator
Administrator
Posts: 8559
Karma: 51
How to use smartphone GPS with INDI-GPSD #20444
Great answer! It's now part of the documentation for both drivers to avoid any confusion in the future! Now it would be nice if the GPS NMEA driver can also set the system time, but due to escalated privileges required for this, it's not possible now unless it goes via another program that can set this without root.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
The following user(s) said Thank You Kaczorek

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

3 years 1 month ago
Ihoujin
Supernova Explorer
Supernova Explorer
Posts: 1009
Karma: 3
More
How to use smartphone GPS with INDI-GPSD #20445
Regarding setting Linux system time with GPS/NTP server, from my experience the NTP daemon will not sync the system time if it is too far off automatically. It considers the time to be in error. My solution is to run a python script to force the system time to sync with the NMEA source. NTP will then keep in sync. My script requires Sudo, perhaps it can be improved or a replacement integrated? Because if Kstars/INDI can keep my system clock set, that is one less thing to do when I power on a Raspberry Pi.
Time sync script:
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)

It also requires configuration of ntp.conf with the addition of these lines.
server 127.127.28.0 minpoll 4
fudge  127.127.28.0 time1 0.183 refid NMEA
server 127.127.28.1 minpoll 4 prefer
fudge  127.127.28.1 refid PPS

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
Waveshare Stepper Motor Board - DIY Focuser
Adafruit GPS Module
Generic Bluetooth Joystick.
Startech 7 port powered USB Hub.

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

3 years 1 month ago
T-Studio
Gold Boarder
Gold Boarder
Posts: 364
Karma: 1
More
Topic Author
How to use smartphone GPS with INDI-GPSD #20454
I tried this driver today.

It will work fine without GPSD! !

But time was registered a little bit.

Tried environment
OrangePi 2 plus (WiFi AP mode)
ubuntu 16.04
iPad 2 (GPS model)
GPS 2 IP

I attach photos.
Attachments:
The following user(s) said Thank You knro

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

3 years 1 month ago
knro
Administrator
Administrator
Posts: 8559
Karma: 51
How to use smartphone GPS with INDI-GPSD #20455
Thanks for testing! The GPS NMEA driver does not change system not. At least not yet.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

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

3 years 1 month ago
rlancaste
Supernova Explorer
Supernova Explorer
Posts: 2481
Karma: 24
More
How to use smartphone GPS with INDI-GPSD #20456

T-Studio wrote: I tried this driver today.

It will work fine without GPSD! !

But time was registered a little bit.

Tried environment
OrangePi 2 plus (WiFi AP mode)
ubuntu 16.04
iPad 2 (GPS model)
GPS 2 IP

I attach photos.


Yes, It does not use gpsd, Jasem wanted to avoid that. The phone's NMEA server communicates straight to the INDI driver. This of course means that currently the system time is not updated, just the time in KStars.

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

3 years 1 month ago
T-Studio
Gold Boarder
Gold Boarder
Posts: 364
Karma: 1
More
Topic Author
How to use smartphone GPS with INDI-GPSD #20459
Connecting without using GPSD is a big improvement!
(Connection with smartphone is not complicated)

I did not have enough words.
A time offset is sent.
The ipad time is the same as the screen time on the upper right, but in my environment, it will be registered in about 5 minutes in another time.

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

3 years 1 month ago
T-Studio
Gold Boarder
Gold Boarder
Posts: 364
Karma: 1
More
Topic Author
How to use smartphone GPS with INDI-GPSD #20461
Compare with the time part of the driver.

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

3 years 1 month ago
T-Studio
Gold Boarder
Gold Boarder
Posts: 364
Karma: 1
More
Topic Author
How to use smartphone GPS with INDI-GPSD #20462
That is a correction.
It is time display of Kstars.

Several minutes have elapsed since setting the time from the driver.

When sending GPS transmission ipad, VNC remote OSX will display the same time, but the time of kstars synchronized with the driver and telescope driver will be registered about 5 minutes apart.

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

3 years 1 month ago 3 years 1 month ago by T-Studio.
T-Studio
Gold Boarder
Gold Boarder
Posts: 364
Karma: 1
More
Topic Author
How to use smartphone GPS with INDI-GPSD #20487
I tested it later.

As written earlier, different times are written to the driver. (Different about 5 minutes)

Latitude, longitude, and time information are not sent to the mount.

I am logging, so please check.

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

Time to create page: 0.601 seconds