Raspberry Pi Astro Cam

36,913

301

39

Posted

Introduction: Raspberry Pi Astro Cam

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.

Step 1: Remove the Lens From the Pi Cam

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.

Step 2: Cut and Paint the Case

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).

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

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.

Step 4: Connect the Cable and Snap the Camera Into Place

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.

Step 5: Attach a Display

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).

Step 6: Add a Secure Holder for the Raspberry Pi and Display Unit

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!

Step 7: The Software

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

Step 8: More Photos

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.

    Share

    Recommendations

    • Epilog Challenge 9

      Epilog Challenge 9
    • First Time Author Contest 2018

      First Time Author Contest 2018
    • Paper Contest 2018

      Paper Contest 2018
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    38 Comments

    I am trying to understand why your images of Mars look so degraded vs the one of the Moon? Is that really what it looked like on the screen? It looks very overexposed. Have you tried to reduce exposure?

    Mars is tiny compared to the moon. The images were processed to digitally enhance and bring out color patterns, otherwise it is just a fuzzy white dot when viewed with a small telescope.

    Awesome work Doc! I hope you test it on a larger scope and show us the image you get of Mars, Jupiter or Saturn.

    Great project! However, I'm confused about how this camera is used without an eyepiece. I have been able to run a Pi with the motion package, mount it with an adapter for a smartphone and stream pictures to my local network. In this setup, I'm using an eyepiece. If I use the camera without its lens and without an eyepiece, what is my magnification? Can you recommend some sites that explain these optics issues? I have an 6" Orion reflector.

    This is called "prime focus" astrophotography and it works because the lens you remove from the camera board is being replaced by the telescope.

    https://en.wikipedia.org/wiki/Astrophotography

    calculator below will calculate the prime focus magnification...

    http://www.astro.shoregalaxy.com/dslr_calc.htm

    Using his scope focal length of 400mm it would be 87x with the new raspi cam.

    To contrast I've got an etx125 at 1900mm and the old raspi camera, my magnification will be 414x once I finish building mine.

    That's a good question, the effective magnification. Very high, I know that. But the situation is different, because you can view the image at different sizes and distances, I'm not sure it even applies. I have not researched these issues.

    I am still confused on how this is used without an eyepiece, at least to produce images with any significant magnification. Think it would work to make a fitting out of the PVC tube you used that would fit OVER a chosen eyepiece rather than being inserted without one?

    This is called "prime focus" astrophotography and it works because the lens you remove from the camera board is being replaced by the telescope.

    Sorry, I thought I had responded earlier. I photographed the moon, lower magnification is fine. I'm sure you use it with an eyepiece as well, but the mechanical design would be different.

    I really never tried this. I was happy with the magnification I get with no eyepiece. There is enough resolution to magnify even a planet to a degree. I'd be interested to know how well it works with an eyepiece.