Raspberry Pi Outdoor/Security Camera Build Overview
Introduction
This project uses a lot of parts and some specialized tools. It is based on an evolving design, this being the 4th iteration. The links in the Materials section are for the exact items I ordered from Amazon and should work (unless they don’t have the part and drop you on some random piece of merchandise). This is an overview of the build steps, and not a detailed step-by-step guide. If you already have the skills, the information should be enough to recreate my success.
A note on parts: when building your first camera assorted sets of screws will get you what you need quickly, but if you build more than a few cameras you will be looking for supplies in bulk. Some links in the materials section go to assortments, some will show bulk items, but the goal it to show you what I used. Also, they are Amazon Associate links, so I will get something for the effort, if you use them to procure your supplies. (First time I have done this, but there is no additional cost to you, and I hear I don’t get much. But, hey, everything helps, but I don’t want you thinking I’m pulling one over on you driving you through those links.)
Materials
- STL Files
- 3D Printed enclosure parts (Amazon)
- cowl
- base
- camera wall
- lens cowl
- Threaded Female Brass Inserts (Amazon)
- M3 x 4mm x 5mm OD female threaded insert (x8)
- M2 x 6mm female threaded insert (x2)
- M2 x 4mm female threaded insert (x2)
- Standoffs
- Hex Socket Head Cap Screw
- M3 x 12mm (Amazon) (x4, fan screws)
- M3 x 4mm (x2, buck converter)
- LM2596 DC-DC Buck Converter Step Down Module Power Supply (3A) (Amazon)
- Raspberry Pi (Amazon)
- SD card (Amazon)
- Head sink set for RPi (Amazon)
- Prototype Breakout Breadboard (Amazon)
- 2N222 Transistor & 690 Ohm resistor (Amazon)
- Camera Module (Amazon)
- Microphone (Amazon)
- 12v to 5v buck converter (Amazon)
- Power Jack Socket 5.5 x 2.1mm (Amazon)
- 12v power supply (Amazon)
- Cooling Fan, 30mm x 30mm x 7mm (Amazon)
- Wire (Amazon)
Tools:
- soldering iron that is compatible with the tips below
- Heat-Set Insert Tips (Amazon)
Step 1: Design the Case
This might seem obvious, but you have to design the case before you can print it!
This is not a tutorial on 3D design, so I am not going to go deep into that part of the project, but it was a part of this project, as was learning a little circuit design and Ki-Cad. This is the 4th generation of this design, and the first I have made more than 1 of (I made a batch of 10). For the 3D modeling I used Shapr3D on older iPad Pro with an Apple pencil.
My goal was simply to set up a Raspberry Pi camera outside. I could not find anything I liked, so I created this. I will try and address various design considerations through the guide and provide enough information that someone with reasonable skill can duplicate my work. You can download a copy of the stl files here.
Step 2: Gather Materials
There are a lot of parts to this project, and I have found that it is easy to get to a step and not have something that you need, and then you get to the next step and don’t have something else. This is just one way that it can take a month to make a camera.
Nuts & Bolts
There are a lot of little nuts and bolts to this project, and it is a mix of sizes. I started out buying assortments of M2, M2.5, M3 and other size screws and nuts. This is a great way to prototype, or build one camera. Once you start building any number of these you will want to look for what you need in greater quantities.
Electronics
There are 3 circuits on the protoboard.
The first one is the power supply, and it DOES NOT incorporate the recommended power protection, yet. As long as you don’t plug in the 12v and USB-C power at the same time you will not have a problem.
The second circuit is fan control, and needs only a couple of parts; a 2N222 transistor and a 680 Ohm resistor. I learned how to set this up reading articles online, and if you are playing with Python it is a good time to get introduced to the gpiozero library if you are not already using it. Search for that and read about it and you can install it with apt or pip. Or, raspi-config supports a fan out-of-the-box. Find that setting buried under Advanced and pick the GPIO pin and temp to toggle the fan and you are all set.
The last circuit is really just a connector to the MEMS microphone breakout board, and all that is needed is some wire and a connector.
In addition to those parts you also need a 30mm x 7mm fan, an RPi, SD card and camera module.
The module here has a wide-angle lens, a mechanical IR cut-filter controlled by a light sensor, and it came with LED IR illuminators, which I also do not use here. I tried to use the illumination, but with the wide angle view it caused glare, and I have external IR floodlights to do the job instead. I also have a design for a narrower field-of-view lens (where the illuminators work without glare!).
Power
The design uses 12v power for 3 reasons.
The first reason is that it is the same as CCTV equipment uses, so it is simple to work with it alongside inexpensive IR illuminators and the such. If I am using 12v with a 2.5mm connector I can split the power and power both the Pi and lighting from a single power run.
Another reason is that plugging a USB power supply in to the board makes the footprint considerably larger. Even with a right-angle adapter it enlarges the footprint of the Pi by a bunch, with a bunch of dead space.
The last reason is that I do not want to run extension cords and put wall-warts all over outside. So, I am running power through a 12v low-voltage system commonly used for landscape ligning, like this one. Then, close to the camera, I use a rectifier to convert back to DC. Each one of these can power 2 Pi and 4 illuminators.
3D Print the Case Parts
The camera is designed with 4 parts. The cowl is the largest component, and depending on how it is printed, can take 11 to 5 hours. The base is the next largest part, and then the camera mounting wall and the lens cowl.
It is designed to print pretty easily, without overhangs that are too steep, or impossible parts. This photo is actually of an earlier version. If you look closely you will notice that there is no place to mount the microphone, and there is no scoop in the lens cowl to direct sound back to the mic.
Here is the new lens cowl design printed in both PLA (red) and PETG (grey):
You can see that the print quality of the PETG is not as good, and it came out stringy. Adjusting the print settings would probably get this to print OK, but I examined the design and the grade is greater than 35°, which is the point at which many printers recommend printing with support. (Which I tried, and ended up worse.)
Once you have the 3D printed parts, it is time to dress it up a bit.
Heat Press Threaded Inserts
Heat pressed brass threaded inserts add a nice flair to the project. For a prototype, or one-off, it may be a bit of overkill, but for tinkering it is nice to be able to assemble and disassemble your project. Creating 3d printed bollards that you can screw in to is no magic and, in fact, they are quite strong. But, if you cycle through assembling/disassembling your project more than once or twice the ‘hold’ will break down.
Brass threaded inserts create a nice touch, and, when inserted properly, create a platform that is nice to work with if you like to tinker.
A couple of other quick design notes; the bollards for the RPi standoffs are built-up that way because I have had problems with layer adhesion, and the whole bollard popping off the flat part of the print. The ones at the bottom of the picture, for the buck-converter, are shorter and haven’t delaminated yet. The ones for the fan are built into the too-complicated fan louvers.
I had the great idea of trying to keep bugs and water out by creating chevron shaped louvers. It turns out to be hard to print. It always works, as far as allowing air flow, but without perfect first layer adhesion it doesn’t look, well, perfect.
The original thought for the brass threaded inserts was to be able to use standard tripods, a few of which I had around. Tripods use a standard ¼”-20 thread. There are other ways to achieve the goal, but brass threads make sense from a usability perspective. And, they look cool.
Being able to use a standard tripod is a terrific convenience, especially if you already have some sitting around. Most of them are better than my simple bench stand, and inexpensive.
To insert the threads you need a compatible soldering iron and a specialized tip. You literally just heat it up and press it in, but as like everything else, it can be tricky. You will want to match temperatures to your material, and, especially with deep threads, the plastic can flow back up into the middle, which is a real hassle to fix.
In this image I have replaced the cam-wall with an updated version. When designing the camera I did not want to have to print large parts as I went through design iterations. I was able to add the microphone to the design by replacing the two smallest parts. The cam-wall also has mounting points for an HQ-cam board.
Step 3: Assembly
Mount the Camera & Microphone
The microphone is an Adafruit MEMS microphone breakout board that I chose because it has an I2S library to interface with the Raspberry Pi, and seemed like a good choice for adding sound to my camera.
A small wiring harness needs to be attached to the microphone so that we have a JST connector on one end.
I created a scoop in the housing to channel the sound back to the microphone, so there is a dimple in the front that lines up with the mic, and there are no threaded inserts here; the microphone screws in to plastic.
Also, the M2 standoffs may seem upside down to some people. You would think that you screw the PCB on to the ‘top’ with the screws. The M2 standoffs are 10mm with 3mm of threads. Not quite enough for a good grip if it goes through the printed plastic. So, the _bottom_ of the standoff is what is used to mount the camera board.
You can see the heads of the screws for the standoffs on the back side of the cam-wall in the picture above, below the microphone. The screws are a millimeter longer, and that makes all the difference.
The threaded portion of the M2 standoff is only 3mm, which is not enough for the print, but perfect for the camera board PCB.
You can also see how the camera is screwed in to the cam-wall. The 4mm M2.5 screws are a perfect fit, flush with the front surface. From the front you can also see the dimple for the microphone.
Seeing all of this camera stuff exposed is a good time to realize why that last part was made; the lens cowl. There is some stuff there you would not want exposed to the weather.
The microphone needs to be set up ahead of time. In my case I have both used the pins that came with the breakout board with a Dupont connector, and I have soldered my wiring harness directly to the microphone board which is shown in the pictures. I prefer soldering the wiring directly to the board because it is more compact.
Assemble the Base
The base includes the power connector, buck-converter, fan and standoffs.
The first thing to add is the power connector. Once it is attached (or before) leads need to be soldered on so that it can be connected to the buck-converter.
After attaching the leads I use the helping hands to hold the buck-converter upside down and I solder the connector leads (not shown). The output leads are also soldered to the buck-converter now (or it could have been done earlier).
Design note: the fan comes with Dupont connectors, the the Adafruit MEMS microphone breakout comes with pins that you can solder on, which will work with Dupont connectors, but where I can I like to use JST connectors instead, because the are somewhat more compact, and seem more secure.
In the picture below the long black connectors for the fan are an example of a Dupont connector, and the white connector going to the buck-converter output is a JST connector (XH 2.54mm, to be specific).
You will see where the connectors come in later.
The fan is mounted with the 12mm M3 screws, and the buck-converter with 4mm M3 screws. I prefer the black hex cap head screws, but any M3 screw (of the correct length) should work.
This is a good time to tune the output of the buck-converter. You will need to plug in a 12v power supply on one side (IN), and attach a multimeter to the OUT, measuring voltage. You will need to spin the little gold screw on the blue variable resistor until the output reaches 5.1v. It will start out at line voltage; i.e. 12v out, so DO NOT FORGET this step, or your Pi is toast.
Cam-wall & Standoffs
To complete the base we attach the cam-wall and install the standoffs that will mount the Raspberry Pi. In this design the front standoffs are used to hold the cam-wall in position. I have considered printing this piece of the design directly up from the base, but then it would not be changeable. In the case of my microphone upgrade, I would have had to print a much larger part for my upgrade. In the future it may become part of the base, but for now I will stick with the weird design. But why, then? Because without the cam-wall being attached it all flops apart when you are working with it, and you cannot do any work with it on the bench. It needs to be attached to be useful and the standoffs are a convenient way to anchor them in place, for now.
There is a slot behind the camera to route the CSI cable. Try not to forget to have this in place, but if you forget, feed it from the back and try to get it to bend down and come out the bottom.
Add the Pi
There are a couple of things to consider at this point.
First, there is a bit of a design flaw: in trying to keep the entire package compact, it is difficult to remove the SD card once the Pi is mounted in the case. It is best to have the card imaged and ready to go in the Pi before proceeding.
A note on standoff and hardware:
I have tried out a lot of parts and have discovered that I cannot use any of the plastic or nylon standoffs or screws. For one reason or another the heads pop off of the screws, rendering them less than useless, and now you typically have to toss a standoff.
Also, you are going to end up with all kinds of random extra stuff, but as much as possible I try to use up what I have. The standoffs, for instance, yield 4 M2.5 nuts for each build. Yay! Buy a box with cubbies, label them and save them for later.
Connect the camera CSI cable, and we are ready to move on.
Build the Protoshield
The purpose of the protoshield is to manage the connections to the GPIO and distribute power.
Power:
In the lower left corner you can see a vertical JST connector sitting on two horizontal rails. This is the power connection. What you cannot see is the silk screen in the back.
I placed it there so that it would not block the CSI cable passthrough, which I don’t use. It is too small, so I just pass the cable under the board. But, by using this rail, the board takes care of getting the 5v to the Pi.
Fan:
The fan is controlled by a 2N222 NPN transistor with a 680 Ohm resistor. In this view you can see a JST connector for the fan, which I do not use any more. The fans come with Dupont connectors and it seems like a waste not to just find a way to use them. On future versions you will see right-angle JST connectors.
Microphone:
There are two parts to setting up the microphone. Wiring it correctly and setting up and using the software.
Both of those topics are best covered here at Adafruits website, where they have a great writeup.
So, why this mic?
It uses I2S, is the answer. I2S is a standard for transporting audio data, so figuring out how to use this could translate to other hardware. This is a pretty simple microphone, and not entirely ideal for use in a security camera, but there are other more sophisticated I2S chips that have automatic gain control, amplification and other features and attach to an external microphone, which can offer additional benefits and options.
Once the protoshield is build you can install it on the GPIO, plug in all the connections and see if it starts up.
This is where a small tripod is helpful. With the power connector on the bottom you cannot just plug it in and sit it on a table.
Taking a step past a proto-board a little extra effort bore this:
Add the Lens Cowl
The lens is too large to pass through the opening, and enlarging the opening would expose the camera board to too much of the elements.
The next part you want to do quickly and in a dust free environment.
Unscrew the lens, put the cowl in place, and carefully screw the lens back in. Carefully; these are tiny threads and you could cross-thread and strip it.
With that in place all that is left is final assembly.
Final Assembly
There should only be 3 parts left on our list of items at this point.
2 M3 x 6mm screws and the big 3D printed cowl.
These screws are super tight, and I need to make some adjustments. There are several places, in fact, to make some adjustments and improvements. But, when you get to this stage, if the base does not slide back all the way sand down the edges of the base on the back. Sometimes the walls will look bowed out when looking from the bottom, if this is the case, sand some off the side edges of the base.
Wrap Up
At this point you should have a fully assembled Raspberry Pi camera sitting on your desk waiting for action.
[/fusion_text][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]
Share This Story!
Related articles
Subscribe to receive updates when new articles are published
* Add notice about your Privacy Policy here.