Astrofriend's homepage

www.astrofriend.eu
Share: Twitter Reddit Facebook Gmail Gmail Email
Search Astrofriend's homepage:

Valid CSS!

All pages shall now have been validated

Info Cookies (Kakor) / GDPR

Navigation

Advertisement /
Annons:

Advertisement / Annons:

My astronomy project:
Setup KStars with GPS


Content:

  1. KStars GPSD
  2. KStars NMEA
  3. KStars GPSD, older 32-bit system
  4. To be continued

Note:
I take no responsibility or liability for what are written here, you use the information on your own risk!


1, KStars GPSD:

Overview:

If you always have your observatory at a stationary place with LAN connection there is no need for a GPS. But I who take the car and drive to remote dark places have a need for the GPS clock and location. The GPS installation has always been difficult, maybe easier now with the more up to date OS 64-bit version.

I follow this instruction that is told to work with Raspberry Pi5 and KStars 64-bit:

Older information about KStars and GPS:


GPS device:

Raspberry Pi5, KStars 64-bit, setup GSPD

The GPS dongle I use is the recommended U-blox7. It works much better than the earlier ones I have tried. But one disadvantage, it's sensitive to electro magnetic disturbance. I can't attach it direct to the Raspberry, I must have some distance between them. An extension USB cable of 0.5 meter solve the problem. I have also placed it on the opposite side of the telescope to where the Raspberry is placed.


Check GPS port:

Raspberry Pi5, KStars 64-bit, setup GSPD

For later use if the connection to the GPS device fail, it's good to know where the GPS' USB connect to. Disconnect the USB cable and give this command in the terminal window:

  • ls -l /dev/tty*

And then connect the USB cable again, note which new lines appear. In my case it's the port /dev/ttyACM0 that the GPS connect to.

As always before installing new software, update the system before:

  • sudo apt update && sudo apt upgrade
  • sudo reboot

Installing indi-gpsd:

I noticed that this driver was already installed in my KStars 64-bit package. If not in your case, do the following.

Raspberry Pi5, KStars 64-bit, setup GSPD

The command below installs the indi-gpsd:

  • sudo apt-get install indi-gpsd

After one third of the installation it ask you if you want to proceed, type: Y (yes) and Enter.


Activate GPS software and driver:

Raspberry Pi5, KStars 64-bit, setup GSPD

In the profile I have setup in KStars I add GPSD. GPSD is the driver that communicate with the GPS device. I add it on Aux 1. You find GPSD under "Others" devices.


Raspberry Pi5, KStars 64-bit, setup GSPD

GPSD attached, if it's okay, Save.


Install gpsd:

Raspberry Pi5, KStars 64-bit, setup GSPD

The three following commandos do the rest of the installation, enable and restart:

  • sudo apt install gpsd
  • sudo apt install gpsd-clients

The following two software I'm not 100% sure that they are needed, anyway I installed them:

  • sudo apt install libgps-dev
  • sudo apt install libindi-dev

Enable and restart the system:

  • sudo systemctl enable gpsd
  • sudo systemctl restart gpsd

Setup gpsd file:

Follow the instructions in the link above.

You can use this command to edit the file:

  • sudo nano /etc/default/gpsd
Raspberry Pi5, KStars 64-bit, setup GSPD

How I setup the gpsd file, but it will be different in your setup. In my case it's not ttyUSB1, it's ttyACM0 (old screen dump):

  • START_DAEMON="true"
  • DEVICES="/dev/ttyACM0" or alternative DEVICES="/dev/astro_gps_ublox7"
  • GPSD_OPTIONS="-n"
  • USBAUTO="true"

When you find it correct, quit with Ctrl X, type Y (yes) and Enter.

The second DEVICES="/dev/astro_gps_ublox7" is when I used my udev rules. Note: only one of these devices.

I haven't used the udev rules here, maybe I need to do it later when the setup gets more complicated. Here are information how to use udev: udev rules . Main purpose is to make it independent where you connect your USB cables, it will find it anyway.


