Update: If you like my instructable please vote for me in the Raspberry Pi and Epilog challenge. I will also update the 5th step to include how I setup Motion on the first boot. Thank you for your clicks and thank you Instructable.com for the feature!!
In this Instructable we are going to design and 3D print a camera housing body for a raspberry pi and rpi compatible camera. To make it all work we will load and setup motionPie. motionPie is an opensource project written and curated by Calin Crisen. This is a very impressive program that allows you many options in setup. The details for setup are taken care of for you and you will have a great multi-node security system with distributed processing and storage. Plus they have Raspberry Pi's so you can still do other things like airplay, emulator or any number of concurrent activities. We will only be discussing the setup of motionPie and the printing of a camera body.
Our unique aspect of this project is the design and printing of the camera body. This is an exercise in creating a cleaner design that would be recognizable by most people as a product that can be purchased in any consumer electronics store. Most projects I have seen involving the Raspberry Pi as a camera utilize a dummy camera body. I readily admit that a dummy camera shell is probably a cheaper and more efficient way of going about his project. Disadvantages to that approach is that you still need to somehow mount the RPi and of course route the wiring, sometimes requiring 3D printed internal mounts anyways. When we design our own we can ensure a snug proper fit, and we can add other feature or different shapes and sizes for different purposes. The last page of this Instructable we will explore some of our future options and upgrades.
Step 1: Non 3D Printed Parts to Complete This Project
In this project we are going to utilize some M3 hardware, an RPI, its accessories, and a few 3D printed Parts. We will discuss the 3D printed parts in the next step. Here is a list of the non 3D printed parts that we will need.
(1) Raspberry Pi Model B
(1) Sainsmart NOIR with flat cable for Raspberry Pi
(1) Edimax Wifi adapter
(1) 5V 2A Powersupply with Micro USB plug
(1) Ethernet cable (temporary for initial setup)
(15) M3 x 8mm Buttonhead Socketcap Screws
(1) M3 x 20mm Socket Cap Screw
(1) M4 x 20mm Socket Cap Screw
(3) 1 5/8" Deck Screws
(1) 1 1/2" (38mm) Clear Acrylic disk (lens)
Of course you will need a few handtools for this build as well but I will leave that up to you.
Step 2: Designing Parts for 3D Printing
In the above link you will go to my thingiverse page and be able to download the files to 3D print this object. If you do not have a 3D Printer you can go to 3D Hubs and order from my hub or from a hub closer to you. I will give the actual instructions for 3D printing on the next step. This step is more of a discussion of designing parts for additive manufacturing while adhering to industrial design principals
The pictures for this step are 3 of the 8 pieces that are required to build this camera housing. I wanted to show what I am starting to do in my designs to look more and more commercial. The goal is to create an item that is virtually indistinguishable in quality and appearance, from an item that can be purchased on the market.
The disc shaped piece is the inner camera cone and recess to hold the 38mm acrylic protective lens. On the side we can see in the rendering, we also see the screw hole supports and fitted recess for the actual camera board. Adding these make for a strong piece but also shelling out the design also makes for a lighter piece that looks like a piece that came from a factory. Lighter pieces also translate into less filament used and faster printing times.
The second piece is actually the bottom mount of the entire camera cylinder housing. It is an exterior finished piece as well as structural. To make a piece strong and attractive we fillet (curve) the edges especially perpendicular support pieces. This smooths everything but also provides base support to cross connected pieces. Finally we recess our screw locations and we use stainless steel button head screws. The screw heads are exposed so these will not rust and they are also attractive since the head is rounded.
Our final example is the main housing. it is printed without supports and is strong and has integrated hardware locations to secure everything in place. The Raspberry Pi is secured to its own mounting posts and the wires are all routed through a specific channel to keep them secure, dry, neat and out of the way. We will see more examples in the printing and assembly steps.
Step 3: 3D Printing Instructions
I will try to be clear and concise in these instructions to help you have a successful print the first time. I have placed the pictures in the top bar in the order of the download on the Thingiverse page. I will also have the instructions and names in that order in this step. It is not required to print in this order. In fact, I printed the V1_AV_CAM_ Bottom.stl first and the V1_AV_CAM_Mount.stl second. This let me get my electronics in place first. Most of the parts are unsupported but they are all easy to remove the support from if you follow these instructions. Thank you for following along with my Instructable this far.
V1_AV_CAM_Lens_Mount.stl Print with 5 bottom and 5 Top layers, 3 layers, 20% infill. This should actually print the piece solid. It is only 2mm tall. NO support is required.
V1_AV_CAM_ Top.stl This is the tallest piece at 175mm. If your printer can not print this tall you may have to lay the piece down and print with supports. If you can print as it sits it does not require supports and only needs a 5mm Brim. 3 shells, 3 layers top and bottom and 20% infill.
V1_AV_CAM_Mount.stl This piece needs support with 5mm spacing. there will be a small amount of support under the actual camera board mount edges that is hard to get to. It is not necessary to remove this material. This mount is for the sainsmart noir camera. It does not fit the raspicam board. I will probably make a piece for it later.
V1_AV_CAM_Back.stl The back is printed as it sits. it does need support at 5mm. A 5mm brim is also helpful with this piece. 3 shells 3layers top and bottom 20% infill.
V1_AV_CAM_Bottom.stl This is the main piece that all the others are built around. I printed it first myself. It does not need supports or brim. just 3 shells 5 layers top and bottom 20% infill.
The final 3 pieces are for the wall mount. They are printed at 3 layers 3 shells and 20% infill
V1_AV_CAM_Base_Mount.stl requires a 5mm raft and 5mm spaces support. The other two pieces are unsupported but with a 5mm brim.
Step 4: Assembling the 3D Printed Parts
Assembling the Camera is straight forward. I will go through a few tips but it should be fairly self explanatory from the pictures and the rendering. Depending on how setup your 3D printer is you should get pretty clean parts. you might take a 1/8 inch drill or 2.5 mm drill with a pinvise and ream out the screw holes. There is a little material removal from the support and the brim will have to be cut away and the edges cleaned up with a needle file. This is up to the user how much or how little is required. All the parts should fit smoothly when complete.
First mount the Raspberry Pi and then attach the camera to the pi.
Second take the cam mount and place the board in the back. I used a touch of hot glue in each corner to secure the camera. There are two screw holes at the front open end of the part with the Raspberry PI. they fit in the side of the cam mount part.
Now that those two parts and the electronics are secure we can place the 38mm acrylic lens in the front of the cam mount. Then take the lens mount and secure it to the front with four m3 screws.
go ahead and run the power cord to the raspberry pi through the bottom channel of the raspberry pi mount piece and plug it into the raspberry pi. do not have the cord plugged into power.
We will leave the top and back off for now because we still flash the image and get the RPI setup
Next screw the base mount on the bottom of the camera with 4 m3 screws. then take the mount post and use the only m4 screw and mount it to the camera base mount.
Finally take the wall mount and use the m3 x 20 mm screw and screw it to the base post. This should complete assembly of the camera mount itself. We will mount it after we get our software ready.
Step 5: Flashing Motion and Setting Up the Camera
Download the RPI Image from here
Here are the best set of setup instructions for the software
If we are going to use the wifi adapter then it is best to go ahead and set flash the image and get the software running before you mount it on the wall. If you are not going to use the wifi and use the ethernet connection instead. Then go ahead and plug in the ethernet cord. run the power and ethernet to the bottom of the camera housing and place the back and top on the camera and close them up.
if you are going to use the wifi then plug in the wifi and follow the set up instructions to get that setup before you unplug the ethernet and then place the top and back in place.
Step 6: Mounting the Camera in Your Chosen Location
I am using this camera in a location to see the only entrance into my place. I will have several setup in other places but we will add that later. The camera mount has to be placed on a vertical surface I chose a wall to my lab by the overhand. This let me drill near the over hang to pass the wires through. A half inch hole should be sufficient and can easily be filled with insulation foam. I am using 1 5/8 inch deck screws to secure to the wall. These are weatherproof and fit the countersink I designed into the mount. Plug in the camera and ethernet if you are using ethernet and follow the setup instructions from the previous page to access the camera feed.
in the future I will be adding cameras, and several other capabilities. I will add some that have IR lights, servos for pan and tilt. I would also like to add motion tracking, facial recognition, and some other fun capabilities as the project and time allows. I hope this helps you to setup your own smart camera security system that you can 3D print in your own shop.