15
- December
2021
Posted By : Dave Hartburn
Astrophotography with a Raspberry Pi – Part 2 (Remote control)

Continuing from my previous post about controlling a telescope and camera with Astroberry on a Raspberry Pi, part 2 looks at telescope control and planetarium software.

Telescope remote control

In order to connect a Celestron NexStar telescope, you need a USB to RS232 Serial port adaptor and a 9-pin serial to RJ9/RJ10/RJ22 lead. These can be bought from astronomy suppliers or because I wanted a short one, I bought a generic screw terminal 9-pin serial connector (eBay), a RJ9/RJ10/RJ22 lead, cut it in half and connected them together as per the instructions on NexStarSite. Connect the lead into the bottom of the NexStar handset, not into the AUX socket on the mount.

When connecting the USB to serial adaptor and running dmesg, you should see messages similar to:

[232802.875086] usb 1-1.4: new full-speed USB device number 3 using xhci_hcd
[232803.009515] usb 1-1.4: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 4.00
[232803.009537] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[232803.009555] usb 1-1.4: Product: USB-Serial Controller D
[232803.009573] usb 1-1.4: Manufacturer: Prolific Technology Inc. 
[232803.122032] usbcore: registered new interface driver usbserial_generic
[232803.122094] usbserial: USB Serial support registered for generic
[232803.125443] usbcore: registered new interface driver pl2303
[232803.125506] usbserial: USB Serial support registered for pl2303
[232803.125610] pl2303 1-1.4:1.0: pl2303 converter detected
[232803.143704] usb 1-1.4: pl2303 converter now attached to ttyUSB0

We can see our device is using /dev/ttyUSB0.

INDI Configuration

Astroberry comes with INDI configured for controlling and driving astronomy devices, see https://www.indilib.org. To get started with the INDI configuration, one of the easiest options is to use the INDI Web Manager. This can also provide an API for remote functions. See the Github page.

There are two ways to connect. Either remotely, just go to the address of your Pi, then when logging in, hover over the left side and you will see the INDI Web Manager appear, though this will also give you a remote desktop via the web. Alternatively goto http://your_pi_name.local:8624. Port 8624 is the default port. From the VNC connection to the Pi, go to http://localhost:8624.

Create a new profile, by giving it a name and clicking the + icon, e.g. ‘My stuff’. The profile will now appear in the top left. Now under local drivers, search for any astronomy equipment you own and click to add a tick next to it. Click away from the drop down when done. Select the checkboxes for Auto Start and Auto Connect to ensure they are running on boot, then click ‘Start’. It should report the server is online.

Note. I had problems getting my telescope to attach when I did the alignment first and then connected the serial port. Connect up first and then align.

KStars, EKOS and INDI

The default way to control your equipment and the INDI Server is from KStars, which is installed by default on Astroberry. Access it from the application menu or by the telescope icon on the top bar. If you scope is not GPS enabled or auto-aligning, set up alignment in the usual way then connect it to USB on the Pi.

When launched, KStars shows a planetarium view of the stars. Set your location by clicking on the world icon on the main toolbar. Along with many display settings, the equipment controls are on the right of the toolbar. The observatory control software EKOS can be launched from the tools menu, the observatory icon or Ctrl-K.

When EKOS control starts, your INDI profile should appear on the left as selected. You can also edit and add INDI profiles from this screen. Click the ‘play’ button to start the EKOS server, you may get a warning about restarting INDI server.

Any attached equipment will be listed in the INDI Control Panel that will appear. If one of your devices is not currently connected, you will get an error but can start it from the INDI panel later. At this point, the telescope should be connected and reported in the log. Most of the options can be left as default, and the firmware/mount information in Mount Info may be of interest. Under the motion control, you can now control your telescope in the same way you can from the handset. This also includes adjusting the rate.

Closing down the EKOS windows and going back to the original KStars planetarium view, you should now see a red crosshair showing where the telescope is pointing. If you select another target, with a double click, you can then right click, select your telescope and tell it to Go To. The telescope will slew round accordingly.

Under the camera tab you can turn on a stream to see output direct from the camera, or hit disconnect to use one of the other imaging applications. You can still control the telescope from this tab while the camera is disabled.

Stellarium on a Pi

Although Astroberry comes with KStars and other planetarium software packages which will also allow telescope control, being a fan of Stellarium, I wanted to try and get this running. Requiring OpenGL, this is slower and more resource hungry than other included applications. A number of snap installs are available, but I found all of these failed. Downloading the Stellarium source and building from scratch resolved the issue, though colour definition was lower than the usual desktop edition. Follow the build instructions in the file with the source download.

Stellarium does not install in the menu items by default and will need to be created manually, or run it with /opt/stellarium/bin/stellarium. Start it up, go to Configuration -> Plug-ins -> Telescope Control, select load at startup, before quitting and restarting. Make sure EKOS is not running, stopping Celestron control from the panel in KStars.

On restart, either go down the same path for Telescope Control and click Configure, or hit the telescope button added to the lower control panel and select Configure from there. Give the telescope a name, select Start/connect at startup, set the serial port to /dev/ttyUSB0 and the model to Celestron NexStar (compatible). Click ok then Start.

Leaving the telescope control panel open, you should be able to select objects, then click ‘Slew’ to move to them. Performance is not great from Stellarium on a Pi.

Stellarium remotely

Stellarium can connect to a remote INDI server, which is exactly what Astroberry is running. This means you can control your telescope from a copy of Stellarium from your local PC.

Enable the Telescope Plug-In as before, go to Configure telescopes and add a new scope. Select INDI/INDIGO as the type, give it a name such as Remote Pi, enter the address of the Pi and the default port of 7624. If you then hit Refresh Devices, you should see it pick up the INDI devices you configured. Select the telescope from the list and Ok. Start the server and you should now see the telescope crosshair appear. As before you can select and object and tell the scope to slew to it. With some versions, you also get four directional arrows.

Rather than having to free up the local USB port by stopping INDI/EKOS, you can connect to a remote INDI scope with the hostname localhost and do this internally.

This allows remote control and viewing of the telescope (with camera attached), but in order to be a fully remote set up, remote focus control is required. This is addressed in my next post.

Comments

Leave a Reply