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:

Twitter @AstrofriendLars

Follow Astrofriend

Tutorial News

Advertisement / Annons:

Project:
HEQ5 as portable mount


Contents:

  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. HEQ5 and TS130 refractor ?
  22. 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

Note:
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 new coordinates whenever you change your location. The time is not correct either because there is no battery backup of the 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 when there is no internet connection, 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.


GPSD:

There are ten 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. Setup Chrony (New)
  9. Restart GPSD and KStars/Ekos
  10. Set time and date manually

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 with the instruction above. Maybe my GPS dongle is too old. In Raspberry / Astroberry this is handled 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 setup.

In the command window of Raspberry it list all tty devices 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 that is connected to Raspberry. It's important to always use the same port, I have set a label on the HUB to not mix these devices.

Setup of GPSD, Raspberry / Astroberry

I gave the same command once again:

  • ls -l /dev/tty*

Now a new port has appeared, the port with "/dev/ttyUSB1" as its device name on the last line. Now I know where my GPS dongle is connected. Make a note 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 the Raspberry. The default Geographic Location setup I did at the installation of Astroberry, look at point 6 on 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 because it use Virtual GPS and it's connected to a LAN network.


3, Disable Virtual GPS:

This is important. When using a GPS device you must stop the Virtual GPS. If not, the Virtual GPS take over and it doesn't 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

This command should work also:

  • sudo systemctl restart gpsd

Note:
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, not binary.

When I used this GPS dongle in my earlier Windows system there was 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

Note:
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 you 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.

DEVICES="/dev/ttyUSB1"

GPSD_OPTIONS="-n", this is important later when setup Chrony, normally it's already correct.

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 and choose properties until you find the correct file. 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.

Note:
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, when receiving GPS signal it always gives decimals.


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. But with latest changes with Chrony maybe the first alternative is better "KStars updates all devices" because Chrony set the system clock with GPS data.

Setup of GPSD, Raspberry / Astroberry

8, 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, but then I got stuck and needed help from my friend.

My friend are working on this and have an idea, the following command get the GPS to set the date and time.

Be sure to have Astroberry updated to latest version.

- Install gpsd and chrony with:

  • sudo apt-get install -y gpsd chrony

Most times nothing will be done because your system is already up to date.

- Modify GPSD_OPTIONS in the file /etc/default/gpsd to be:

  • GPSD_OPTIONS="-n"

Use the sudo nano to start the text editor in commando window:

  • sudo nano /etc/default/gpsd

The "-n" set it to send data repeatedly, chrony need it to work and it's very important.

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

  • #refclock SHM 0 offset 0.5 delay 0.2 refid GPS

Remove the # at the beginning of the line.

  • refclock SHM 0 offset 0.5 delay 0.2 refid GPS

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" and save.

Test if synched:

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

  • sudo chronyc sources
Setup of GPSD, Raspberry / Astroberry

This is what I got, but not finished yet, more testing to do. After a while I got this:

Setup of GPSD, Raspberry / Astroberry

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.


9, 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.


10, Set time and date manually:

Out on the field, I tested it many times now and it works like a charm most times. If it fail the time and date must be set manually with a sudo command:

Set date and time: (example: "2023-04-06 20:10:00", April 6th)

  • sudo date -s 'YYYY-MM-DD HH:MM:SS'

After this, refresh the GPS and the time will be exactly correct. I normally do like this, before I go out in the night I start my system at home with a connected LAN cable and internet access, then it update date, time and location. It will remember the last date it was up and running and you don't have to update the date out on the field.

Go Back to content

Go Back
To page VIII

Advertisement / Annons: