Notes and Info on using a Raspberry Pi with my telescope
Not going to say much about my scope other than it is using a Vixen GP mount which had an ra drive fitted when I bought it, and I am fitting a dec motor to it. Both motors are vixen MT1 and I have a hand controller DD-1.
I'm first of all planning to add an ST4 interface to the controller, which looks pretty simple, and then use a PiFace to drive the interface. I'll then use Linguider to give me an autoguide capability. I'll look at adding goto later.
(Well, adding an ST4 interface to the DD1 didn't go too well.... )
I'm using Raspberry Pi, 'cos I have a couple already doing other things and I like them, plus it's nice low power so I can run on batteries, and lots of people are using them as telescope controllers. The GPIO on the pi means I can drive various things direct, rather than through various adapters, although I will use a PiFace to protect the pi and give me a bit more drive (the built in output pins are only 3.3v and very limited current).
I'm using linguider 'cos I've read in many places that it works far better on pi than the other obvious alternative - openphd, plus I relatively easily added support for driving piface outputs to it.
This setup all works, although I need to tweak the settings of lin_guider and / or the scope alignment to get a nice tight tracking. lin_guider reports a swing on tracking of around 6 - 8 arc seconds on 1 axis (the other axis is < 1 arc second). This is a 2 minute exposure with a 560mm lens on a crop frame camera. If you open up this piccy (which is a big crop from the original) you will see all the smaller stars are slight stripes.
This setup looks like it will work well for tracking, but as I can't change the speed of the motors except by moving the switch on the DD-1, goto is not going to be seamless.
(Well, adding an ST4 interface to the DD1 didn't go too well.... )
I'm using Raspberry Pi, 'cos I have a couple already doing other things and I like them, plus it's nice low power so I can run on batteries, and lots of people are using them as telescope controllers. The GPIO on the pi means I can drive various things direct, rather than through various adapters, although I will use a PiFace to protect the pi and give me a bit more drive (the built in output pins are only 3.3v and very limited current).
I'm using linguider 'cos I've read in many places that it works far better on pi than the other obvious alternative - openphd, plus I relatively easily added support for driving piface outputs to it.
This setup all works, although I need to tweak the settings of lin_guider and / or the scope alignment to get a nice tight tracking. lin_guider reports a swing on tracking of around 6 - 8 arc seconds on 1 axis (the other axis is < 1 arc second). This is a 2 minute exposure with a 560mm lens on a crop frame camera. If you open up this piccy (which is a big crop from the original) you will see all the smaller stars are slight stripes.
This setup looks like it will work well for tracking, but as I can't change the speed of the motors except by moving the switch on the DD-1, goto is not going to be seamless.
Starting on the pi.
I stuck the standard raspbian build (2016-02-26 Jessie) on card and booted up the pi. After the usual apt-get update / upgrade cycle (quite slow on a pi compared to my desktop...) I setup for piface using this guide. I did basic checks with blink and presslights examples. (Note that I got a modprobe error when enabling SPI in 'raspi-config', but after reboot the spi devices were showing in /dev.
This thread describes a simple python guider, but it struggles to run on an original pi B, so I decided to mod lin_guider to support piface.
I also run the pi headless and access from a Windows PC (as various astro software is hefted on Windows). This is easy to setup:
I also run the pi headless and access from a Windows PC (as various astro software is hefted on Windows). This is easy to setup:
sudo apt-get install xrdp
Then in preparation for linguider I did (from the info in the readme)
Note that g++, make etc are already there as part of build-essential after this lot.sudo apt-get install qt4-dev-tools
sudo apt-get install libusb-1.0-0-dev
apt-get install fxload
apt-get install libftdi-dev
Now do a first build of lin_guider (see gory details at the end if you need to), and check it builds and runs (without actually doing much at this stage).
Guiding scope and camera (zwo asi1034MC):
After faffing about with an ordinary webcam for a while, and finding that the finder I already had was going to be really hard to use (focal plane was inside the tube), I decided to get a new slightly larger guider finder and dedicated camera.I bought a zwo finder guider and basic camera - one of these and one of these from the nice folks at 365astronomy.
I installed the zwo linux sdk on my raspberry pi (only need it to get the zwo library so that lin guider can talk to the camera, and hooked it up to lin guider. Here's some details:
- I got the zwo linux sdk from here. I had to download it on another pc as this web page crashed the pi's browser.
- switch to the lib folder of the asi sdk and then use
sudo install asi.rules /lib/udev/rules.d
- this sets up permissions whenever the camera is plugged in so it can be used without special privilege. - after extracting the files I tweaked ld to find the file.
cd /etc/ld.so.conf.d
sudo nano libASICamera2.conf
- and put in it the single line: -
/home/pi/asisdk/lib/armv6
- then ran ldconfig to update -
sudo ldconfig
There are dire warnings about the arm driver being unstable, but I have found by increasing the exposure time to 2 seconds it behaves well.
Hacking the DD-1
I added a short lead with an RJ12 plug on the end to the DD-1. It would have been nicer to fit a socket, but there was no place a socket would fit, so I went for a short lead that I can use with an RJ12 coupler.
Also I went for minimalist at this end (so I will isolate at the other end), so the various movements are activated just by connecting pin 2 to one of the other pins. I took a standard RJ12 cable and chopped off one end at about 6".
Here is the inside of the controller all wired up:
This was a bit tedious as it means downloading and building a couple of libraries and then writing a small driver extension for lin_guider. The libraries needed are here. (the other library needed is referenced from this one).
It would definitely be easier just to use some solid state relays that can be driven directly from the gpio ports, but as I already had the piface and other bits needed I went the piface route.
By strange co-incidence the another project is driving lego mindstorm motors so I have a basic understanding of PID setup and tweaking, but this will l have to wait for some clear, calm nights....
Best guide I have found for lin_guider is here.
Also I went for minimalist at this end (so I will isolate at the other end), so the various movements are activated just by connecting pin 2 to one of the other pins. I took a standard RJ12 cable and chopped off one end at about 6".
Here is the inside of the controller all wired up:
- pin 2 ground
- pin 3 West: RA+, green
- pin 4 North: DEC+, red
- pin 5 South: DEC-, black
- pin 6 East: Ra-, blue
Updating lin_guider to support piface
Decided to plunge into lin_guider and get it working with piface.This was a bit tedious as it means downloading and building a couple of libraries and then writing a small driver extension for lin_guider. The libraries needed are here. (the other library needed is referenced from this one).
It would definitely be easier just to use some solid state relays that can be driven directly from the gpio ports, but as I already had the piface and other bits needed I went the piface route.
Making it all work well
Well I can run lin_guider and it does track, but I am getting a slight sawtooth effect on one axis which is large enough to streak stars slightly on longer exposures, so I need to tweak the PID settings or the setip of the mount, not quite sure which....By strange co-incidence the another project is driving lego mindstorm motors so I have a basic understanding of PID setup and tweaking, but this will l have to wait for some clear, calm nights....
Best guide I have found for lin_guider is here.
A lot of gory details in case any of the links above disappear.
- raspi-config to enable spi for the piface (rude message, but was working after reboot
- sudo apt-get install python3-pifacedigital-emulator
- test with python3 /usr/share/doc/python3-pifacedigitalio/examples/blink.py
- download lin_guider from SourceForge - this didn't work on my pi web browser, so had to download to another PC and copy it over:
- lin_guider readme explains how to build lin_guider, which I do after a couple of edits to allow it to drive through PiFace. This lot needs installing first though:
- sudo apt-get install qt4-dev-tools
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install fxload
sudo apt-get install libftdi-dev - and this to enable provision of C access to PiFace:
sudo apt-get install automake libtool - switch to folder for unpacked lin_guider (not the 'lin_guider_pack' folder - the one inside that.
- ./configure
- make
- I didn't need the udev bit as I'm not using a USB connection.
- check that the standard lin_guider is working - go to the lin_guider folder and launch lin_guider (you will need to be running in a gui for this to work)
- Now setup the zwo driver for the camera - the details are in the Guide scope and camera section above.
- Now run lin_guider again and set it to use this camera, slow the exposure time down to avoid the interface library throwing a wobbly.
- Now to do the piface bits:
- grab libmcp23s17 make a new folder and......
wget https://github.com/piface/libmcp23s17/archive/master.zip
unzip master.zip
make
sudo make install
now make a folder for the actual pifacedigital library and.....
wget https://github.com/piface/libpifacedigital/archive/master.zip
unzip master.zip
make
sudo make install - I wrote a small c++ module to integrate into lin_guider so I could drive out through a piface, but I haven't included the details here.
Hi,
ReplyDeleteinspiring post. My goal is little bit similar - all I wanna do is to add an ST4 guiding port to my RPI. I can't use PiFace as I have already 5" touch screen plugged into GPIO (and HDMI) making really nice standalone guiding minicomputer. It's working great with QHY5-L camera so as with Phillips SPC880 but to use that I need GPUSB and I believe it's the weakest point of the chain (it stops working for no reason from time to time...). Lin_guider supports GPIO guiding but I have no clue how to configure the chosen pins.
I located file where I can choose pin numbers: /src/io_dev/io_gpio.cpp
next I need to create some files in /sys/class/gpio/ (linguider looks in this directory for /gpio12/direction ).
but how those files should look like? I have some basic copy&paste experience with arduino IDE but here I'm lost.
And one more thing. Default GPIO pins are 27, 22, 23 and 24, all are occupied by screen so I have to go for pins like 12, 16, 20 and 21. Linguider when starting reads them correctly except DEC+ pin where it keep saying 23 instead of any number I write there (I even tried to put 23 on RA+ pin... no change).
Hi, thanks for your info! With your help I've been able to get the PiFace to work with the blink.py example and get lin_guider up and running.
ReplyDeleteCould you shed some light on getting lin_guider to talk to the PiFace (your C++ module maybe?)
Also, in step 16 above, does the directory location of libmcp23s17 and libpifacedigital matter? If so, could you show me the correct path(s)?
Thanks!
oh yes, the directory location is not important as the 'sudo make install' installs it system wide. I may have had to tweak a path statement though.
DeleteAH I hacked lin_guider a bit to call out to a new python module that did the work. I've since changed the way I use it and implemented my own stepper controller and am on the way to a home brewed goto mount control with guiding, but I'll see if I have the old lin_guider module - should be saved somewhere ')
ReplyDeleteAh! faded memories! I gave up with lin_guider as it was not happy working on my pi 2. I started using this instead:
ReplyDeletehttps://github.com/Gordon999/Pi-AutoGuider. I don't have the lin_guider bits now as they never worked properly.
If you want to try Pi-AutoGuider I have a modded version at https://github.com/pootle/PiAGMtwiddled with a skeleton module that it calls. (My version talks to a home brew stepper motor driver, so not much point in the details of that).
You probably just need to put some code in the functions 'guidenudge' and or 'move' in pootleguide.py to
drive an ST4 interface.
OK, thanks for the info. Early on I looked at the Pi-Autoguider project but it didnt seem as easy to operate as Lin_Guider (no auto calibration?).
ReplyDeleteMaybe I'm over simplifying things but if I want to stay with Lin_Guider, could I just drop the PiFace and just use the GPIO (or even USB?) on the RPi? Or would I need to write drivers for the GPIO (or USB) as well? My skill set is better suited with building a hardware interface to get to the ST4 than writing drivers in C.
Thx
You can easily make a small circuit to drive st4 from gpio pins with opto-isolators - like discussed here
ReplyDeletehttp://i.imgur.com/7xyrpPD.jpg. I think you can confugure lin_guider to drive gpio pins, so no extra software needed at all