Raspberry Pi Astro Cam

61K35855

Intro: 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.

    50 Comments

    Hi
    excelent tutorial. I do like it.
    I‘ve made a 3D printer project that match to your work.
    benefit is: works with less backfokus and it provide a passive chip cooling, that enhances the image quality on longtime exposures remarkable.

    https://www.thingiverse.com/thing:3904600
    Nice device there, but when trying to slice with the Ultimaker Cura, it gives an error about the opening at the bottom of the main body. I went ahead and sliced n printed it out. It fills the hole in, but I guess I can drill it out.
    Those SD card cases like that are now a rarity. Any ideas on where to get that same style?
    I'm not sure about putting the lens back on, it's been a long time! As for the little cases, I think the SD cards I buy at Microcenter are all still in those, not 100% sure. At the store, they are in little bins by the cash register, and it seems like I recently bought some like that.
    I was thinking, instead of a SD card holder, there are 3D printable cases just for the camera on Thingiverse. Could probably integrate a 1.25 inch cylinder into it also.

    Even easier, I see for the Pi Camera HQ, it has a C base, and there is an adapter on Thingiverse which screws into that base, and sticks into the lens hole.

    Hi, i know this is an old thread but I was wondering if the original lens of the camera could be put back on. cheers!

    Not only you can put the lens back on, but there are lens kits which are sold to put different types of lenses on it. Wade angle, telescoping, etc.
    Neat project.
    I recently picked up a scope that was being thrown out because the secondary mirror was missing, cost about as much as a new scope. It had hand controller and a 6" reflector.
    So figured I could try the same thing by put a camera element at the primary focus in front of the scope and see what it would capture.
    I'm using the recent 12MPixel PiCamera and the eLinux.org RPi-Cam-web-interface.
    I did a quick prof by hand holding the camera to the scope and in dim light it works pretty well.
    Just waiting on the 3d printer to finish the mounting hardware and a clear night.
    Thanks for the inspiration. Hope your project is still going well.

    Hi Garry. I've build a similar camera, but get ugly purplish vignetting around the border due to a "lense shading correction" of the camera software. Your pictures don't show this effect, so I'm wondering how you overcame this. Any tips? Thank you!
    Ther is an auto chromatic aberatipn correcture in the still software, this have to be switched off by firmware update or on some deliveries the lense shading correture is already possible to be disabled
    And by the way, great instructable!! :)

    I finally got my camera hooked up to my scope yesterday. I was able to get a clear image in daylight but when i tried to capture jupiter I just had a black screen. Are you doing anything to set the camera controls - iso, exposure time etc?

    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.

    More Comments