Posts: 63
Joined: Sun Nov 04, 2012 9:03 pm
Location: near Hannover, Germany

Verifying telescope pointing coordinates with the PiCam

Sun Jan 11, 2015 6:30 pm


For those PI camera fans who are also into astronomy, here's a little project idea I've explored to a point were I'm confident it's feasible:

If you have a telescope that lacks automatic GOTO stuff but at least is driven to compensate for Earth's motion, it can sometimes be hard to actually find faint objects. The idea is to use a camera (here the PiCamera board) to take a quick image of the field you are pointing the telescope at, then send that image to a web-service at which will , with a few arcseconds precision, tell you the coordinates of the image center. You could then show the coordinates on a little display attached to the PI or serve it on an HTML page via a web-browser running on the PI perhaps.

I made some tests where I put the PiCam (without the front lens) at the prime focus of a 76mm Celestron Firstscope and indeed, was able to plate-solve images with 6sec exposure time rapidly and reliably. This looks promising. I'll try some smaller finder-scope later on.

To implement this idea for use "in the field", you need to solve some sub-problems:

a) power supply: I use a Raspberry PI A+ powered by a Charger-battery-pack with 2600mAh (this one: ) which seems to last for a whole observing session. Many "power tanks" used by amateur astronomers also have 12V "car" sockets, and you can put one of those 12V to USB phone charging adapters into them as well.

b) connectivity: I use a WiFi dongle that can connect to a phone via tethering, so the PI has an Internet connection in the field.

c) taking the pictures: I use raspistill with an exposure time of 6sec, AWB switched off , burst mode , and the DRC parameter set to high, 640x480 image size, in an endless loop:

Code: Select all

nohup raspistill --nopreview -awb off -awbg 1.0,1.0  --colfx 128:128 -bm -w 640 -h 480 -q 80 -o /tmp/stream/pic.jpg -ISO 800 -drc high  -ss 6000000   -tl 200  -t 999999999 -th 0:0:0  &
[Not sure this is optimal for the purpose at hand, comments welcome]

d) sending images to : there is a Python script available here :

The script works best if you supply it with a good estimate of the pixel-scale of the image (in my case, for the Firstscope, it is ca 4.17 arcsec per pixel, +/- (say) 2 percent). To get the scale in the first place, take an image and submit it to via the webpage manually, and lookup the pixelscale on the resultpage.

You need to register with first to use their API, you will get a "key" code after registering.

A little helper script passes the data to the script:

Code: Select all


mydir=`dirname $0`


python client/ -k `cat $mydir/key.txt` --server= -u $imagefile  --wcs=$outfile -p  --scale-est=$scale --scale-units=arcsecperpix --crpix-center --scale-err=2 [email protected]
Here the key from is stored in the file key.txt in the same directory as the script.

The script is called like this:
./ /tmp/stream/pic.jpg
and then you can extract the coordinates with the tool wcshead from the result file (wcshead is part of the package wcstools that you can install via aptitude).


Code: Select all

 $ wcshead 
          640  480 RA---TAN DEC--TAN 330.272 83.677 FK5  321.00  241.00  4.1720  4.1627 218.6021
Here 330.272 and 83.677 are the Right Ascension and Declination coordinates at the frame center .

[One problem is that the script seems to have a bug: when the plate-solving fails, the script will loop forever. I managed to hack it to terminate upon failure, but I need to make a cleaner patch. ]

e) Displaying the coordinates: I've ordered a 4x20 character LCD for the PI but it hasn't arrived yet.

f) streaming the images to check focus etc.:
I use MJPG-streamer to stream the latest picture taken by raspistill so I can check the focus and image quality ( ).

I probably also want to have a pushbutton on the PI to initiate the whole procedure, because I don't want to spam in an endless loop.

I'm not quite sure how useful this is for me but it might be useful for others working on robotic telescope setups. Any comments welcome.


Posts: 2
Joined: Sun Feb 01, 2015 10:14 am

Re: Verifying telescope pointing coordinates with the PiCam

Sat May 23, 2015 6:55 pm

Very nice idea, and writeup. I do get an error from wcshead, though. Buffer overflow, whatever that is.

Posts: 30
Joined: Thu Apr 04, 2013 4:54 am
Location: Southern California USA

Re: Verifying telescope pointing coordinates with the PiCam

Wed Sep 02, 2015 1:55 am

Thanks for the great writeup, I am new to astrophotography and the Raspberry Pi since I first captured one very nice photo of a meteorite. Since then I've added a M12 lens adapter and M12 zoom lens found on eBay but have not seen another meteorite. I am also trying to get Black and White output to see if there is improved resolution, PNG is my choice for file type. .. thanks for the info .. Bill

Return to “Camera board”