Raspberry Pi Astro Cam

by DrGarySullivan in Circuits > Raspberry Pi

62125 Views, 358 Favorites, 0 Comments

Raspberry Pi Astro Cam

Moon with Pi Cam.jpg

I first attempted astrophotography more than 20 years ago. CCD astro cams were still pricey and low resolution, so many of us still used mechanical 35mm cameras attached to the back of our scopes. Despite having as much experience in photography as in amateur astronomy, I produced very little to show for all my effort. Fast-forward to 2016, and how technology has changed!

I recently renewed my interest in backyard astronomy when I purchased a Meade ETX-80 computer-driven scope. Computerized telescopes were also expensive in the 90's, so I never had one, and I really like my new scope. It has provisions to attach a DSLR to its back, but doing so blocks the movement of the scope into the opening of the mount, making viewing any object near the zenith impossible. I recently saw a YouTube video of the Moon, and another of Jupiter made with the new Raspberry Pi Camera Module V2. It is an inexpensive 8 megapixel CCD capable of taking 3280 x 2464 pixel static images.

The moon image above not a stock image, it is the actual first image taken with my new Astro Cam. And it is not even a high-resolution image - it is only 800x480 pixels. I discovered after taking my first shots that you must set the resolution in the Python code to get full-quality images.

Coming up, your first step will be to remove the original lens from the Pi Camera.

Remove the Lens From the Pi Cam

Case with inset.JPG

The Pi Camera is a small circuit board with a mounted CCD (charge-coupled device) sensor. The CCD forms a digital image when light is focused onto its surface. Since your telescope's objective will project the image, the small lens assembly screwed into a plastic housing on the Pi Cam is in the way and must be removed. Use something very small to grab the lens unit, taking advantage of the small slots on its edge, and unscrew it (counterclockwise). I used a very small set of needle-nose pliers, but some have used tools meant for removing lenses. The instructions I followed said you have to "pop" loose some glue holding it place, but my Pi Camera lens released without any such resistance. Once it releases, just turn it counterclockwise until it completely unscrews and pops out.

The photo also shows the completed case for the camera. It was made from one of the little plastic cases that hold new Micro SD cards and an included SD adapter. We purchase a lot of Micro SD cards for our Raspberry Pi's, and most chips come with this same clear-plastic case shown here under the camera cable.

You also need an extra-long cable to replace the short one that comes with the Pi Camera.

Cut and Paint the Case

IMG_3867.JPG

It is just a nice coincidence that the little circuit board with the camera fits perfectly into the raised insets that usually hold the large SD adapter. Leave this as-is, but cut away the small insets for the Micro SD and anything else that might interfere with the cable as it exits the housing. You also have to make a slot at the end for the cable; cut the snap-lock piece off, and make sure the slot is wide enough for the cable to exit, but no wider, so the cable and camera can't wiggle.

Then cut a hole just big enough for the black plastic barrel around the lens to poke through the case. The photo shows the hole, and the case has been painted flat black inside and out (but don't paint it just yet).

Glue on a Piece of 1.25 Inch O.D. PVC Drain Pipe

Just the pipes, ma'am.JPG

The camera needs a 1 1/4 inch barrel to slide into the telescope eyepiece holder. Thin white 1 1/4 inch PVC drain pipe pieces make an excellent barrel; they are the perfect size to fit snugly just like your eyepiece. One example is called a "drain pipe extension," found in the area of your hardware store that has bathroom and kitchen plumbing parts like drain pipes and toilet accessories. Cut it short enough to go all the way into the eyepiece barrel of your telescope.

Use epoxy, epoxy putty, or some other strong glue, but realize that it is unlikely that it will really adhere to the clear plastic case. Use plenty to form fillets both inside and outside to hold it place, then mask off the rest of the outside only of the white PVC pipe, and paint it all flat black inside and out. The inside of the pipe must be flat black.

Connect the Cable and Snap the Camera Into Place

IMG_3872.JPG

Remove the short cable that came with the camera and attach the new long cable. Place the camera into the recess in the case with the black plastic barrel pushing through the small hole. Close the case and fasten it with a small zip-tie. Insert the other end of the cable into the Raspberry PI's display port.

Our photo shows a Raspberry Pi attached to only the flat bottom piece of a Raspberry Pi case. Two flat phone charging "Power Bank" batteries have been affixed using double-sided foam tape. One power bank is enough, but two batteries ensure extra long photo periods.

Attach a Display

IMG_3868.JPG

I love this little 5 inch HDMI display. It inserts into the GPIO header block on the Pi, has a double-HDMI connector that pushes into both the display and the Pi at the same time, and has its own 5V power input so I can connect two batteries at once (one to the PI and one to the display).

Add a Secure Holder for the Raspberry Pi and Display Unit

IMG_3851.JPG

I used a cell phone holder of the type typically used in vehicles. I drilled a hole through its base and ran a long bolt, large washer, and wingnut to hold it onto the tripod.

I also run the Pi with a mini Bluetooth keyboard with integrated touch pad. It is really cool that I can take photos without touching the telescope at all!

The Software

IMG_3857.JPG

Here is a photo of the camera, held together by a zip tie, inserted into the eyepiece holder. The camera's sensor is a little further out than the focal plane of my eyepieces, so I have to refocus a bit once it is inserted.

There are only a few software options for using the camera. I wrote a simple Python script. It creates a menu that can change resolution, show a preview, snap one photo, snap a sequence of five photos, and exit. This is just an experimental piece of software, something more functional and user-friendly would be nice.

camera = PiCamera()    
num=0 while True: print('\n' * 50) print_menu() choice = input('Enter a command: ') if choice == "p": camera.start_preview() elif choice == "s": camera.stop_preview() elif choice == "1": camera.start_preview() sleep(1) camera.capture('/home/pi/Desktop/Image#%s.jpg' % num) num = num + 1; camera.stop_preview() elif choice == "5": camera.start_preview() sleep(1) for i in range(5): camera.capture('/home/pi/Desktop/Imageseries#%s.jpg' % num) num = num + 1 sleep(1) camera.stop_preview() elif choice == "h": camera.resolution = (3240,2464) elif choice == "m": camera.resolution = (1640,1232) elif choice == "l": camera.resolution = (800, 480) elif choice == "q": break

More Photos

mars_chart.gif
mars_hi_c.gif

As we continue to polish the design and software, and use the Astro Cam, we'll post new images and code on this page.

Telescope: Meade ETX-80, 80mm refractor telescope.

Featured photos:

  1. Mars, Oct. 15, 2016. Mars has been going away since late last spring, yet I was able to get some detail only visible in digitally enhanced images. Here is the way it looked in the eyepiece, just a white oval showing that the sun is shining on it from an angle. By the way, small objects are much bigger and easier to see on the display than through the eyepiece, since the field of view in the camera (the size of the small patch of sky visible) is very small. It is equivalent to using a very high magnification eyepiece, and it why we can't get the entire moon in view at once.
  2. This is the digitally enhance view. I compared for different shots, each enhanced the same way, so make sure the dark regions are not just artifacts of the camera. Several distinct regions appear in the about the same place in each image, and the very bright rim and red color of the rim at the shadow side of the planet matches what you see in images from much bigger telescopes.