Install and setup Chrony:

From Astroberry version 2.0.1 it use the Chrony to sync the system clock with GPS data. Much easier now to get it to work. Earlier if the system clock was wrong and only KStars is set with correct time it uses an offset to the system clock. That's fine for the most thing you do. But when doing Polar Alignment I got a lot of problem, I think it use the system clock direct and don't correct with the offset. I setup up Chrony to set the system clock to get rid of this problem. I found that I have to use a driver called Chrony. A bit complicated and asked a friend for help.

Be sure to have Raspberry and KStars updated to latest version.

Install gpsd and chrony with:

  • sudo apt-get install chrony -y

Check that service is running:

  • systemctl is-active gpsd
  • systemctl is-active chrony

If correct installed both shall give a "active" as answer.

To get it to work you normally has to add a line in the chrony.conf file. Place the line at the end of file.

Edit the file /etc/chrony/chrony.conf according to this:

  • refclock SHM 0 offset 0.5 delay 0.2 refid GPS

Or alternativy:

  • refclock SHM 0 refid NMEA offset 0.000 precision 1e-3 poll 3 noselect

How to do it: In commando window, give the command:

  • sudo nano /etc/chrony/chrony.conf

Sudo nano start a text editor. Copy and past the command above, right click and past. You can't use the mouse, use the arrows on the key board.

Quit with Ctrl X, type Y (yes) and Enter to save.

Restart Chrony:

After changes of chrony setup a restart must be done:

  • sudo systemctl restart chronyd.service

Test if synched:

Test if it's synced, in the commando window:

  • sudo chronyc sources
Raspberry Pi5, KStars 64-bit, setup GSPD

This is what I got, first line (GPS) has time=0, something wrong. Rebooted the Raspberry and do it once more:

Raspberry Pi5, KStars 64-bit, setup GSPD

Only the first line is important, the other four lines comes from internet because it's connected to internet. If the GPS work it should have some figures for the time, if 0 something is wrong.


Clean up installation:

Raspberry Pi5, KStars 64-bit, setup GSPD

To clean up after the installation, type in following command:

  • sudo apt autoremove

Reboot your Raspberry.


Test of GPS receiver:

To listening to what the GPS receiver get, type this commando:

  • cgps -s
Raspberry Pi5, KStars 64-bit, setup GSPD

A first test if the GPS receive any data, this normally never works, to my surprise it connect to the satellites and receives data.

Quit with "Ctrl+C"

After a while when I have experimenting with the setup it suddenly didn't show up the location. To fix that I killed the gpsd process and started it again. I used this command to do that:

  • sudo systemctl restart gpsd

I don't know why this occurred, and it have happen again.


Indi control panel:

Raspberry Pi5, KStars 64-bit, setup GSPD

Next check is to open the Indi control panel and see if there is any data received there from the GPS. It connects after less than a minute, it looks like the new OS 64-bit is updated. Never been so easy earlier.


Raspberry Pi5, KStars 64-bit, setup GSPD

In the Options menu. Set your location, this is used if you don't get any GPS data. Note: I don't give the exact position, easier then to know If there is real GPS data or only default data. Don't forget to Save.


GPS set KStars time and location:

Raspberry Pi5, KStars 64-bit, setup GSPD

There are more, open the Options setting.


Raspberry Pi5, KStars 64-bit, setup GSPD

Let GPS update the Time and Location. Enable the Independent window which isn't done here. Make it much easier to handle the windows later. This is from the older system.


Raspberry Pi5, KStars 64-bit, setup GSPD

In later versions these GPS settings has been moved to the mount tab. But with latest changes with Chrony maybe the first alternative is better "KStars updates all devices", not GPSD. Because Chrony set the system clock with GPS data.


Raspberry Pi5, KStars 64-bit, setup GSPD

Check in the KStars star chart that it use the GPS Location. Test without connected to internet.

Go Back to content

Go Back
To page II

Advertisement / Annons: