Astrofriend's homepage
Share: Twitter Reddit Facebook Gmail Gmail Email
Search Astrofriend's homepage:

Valid CSS!

All pages shall now have been validated

Info Cookies (Kakor) / GDPR


Advertisement /

Twitter @AstrofriendLars

Follow Astrofriend

Tutorial News

Advertisement / Annons:

HEQ5 as portable mount


  1. Introduction
  2. EQDIRECT from D-sub to RJ45
  3. Power terminal of HEQ5 changed
  4. Installing the 300 mm lens on HEQ5
  5. Rewiring the electric cables
  6. Connecting the Raspberry
  7. Setup GPSD
  8. Setup GPS NMEA
  9. Power consumption
  10. Battery power cables
  11. Tweaking auto guiding parameters
  12. Rowan Belt Modification Kit
  13. Making the tripod to a low rider
  14. Redesign of mount head details
  15. Raspberry Pi4 bracket
  16. Brackets: temperature sensor, spirit level and stepper motor
  17. Transport box
  18. EQDirect cable
  19. Brackets reinforced and adapt it to EQ6
  20. Cut the length of the GPS cable
  21. To be continued

Related projects:

  1. HEQ5 as portable mount
  2. Pentax 645 300 mm ED IF f/4 lens
  3. KStars / EKOS and Raspberry Pi4

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

7: Setup GPSD

As told earlier, correct time and observatory location is important to get star positioning working correct. When having the astro equipment as a portable unit you get a new location whenever you change your location. The time is not correct either because there is no battery backup clock in the Raspberry. When on a stationary place and have access to internet there is no need for a GPS device, Astroberry will find correct time and location from internet. There are two ways to fix this, either through the GPS in the smartphone or with a GPS dongle connected to the Raspberry.

He is how to setup with a GPS dongle connected to the Raspberry with the driver GPSD. This the most difficult to setup but when it works it's very useful. I have got a lot of help of my friend and from INDI forum.


There are five very important steps to get it to work:

  1. Find the port that the GPS is connected to
  2. A first test with GPSD INDI
  3. Disable virtual GPS
  4. Set GPS device to NMEA protocol
  5. Direct ID to a given port
  6. Change Geographic Location
  7. Setup how to use GPS data in INDI
  8. Restart GPSD and Kstars/Ekos

I already have a GPS dongle and would like to use it for this purpose. Here are others instructions how to setup GPSD:

I never got this setup to work that easy, maybe my GPS dongle is too old. In Raspberry / Astroberry this is handling by the GPSD driver.

1, Find the port that the GPS is connected to:

Open the commando window, from here you can type in commands, it looks like an old DOS system. The commando windows icon is on the top list. I have collected the most common commands on a page here: Good to know commands.

There is no need to have the KStars and Ekos up and running during this setup other when doing test.

Setup of GPSD, Raspberry / Astroberry

Give this command:

  • ls -l /dev/tty*

Maybe it ask for the password, it's astroberry if you didn't change anything.

In the command window of Raspberry it list all tty ports. I expect the GPS dongle to show up in this list later, but it's not connected yet:

I connect the USB dongle to a USB port on the HUB. It's important to always use the same port, I have set a label on the HUB to not mix the devices.

Setup of GPSD, Raspberry / Astroberry

I gave the same command once again:

  • ls -l /dev/tty*

Now a new port has appeard, the port with "/dev/ttyUSB1" as its device name on the last line. Now I know where my GPS dongle is connected. Make a not of it, you need it later.

2, A first test with GPSD INDI Control Panel:

Before doing any changes it's vice to do a test, maybe it configured itself, but don't expect that :-)

Setup of GPSD, Raspberry / Astroberry

Start KStars and Ekos, go to the Indi Control Panel. Example of how it could look at the setup of GPSD. When clicking on the GPS refresh button it looks that it receive information from the GPS dongle, but it work as well even when the GPS dongle is indoors with no reception. If it has real contact with the GPS dongle it will change the location with small amounts sometimes when you click the Refresh button. Here it take the information from a local site on internet or locally what's stored on this computer, the default setup Geographic Location I did in the beginning, even at the end of this page. This is because it's setup to Virtual GPS mode as default and that must be disabled in the GPSD setup properly.

One more test, open the commando windows once again if it isn't already open.

Setup of GPSD, Raspberry / Astroberry

From the terminal window give this command:

  • cgps -s

Quit with: "Ctrl C".

Even here it could look as if it's connected to the GPS dongle. If it's receiving a satellite signal you will see them in the column to the right, here it's empty.

3, Disable Virtual GPS:

This is important. When using a GPS device you must stop the Virtual GPS. If not, this Virtual GPS take over and not listen to the real GPS signal. The Virtual GPS take the information through internet and will not work without an internet connection.

These two commands disable and stop Virtual GPS:

  • sudo systemctl disable virtualgps
  • sudo systemctl stop virtualgps

Now the GPSD driver must be stopped and restarted.

