Turn a Raspberry Pi into an Astrophotography Autoguider
I hate when my images turn out like this:
You can barely see the Crab Nebula drifting through the frame because I didn't align my mount well. To keep my telescope fixed on an object during long exposures, I needed an autoguider. But I also hate having a laptop in the field, which is required for most autoguiding solutions. To avoid this burdensome piece of equipment, I turned a Raspberry Pi with a touchscreen case into an on-board autoguiding system for my astrophotography rig.
The autoguider is the little white rectangle attached to the mount.
- Atik Titan through an Astromania 60mm Guide Scope
- Raspberry Pi with a 7" Touchscreen Display and a SmartiPi case
With this hardware, all I needed to do was install the software. Here's how I did it:
Step 1: Install Raspbian Stretch
Stretch is the operating system for the Raspberry Pi. To install it, follow the official instructions. All of the commands in the steps that follow are run from a terminal session on the Raspberry Pi.
Step 2: Install libnova 0.14
The default version on Stretch is 0.16, but the Atik INDI driver is linked to 0.14. For that reason, we need to download the Debian package for libnova 0.14 and install it:
$ curl -OL http://http.us.debian.org/debian/pool/main/libn/libnova/libnova-0.14-0_0.14.0-2.1_armhf.deb $ sudo dpkg -i libnova-0.14-0_0.14.0-2.1_armhf.deb $ curl -OL http://http.us.debian.org/debian/pool/main/libn/libnova/libnova-dev_0.14.0-2.1_armhf.deb $ sudo dpkg -i libnova-dev_0.14.0-2.1_armhf.deb
Step 3: Install Git
Because we'll need to compile and build some software from source code, we need to install Git to download the code for the projects:
$ sudo apt-get install git
Step 3: Build INDI
The first project we need to build from source is INDI, which allows the Raspberry Pi to connect to my camera and mount. To begin, we'll install INDI's dependencies (note: libnova-dev is exclude to ensure the correct version installed earlier):
$ sudo apt-get install libcfitsio-dev libusb-1.0-0-dev zlib1g-dev libgsl-dev build-essential cmake git libjpeg-dev libcurl4-gnutls-dev
Now we can get the source code (I built with v1.7.4, but v1.4.1 is supposed to be the version used with the Atik INDI driver. I guess they both work):
$ cd ~ $ git clone https://github.com/indilib/indi $ cd indi $ git fetch --tags $ git checkout origin/v1.7.4 -b v1.7.4
$ mkdir -p build/libindi $ cd build/libindi $ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ../../libindi $ make $ sudo make install
Step 4: Install the Atik INDI Driver from CloudMakers
Because I'm using an Atik camera, I need the Atik driver for INDI, which is maintained by the good folks at CloudMakers:
$ curl -OL http://download.cloudmakers.eu/atikccd-1.26-armhf.deb $ sudo dpkg -i atikccd-1.26-armhf.deb
Step 5: Build PHD2
Now we can install PHD2, the autoguiding software. First, install its dependencies (I've exclude
libnova-dev to ensure the correct versions above):
$ sudo apt-get install build-essential git cmake pkg-config libwxgtk3.0-dev wx-common wx3.0-i18n gettext zlib1g-dev libx11-dev libcurl4-gnutls-dev
Now get the source code (I used 2.6.5 because it was the latest stable at the time. No other reason):
$ cd ~ $ git clone https://github.com/OpenPHDGuiding/phd2 $ cd phd2 $ git fetch --tags $ git checkout origin/v2.6.5 -b v2.6.5
$ mkdir -p tmp $ cd tmp $ cmake ..
I built with all drivers (including ones I don't need like QHY and ZWO). It's likely I could have run the following command instead:
$ cmake -DOPENSOURCE_ONLY=1 ..
In any case, the next step is to install the compiled package:
$ sudo make install
Step 6: Start the INDI Server
We're ready to run the autoguider, but first we need to start the INDI server, which exposes an interface to the camera and mount:
$ indiserver indi_atik_ccd
Note: You can add
-vvv to get detailed logging. This helps if you're having trouble in the next step.
Step 7: Run PHD2!
Start the program by running:
The program will prompt you with a dialog to setup your camera and mount. Once you've finished, be sure to export the profile because I tends to get wiped when the program can't connect to the INDI server.
This setup is perfect for me. I can roll my entire rig into my driveway and start imaging in just a few minutes.
If you don't want to build you're own autoguider, you might consider the Lacerta MGEN II, which is the only solution I know of that doesn't require a laptop.
Update (July 2020): QHY PoleMaster
I've added a QHY PoleMaster to my rig, and I've update the Pi to run the software for it. The PoleMaster helps me get an almost perfect polar alignment. I tried using the tools built into PHD2, but I could never get them to work well.
QHY provides an entire Raspberry Pi image for the PoleMaster (including the operating system), but I didn't want to use that image because I already have my PHD2 set up. I wanted to add the PoleMaster software to my existing system. Here's how I did it:
Step 1: Install the QHYCCD SDK
Download and unzip SDK Installer:
$ curl -OL https://www.qhyccd.com/uploadfile/2018/1222/20181222054316365.zip $ unzip 20181222054316365.zip
Inside of the
zip file is a
rar file that the QHY instructions don't tell you about. The
rar format is pretty obscure, and there are different versions of it. The format QHY uses is 3.0, which doesn't work with the
unrar-free package you can install by running
apt install unrar-free. There is appearently an
unrar-nonfree you can install, but I decided to extract the
rar file on my Mac (using The Unarchiver.app) and transfering the extracted files to my Raspberry Pi via a file server. This is pretty ugly.
Once you have the extracted
rar file contents, you can run the
$ sudo ./install.sh
Step 2: Install the PoleMaster Package
Download and unzip the PoleMaster Debian package:
$ curl -OL https://www.qhyccd.com/uploadfile/2018/1222/20181222054634222.zip $ unzip 20181222054634222.zip
Then install the package using the
$ sudo dpkg -i PoleMaster_Qt-for-RPI-Ubuntu-220.127.116.11.deb
After the installation is complete, move into the
/usr/bin/PoleMaster directory and check if it was successful.
$ cd /usr/bin/PoleMaster $ ldd PoleMaster
Make sure all the listed dependencies map to a file location. If they aren't, you'll see a message like:
libqhyccd.so.4 => (file not found)
Step 3: Run the PoleMaster Software!
First, confirm that your PoleMaster device is plugged into the Pi by running:
You should see a line like:
Bus 0001 Device 009: ID 1618:0941
This line means the PoleMaster is connected.
Now run the PoleMaster software (I put this in an executable script on my desktop that I can double-click):
$ sudo /usr/bin/PoleMaster/PoleMaster
When program starts up, open the Device menu and click Connect. You're ready to polar align!
Using the program from my 7" Touchscreen Display is a bit of a pain, but it can be done. I had to connect a mouse in order to double-click Polaris, so I used a Logitech Trackball that I keep in my pocket. That way I don't need a table in the field.