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.

    Comments

    author
    johnzbesko (author)2016-11-13

    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.

    author
    sepeters228 (author)johnzbesko2017-05-26

    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.

    author

    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.

    author
    axdax14 (author)2017-02-28

    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?

    author
    sepeters228 (author)axdax142017-05-26

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

    author
    DrGarySullivan (author)axdax142017-03-24

    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.

    author
    DrGarySullivan (author)axdax142017-03-13

    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.

    author
    marcsulf (author)2016-10-20

    One correction. This camera is built from a Sony IMX219, which is a CMOS Image Sensor (CIS), not a CCD.

    author
    DrGarySullivan (author)marcsulf2016-10-21

    Thanks! Never heard of a CIS, I'll have to check into this.

    author
    marcsulf (author)DrGarySullivan2016-10-21

    You're not alone. Most people have no idea that the vast majority of image sensors on the market are CIS, not CCD. CIS leverages the standardized CMOS manufacturing process, which means that it is a lot less expensive to produce in mass production.

    author
    ChristopherG118 (author)marcsulf2016-10-21

    I remember about 15 or so years ago CCDs had issues staying on for long periods of times because the pixels/cells would spill over and make the images hazy. Is that an issue with CIS devices?

    author
    marcsulf (author)ChristopherG1182016-10-24

    It certainly can be. It is called "blooming" in the industry. There are a number of techniques ("anti-blooming", deep trench isolation, etc) to reduce this effect that are built into image sensors, but it is impossible to eliminate completely.

    author
    amelpx (author)2016-10-23

    Thank you for sharing! Great find on the micro SD case matching the pi camera board. I was trying to do something similar with my pi and noir camera, but I must say your solution is a much simpler approach than what i was trying. I was constructing a mount to go over the eyepiece, similar to holding a phone camera over it. I've seen some commercial products for mounting phones on telescopes, but at outrageous prices. Makes we wish I had access to a 3D printer.

    I've got all the parts already but for the epoxy... but I could try the 'ol super glue baking soda trick rather than wait for my next run to the store. I might also try connecting my AmScope (microscope camera) as well, but it has a much smaller diameter so I'll have to make a holder for that as well to work with the telescope. You made this look so simple; I'm going to abandon my other efforts for now and build this one since I have everything on hand and it it looks like it should be a quick build. Thanks so much! :)

    author
    senortres (author)2016-10-22

    It's still boggling my mind how much progress since the '90s was waiting for display and sensor tech advancement/accessibility. Great way to tap into it DIY-style, grats! Still new to the pi cam v2 here, but seems like FOV is still somewhat glued to resolution unfortunately...at least in the python API. Looks like you're compensating well w/the telescope's adjustable lenses though.

    author
    gitanojr (author)2016-10-21

    I'm sorry for my noobness but do you still need to have a telescope to do this??

    author
    DrGarySullivan (author)gitanojr2016-10-22

    The lens has been removed, so some kind of objective lens is needed. Any lens projecting an image will work. Telescopes are best for astrophotography, I'd like to experiment with a microscope as well.

    author
    nerd_at_work (author)2016-10-16

    Also favorited, bring on the long autumn evenings that otherwise be wasted with watching movies on tv.

    author

    What's TV? ;-)

    author

    It's an old system that was used to entertain people in the old day's ;-)

    author
    Mojo_JoJo (author)2016-10-19

    Awesome, I've been wanting to do this with my 130EQ for some time now. Did you use the regular cam or the noir version?

    author
    DrGarySullivan (author)Mojo_JoJo2016-10-21

    Regular version. But Noir would be fun to play with, I wonder how the images might change.

    author
    Dav_Photos (author)2016-10-20

    wonderful ! Add a 2nd RPi with cam and make it runs to autoguid the mount.

    I'm searching a lot of information to make it since a while but never find anything.

    author

    Yes, that's tough to find. I like DIY but was able to find a broken Meade ETX-80 for under $100 and fix it.

    author
    ChristopherG118 (author)2016-10-20

    Dr. Sullivan, this is fantastic, thank you so much for sharing this.

    Would it be possible for you to provide more information about the screen and batteries you used, perhaps part numbers or URLs? Thanks!

    author

    The batteries I used were purchased from 5 Below, which no longer carries them. Batteries are changing, I'd look for anything larger capacity so I don't need two. Check this out - Qualcomm Certified Quick Charge 3.0] Poweradd 20100mAh Portable Phone Charger Power Bank with LED Display (Amazon). The display is Elecrow HDMI Display Monitor 5 Inch HD 800x480 TFT LCD Display for Raspberry Pi 2B B+ Raspberry Pi 3B with Touch Screen.

    author

    I've built raspberry pi builds using battery banks to provide power. 10,000 mAh would be more than enough for a full night

    author
    kayakdiver (author)2016-10-20

    Nice job! Make sure your code doesn't start overwriting previous images in the case of a restart! Too many ways to do that easily, so I'll leave the solution up to you.

    author

    Yes, this is "toy" code just to try it out. I already shot myself in the foot with several times. I'd like to have an actual app for this.

    author
    bill2009 (author)2016-10-20

    this is great. Can I use the older camera module?

    author
    DrGarySullivan (author)bill20092016-10-21

    Probably so, but I never had the older model.

    author
    Being Engineers (author)2016-10-16

    Favorited! If you can provide a video on this, it will be a treat to watch! :D

    We really love such stuff.

    author

    Excellent suggestion! We teach kids to make videos, maybe we can get them to make one for us.

    author

    sure :)

    author
    DIY Hacks and How Tos (author)2016-10-15

    This is awesome! I love DIY astronomy tech.

    author

    Thanks! Amateur astronomy now has many possibilities that didn't exist before.

    About This Instructable

    34,422views

    300favorites

    License:

    Bio: Executive Director of ExplorTech, a 501(c)3 nonprofit serving rural school districts, families, and students who have limited access to technology education.
    More by DrGarySullivan:Educational Flex Sensor for Arduino or Raspberry PiQuick and Easy Solderless Electronic Connection Raspberry Pi Astro Cam
    Add instructable to: