This Instructable will help you build an adapter that allows you to make use of those old, film-based SLR camera lenses you have gathering dust in your basement. It also allows you to take pictures in an automated way (think time lapse, security or what I had in mind, a camera for entry level astrophotography). Gather up the following (many will have these laying around the house):
1) A working Raspberry Pi (you can choose the model you want, I had the RPI 2 model B, but I suspect you can use any model
2) RPI camera V2 (you might be able to use the V1, but I like the quality and features of the version 2). I picked the NOIR camera because I didn't want to filter out infrared on my astrophotography.
3) keyboard, monitor and power for the RPI. Google it. I would recommend an HDMI monitor, but I can understand using others.
4) An old camera lens. In my case, I used an old Olympus lens. The important thing is to have the REAR lens cap. But even if you don't have that lens cap, you should be able to find one at a local camera shop for pretty cheap.
5) A trap adapter - 1.5" (see picture) this is available at the local hardware store for a buck and some change. It includes two parts. If the one you find is too expensive, get the next size down. You might have to improvise some of the assembly though.
6) An old tripod that you don't use very often (don't worry, I won't cut it up).
7) Tiny plastic screws (x4) that fit the RPI Camera and nuts to match. My electronic store had these, but they might have them at a hardware store. If you have to use metal ones, you might want to put some electrical tape around them (pretty cozy, though). During experimentation, i used insulated wire.
8) A laundry detergent cap. I picked one that the plumbing part fits inside. I think you could also use a kitty litter cap.
9) A handful of zip-ties.
Step 1: Begin Prep Work - Drill Out the Lens Cap
Take the BACK lens cap and drill a hole into it. DO NOT HOLD THE CAP WITH YOUR HANDS WHILE DRILLING. At a minimum, use pliers. In my case, I drilled it out with a quarter inch drill bit and reamed it out further. It isn't terribly critical that it be super exactly centered and a huge hole, but try to be decent about it. Standard warnings - use the proper tools, use safety glasses, lock down the part (semi-gently) in a vise before drilling. The plastic can get hot when drilling.
Step 2: Cut the Pipe
Take the two plumbing parts (AKA trap adapter) apart. Just unscrew them. This is a bit imprecise, but I cut off about 3/8" off on the unthreaded side of the larger of the two pieces. Your lens may vary, but hey, the part cost a buck, so take a chance! In the picture, there is the lens cap back (black) and the cut piece (white).
Step 3: Glue the Cap and the Pipe
I was lucky that the cap had a little detent and was able to lock right in with the pipe. I used super-glue. Standard warnings: use safety glasses, don't stick your finger to the pipe, use a lot of napkins. I put a weight on it and let it sit over night.
Step 4: Remove the Lens From the RPI Camera. Cut the Laundry Cap Down and Drill Holes in It for the Camera. Glue the Threaded Ring to It.
OK, I could have done a few pictures here, but take a pair of needle nose pliers, unscrew the little black lens in the middle of the RPI camera. Your SLR camera lens will take the place of this cheap-o lens. You don't have to keep that lens unless you don't think this will work. Next, take an old laundry cap, cut it down to about 1/4 inch. Might want to rinse it off a zillion times and dry it off. Mark the holes from the RPI camera on the laundry cap so that the sensor will be centered. Drill it out to match the little plastic screws and put it together. Next, glue that plastic ring that you unscrewed from the plumbing part (trap adapter). The white ring is not shown in this picture...but you can see it in later pictures.
Step 5: Assemble
Thread the ring/camera/laundry-soap-cap assembly onto the pipe/lens-cap. The threaded ring can give you a coarse adjustment of focus. If I was smart, I would have put some plumber's tape in there to make it lock in a bit more. Then take the whole assembly and use zip ties to fasten it to a tripod. I'm sure a clever person could come up with a way to put a quarter / twenty nut on there to make it easily removed, but I was too anxious to check it out at this point.
Step 6: Fine Tune It / Start Taking Pictures!
Put your old camera lens on the whole assmebly. Again, plumbers teflon tape might be useful. Start out with an easy target. There is some built-in magnification by my simplified design, so aiming can be a bit hard. I chose a Christmas tree, but it is up to you. I would not start out with the moon. The focus on your lens should be kind of close, but on mine, the 6 foot setting on the lens turned out to be pretty close to the infinity setting in real life. Also, I would start out using the raspivid command so that you have the image up there for a while:
raspivid -t 95000 -o myfilename9999.vid
I gave it a name with lots of 9's so that I could shoot over and over and the next shot, you delete one of the 9's. Most likely, the image will be upside-down and backwards. I suspect there is a parameter to reverse that out...never really looked it up. Once you get a feel, you can attach a piece of tape in a tab shape to the back and another to the middle of the lens to have a make-shift sight for aiming. You can see an attached sample picture of the moon (and a cropped version for detail) that I took. I used the following command to shoot it:
raspistill -ss 7600 -ISO 199 -o s7600iso199moon99999.jpg
The ss option tells it how long to keep the shutter open in milliseconds and the ISO is the "film speed" equivalent in the camera. A lower number is supposed to be better quality, but a higher number is better sensitivity. You can play with both of these. I went ahead and put these settings in the file name as well as the subject to basically take notes with the file name.
This is where the experimenter can go crazy. If you want to take pictures of stars, you will obviously need more milliseconds in the shutter setting. You will see the limits of the sensor on longer shots. Likewise if taking zoomed in pictures of the stars with long exposures, you will likely see the smear of the rotation of the earth. Bump up your ISO and drop your shutter to address this. Read up on the parameters of raspistill and knock yourself out. I suspect that default color balance is not what you want, but that is left to the experimenter to find out. I plan to publish another Instructable to show how to make a solar filter that will work with this or any camera, so stay tuned.