The simplest option for enclosing the project is a small cardboard box. Cut a hole for the camera or tape it to the exterior of the box and feed the cable inside to the Raspberry Pi. If you're using infrared LEDs poke holes in the box and push the LEDs through them. It might not be the prettiest enclosure but it will hold the Pi and camera.
You can build a great 3D printed enclosure with an adjustable camera holder by combining parts from a few excellent projects on Thingiverse. You'll want to print the following parts:
- Raspberry Pi 2/B+ case with VESA mounts and more
- Raspberry Pi Camera Case Back for 6x 5mm LEDS
- Raspberry Pi camera additional parts - You only need the CameraFrontBottom-fingers.stl and fingerclip.stl files from this project. Note that this camera front can hold most wide-angle lens adapters with a little filing to ensure a snug press fit.
- Raspberry Pi Camera Mount with Ball Joint for Reprap - You only need to print two copies of the link.stl file from this project.
You'll need a few screws to assemble the parts too:
- 4x 4-40 size 3/4" long screws for the Pi case.
- 4x 4-40 size 1/4" long screws for mounting the Pi in the case.
- 2x M3-50 size 12mm or longer screws and nuts for the camera holder.
Check the project pages above for more details on printing and assembling the parts. The parts printed without issue for me on a Printrbot Simple Metal 3D printer using PLA filament. Some filing was necessary to adjust the tolerances and make the camera case parts snap together.
If you're using the Pi NoIR filter camera you can add infrared LEDs to provide illumination in the dark. I recommend six high-powered IR LEDs placed around the camera. These are just enough LEDs to provide illumination yet still be powered directly from the Raspberry Pi.
You'll need to solder the LEDs into two parallel sets of three LEDs that are in series like the diagram below:
For each set of LEDs a 24 ohm 1/4 watt resistor will limit the current to around 50mA each (for a total of 100mA, roughly the limit for how much current you want to pull from a Raspberry Pi 5V power line). You can substitute a larger value resistor but the LEDs will be dimmer. Don't leave out or use smaller value resistors or else you might damage your Pi!
Be extra careful to make sure you wire the LEDs with the correct polarity so they light as expected. The longer leg of each LED is the anode and is represented by the leg with a crooked/slanted section in the diagram. The shorter leg is the cathode. Make sure to connect the anodes and cathodes of LEDs exactly as shown!
The easiest way to solder the LEDs and resistors is with point-to-point connections. You probably don't need any wires and can just tie the LED legs to each other and solder the connections, then trim with a flush cutter. For example see the wiring below:
The top row with the red wire is connected to the Pi's 5V output (pin 2) and the bottom row with the black wire is connected to a Pi ground pin (pin 6). Use a Pi cobbler and breadboard or female connector wires to connect to the Pi pins. See this Pi GPIO pin diagram if you are unsure exactly which pins are 5V and ground.