Setup of GPSD, Raspberry / Astroberry

The GPSD service must be stopped and restarted. Give the following commands:

  • sudo systemctl stop gpsd
  • sudo systemctl disable gpsd
  • sudo systemctl enable gpsd
  • sudo systemctl start gpsd

Some of the command could take a minute to execute. If KStars and Ekos is up and running, quit and close them.

Open the GPS window in the commando window.

Setup of GPSD, Raspberry / Astroberry

Give the command:

  • cgps -s

Now there are no location from Virtual GPS anymore, it's empty. The GPS dongle is active now but normally no data coming yet.

You quit the GPS window with: "Ctrl C".

4, Set GPS device to NMEA protocol:

There were no satellite data in the window above because the GPS dongle is not setup correctly, it must be in NMEA mode.

When I used this GPS dongle in my earlier Windows system there were a software to run to setup the GPS, one of the setups was if it should send data with the NMEA standard, sort of ASCII text. My friend found how to do the same in Linux, these two commands are needed:

  • sudo stty -F /dev/ttyUSB1 4800
  • sudo gpsctl -n -D 4 /dev/ttyUSB1

These two commands are for the BU-353 GPS dongle, maybe the commands not work for your device. Your device maybe isn't connected to USB1 either.

There is a way to listen to the data traffic on the port but you need to install a tool for it, screen.

You don't need to do this test normally, I just show how it looks.

Setup of GPSD, Raspberry / Astroberry

With this command you can listen on the USB port:

  • sudo screen /dev/ttyUSB1 4800

If the GPS dongle is in the NMEA mode text strings shall be received and show up on the screen like this.

You quit the data stream with: "Ctrl a" k y.

Setup of GPSD, Raspberry / Astroberry

Execute the command once again:

  • cgps -s

Now all GPS satellite data show up in the right column and you get the correct location for your place.

You quit the GPS window with: "Ctrl C".

5a, Direct ID to a given port:

It could be a problem that the GPS doesn't always connect to the same port, there is a way to lock it. With the information I got earlier I can now setup this.

Setup of GPSD, Raspberry / Astroberry

Give this command:

  • sudo nano /etc/default/gpsd

Now I have to change the information in this file with my device name. With "Ctrl K" it's possible to edit the information in the window above. You can't use the mouse, use the arrows on the key board. Set the parameters to the port you found in the beginning of this page. In my case it was: ttyUSB1.



When you stop the process with "Ctrl X" it will ask if you want to save it (y=yes).

Setup of GPSD, Raspberry / Astroberry

A check that everything went okay.

  • sudo nano /etc/default/gpsd

Quit with "Ctrl X".

5b, Direct Path to a given port:

The above procedure wasn't without problems, here is an alternative.

Setup of GPSD, Raspberry / Astroberry

Open the map: /dev/serial/by-path, where the file is that has the path ttyUSB1 (in this case it has changed to ttyUSB0). Right click on the files one by one until you find the correct file and choose properties. The information in the yellow circle is what we shall use, copy it, be careful to get the whole string, it's longer than the window's length.

This is not windows, Ctrl C and Ctrl V doesn't work. In Linux, right click and choose Copy and Paste.

Setup of GPSD, Raspberry / Astroberry

In commando window, give the command:

  • sudo nano /etc/default/gpsd

Replace the DEVICES="" with the path name from above. Edit with: "Ctrl K". You can't use the mouse, use the arrows on the key board. The idea is to have it always found correct port even if the device numbers are changed. If it works ? Who knows ? It's complicated !

Quit with "Ctrl X" and save.

6, Change Geographic Location:

If the GPS receiver fails it's good if the Raspberry's base setting is correct set for your location as a backup.

Setup of GPSD, Raspberry / Astroberry

You find it at: Preferences > Geographic Location.

Setup of GPSD, Raspberry / Astroberry

I set the location with no decimals, then it's easy for me to see what source the position use.

7, Setup how to use GPS data in INDI:

In INDI it can be setup from which source the location and clock updates from. In this case it's setup to use the GPS as a source.

Setup of GPSD, Raspberry / Astroberry

8, Restart GPSD and Kstars/Ekos:

Sometimes when starting up the system the GPSD driver doesn't start as it should. To fix that, shut down EKOS and KStars. Open the commando window and type in this command:

  • sudo systemctl restart gpsd

Commands that are used often can be setup as a script, look here how to do it: Good to know commands, at bottom of page.

After the GPSD has been restarted it's time to start KStars and activate Ekos with its drivers.

Setup of GPSD, Raspberry / Astroberry

Click on the Refresh GPS button, if it's connected to the GPS dongle it sometimes changes the decimals of the Location Lat/Lon. You must have a free view to the sky for the GPS receiver and it could take some minutes the first time for it to lock to the satellites. At the KStars lower left corner you will see that it take the location from GPS.

Go Back to content

Go Back
To page VIII

Advertisement / Annons: