A while ago I built a fairly basic Raspberry Pi project, to use as a motion detector that would look through my DSLR viewfinder and trigger the shutter accordingly. With respect to hardware (I'll talk about the software in a follow-up), thethreemain things I wanted to achieve were; good battery life, remote-controllability, and a compact size.
Good battery life is important for obvious reasons. It was fairly easily achieved using a spare DSLR battery as a power source, and switching to a Model A Pi instead of a Model B.
For remote-control, I playedaround with WiFi hotspots and similar things, but they ended up being too inconvenient or battery-consuming, so in the end settled for a bluetooth serial module which gave great results.
Making the entire setup compact was the main challenge, and the rest of the article is arun-through of how I managed to fit all the components inside a standard ModMyPi case. This particular size wasn't a hard and fast requirement, but I had the case handy and I thought it would make a good target size.
Above is the collection of parts I wanted to fit into the case, ideally with as little outside as possible (the camera being a necessary exception). Not pictured are a few snippets of insulated wire and metal pieces used to create and wire up the battery contacts. Laying them inside the case, unconnected, I was able to eventually find a way where everything should (theoretically) fit. It required some stripping-down of parts, and as you may notice, I've removed almost every unnecessary connection from the Pi itself.
Here you can see the positions I settled on for each component. Next comesactually connecting everything together. The first part I attached was the bluetooth serial module, stripped down to be as thin as possible, and wired to the GPIO pins using some fine copper wire. I chose to place it underneath the Pi, since there was enough of a gap between it and the lower section of the case, and space on the other side was tight enough as it was.
Next I madesome battery contacts and sticking them in place.
I bent some small pieces of metal to fit into the contacts of the Canon battery, and soldered on some relatively thick wire to make sure there was a solidconnection to the DC-DC regulator. I hot-glued them in place behind the camera connector, and on top of a small square of perspex. I also made sure to cover any components around it with electrical tape, to ensure there was no accidental contact (especially since the Pi would react particularly poorlyto the 7.4V of the battery).
Next the DC-DC regulator could beput in place. The input ends are soldered to the battery contacts (the switch attached now too, whichcan be seen in the top right), and the outputs run along the side of the case to connect to the +5V and GND GPIO pins. This does bypass the standard input circuitryof the Pi, but the output from the DC-DC regulator seemsvery stable and so it shouldn't be an issue.
I want to use this for remote-controlling a DSLR, both using motion detection and manually, so at this stage I need to implement some way of triggering the camera using the GPIO pins. I didn't want to permanently attach a camera-trigger cable, as it would add unnecessary bulk for the times where it doesn't need to be attached. So I settled on using a micro-usb jack as an easy way of connecting and disconnecting the camera cable. The trigger itself is easy, it just uses a 2N3904 transistor wired to a GPIO pin which opens and closes it, triggering the camera.
I had some space above the single usb port, as the case I'm using also fits the Model B, and so placed the camera connector there. I'm aware that this isn'tnecessarily the safest choice of connector to use, since plugging in 5V USB power to it would probably fry the transistor, but since I'll be the only person using it, I'm happy enough that it's virtually impossible for me to confuse itfor a power socket.
Almost done! As you can see by the lead photo, I decided to mount the camera on the front of the case. So now all that had to be done was attaching it and running the cable through the case and connecting it. Mounting the camera was very straightforward, using some hot glue and a small piece of perspex backing. Since taking these photos I've also covered around the camera with hot glue to protect the connector. I'd toyed with a plastic surround, but settled on the glue to reduce bulk.
The final state inside of the case. I've added an LED to use as a status indicator when needed.
On the software side, I'm using Motion-MMAL for motion detection, which then runs a short Python script and triggers the camera. The Pi runs a python script at boot, which lets me select from a few predefined options using my phone via bluetooth (motion detection, time lapse mode, etc.). I'll do a follow-up post soon that details it a bit more about the software, power draw, and shows a couple of changes I've made to the hardware since building this!