I recently bought a Celestron 127SLT telescope with the goal of doing some solar system observation and photography. I had a Raspberry Pi camera and a B+ board kicking around from a previous robotics project, and decided to give it a try. It's not an ideal camera for this sort of thing, not by a long shot - but I already had it. The v1 camera can now be had for $13. It was worth a try.
The results were better than I expected. Here's some results. Details on how I did it are below.
Copernicus Crater, The Moon
Edge of a Mare, The Moon
How the Camera Is Mounted
A friend printed this mount for me. It was easy to assemble and everything fits well. This allows you to plug the camera in like an eyepiece. If you just replace the eyepiece with your camera, you are doing prime focus photography, which uses the telescope as a giant camera lens and focuses the image directly on your camera's sensor. To do this, you remove the lense that came on the camera. The magnification you get depends on the sensor size and the telescope focal length. The Pi camera has a very small sensor, and the 127SLT has a long focal length of 1500mm, resulting in a fairly high magnification level. Shorter focal length scopes will result in less magnification.
I mounted the camera first to check fit, and then carefully unscrewed the lens to remove it. There is a small piece of glue securing the lens - remove that with an Xacto knife before unscrewing the lens. Grab the black square camera body with one pair of pliers and gently twist the len with hemostats. You don't want the camera body to transfer those forces to the PCB or it may be torn off the board. Alternatively, there are printable spanner sets for this purpose on Thingiverse.
I then mounted the camera assembly to a printed case with a RaspPi B+.
I powered the Pi off a USB battery pack intended for charging phones - even a small one provides several hours of juice.
Software on the Raspberry Pi
In order to frame the picture and to focus, you need to be able to see a preview of what the camera is seeing. The best way I found to do this was using RPi-Cam-Web-Interface. I set it to stream 640x480 previews at 40% quality, which was pretty snappy. You can then take pictures and video over the web interface. It's really slick. The installation instructions are excellent.
In order to be able to use it away from my home access point, I also set up the Pi to act as a wireless access point. That's completely optional, but is convenient if you intend to operate the system away from home. Then you just connect to the Pi with your phone, tablet, or computer and control the camera from there. You can adjust contrast, exposure compensation, ISO, shutter speed, etc.
Capturing Data and Best Camera Settings
I experimented with both video and still capture. Without fail, images made from stacked video turned out much better than still frames. The noise from the camera is high enough that even lunar shots benefit from stacking frames to improve signal to noise ratio.
The capture mode you select matters a great deal. I had best results using modes that result in binning. This combines data from adjacent pixels into one, which reduces resolution but is more sensitive and gives you a better signal to noise ratio. For Jupiter I used 640x480, which results in 4x4 binning, and 1296x730, which results in 2x2 binning.
Autoexposure will not be ideal - it will almost certainly overexpose. Try using -2 EV compensation and manually dialing the contrast in.
I used AutoStakkert or Registax 6 to stack frames, and did wavelet sharpening in Registax 6. I first ran the video through PIPP to crop the video and make alignment easier.
For comparison, stacked frames resulted in the picture on the left, and wavelet processing resulted in the final image on the right.The right image is also flipped right to left, since my telescope does that with a diagonal installed.
I have also gotten good results stitching lunar panoramas from video shot on the Pi and my SLR with Microsoft's Image Composite Editor, which is flat out awesome.
I usually do finishing touches on the lunar pictures with Silver Efex Pro, part of the now-free Nik Collection.
Attaching to the Telescope - Prime Focus
For lunar photography this is the way to go, unless you want extreme closeups. Just plug the camera in just like you would an eyepiece. You could probably gain a small amount of efficiency by removing the mirror diagonal, but if a 3D printed component broke I wanted it falling into my diagonal, not my telescope.
Eyepiece Projection for Planetary Imaging
For higher magnfication you can use Eyepiece Projection (EP). An eyepiece is used to project the image onto the sensor. An adjustable tube allows you to increase the magnification by increasing the distance of the eyepiece to the camera sensor. I used a 25 mm eyepiece and the extension tubes shown belowm along with this adapter. The same hardware can accept an SLR with T-ring, or a dedicated astro camera. Note: with EP, you focus by adjusting the telescope's focuser, and adjust magnification by sliding the camera in and out. I didn't actually see that written down anywhere and had to determine it experimentally. :-)
Update: Using my new ZWO astro camera, I have gotten MUCH better results with a 2x Barlow (Celestron Omni) I have not tried it with the RaspPi cam, but you may well get better results. I tried the ZWO cam with both and the Barlow was far superior. This shot of Jupiter at opposition was taken with a 2X barlow.
The low light sensitivity, extremely small sensor, and high noise combine to make the RPi cam a far from ideal solution, but it does work and is a very fun way to dip your toe into astrophotography. You are limited to 6 second exposures, so you won't be imaging nebulas, but the moon and the planets are fun.
It was enough to convince me I wanted to spend the money on a dedicated astronomy camera, so I bought a ZWO ASI290MC. I will keep the Pi scope camera though - it might be fun to play with streaming video from the scope over the internet.