DIY body cam with a Raspberry Pi

Lead Image © Alexander Sidorov,


Make your own body cam with a Raspberry Pi, a cannibalized webcam, a WiFi module, and some Python.

The logistics of building your own body cam, capturing and securing the pictures, and networking to get the pictures someplace useful clearly calls for engineering a prototype. Fortunately, my particular niche is building physical computing gadgets and then writing and speaking about them.

Just like "citizen journalists" who take pictures with their cell phones, using a body cam in public poses certain challenges. People get nervous when they know a camera is clicking away. Being discrete, low key, and staying within the letter of the law is, of course, prudent. Moreover, it makes sense to move the pictures off the device as you shoot, because you never know when somebody might come up and try to take your camera away. Another concern might be exactly what components are readily available off the shelf that you can use to build the device.

A Regular Old Pi

The regular old Raspberry Pi (Rasp Pi) lends itself to this type of application, with its ample USB ports, GPIO pins, battery operation, and modest cost. Although the latest 8-megapixel (Mpx) Rasp Pi camera board is awesome and would give outstanding picture quality, it has one major drawback for this kind of project – that darned flat cable.

Being inconspicuous is important; I want to carry the Rasp Pi in a pocket or tucked away in my jacket while positioning the camera so it faces forward on my person. That wide, flat cable is just too obvious and cumbersome. I decided that adapting a USB solution made sense and also offers a choice of cameras. The thin USB cable is relatively easy to hide, too.

An 8GB microSD card has lots of room for pictures, although if you're going to push them onto the Internet, file space isn't much of an issue. Connectivity is also easy, with a simple plugin USB WiFi module, such as the miniature EDIMax device (Table 1). WiFi allows me to move the pictures off the Rasp Pi and onto the Internet quickly. Finally, all the components I chose can be sourced from vendors like Adafruit [1], SparkFun [2], Banggood [3], Amazon, or other vendors.

Setting Up The Rasp Pi To Take Pictures

I used a Raspberry Pi 2 Model B with a late version of Raspbian specifically built to accommodate the 3.5-inch color PiTFT display from Adafruit [4]. Using a 3.5-inch touchscreen lets you configure the WiFi using a standard desktop application and activate the Python picture-taking script from a terminal. I did all the development of the project over the network through SSH from an Asus notebook running Xubuntu. Writing the code and installing software is much easier on a notebook screen than a tiny TFT touchscreen. During development, I used a 5V, 2A wall wart.

The camera is a modded Logitech C270 USB webcam, a 3Mpx sensor that can also provide HD 720p video. I borrowed the camera from my Steampunk Presentation Machine (Figure 1) [5]; I will need to develop a much less obvious frame for this project, although this setup is fun to use when I do tech talks at conferences. The C270 also has an on-board microphone for capturing audio. Today, I'll only talk about capturing still pictures, but you are welcome to enhance the project to include video and perhaps adding a couple of additional push buttons to control recording functions.

Figure 1: The Logitech C270 webcam in its Presentation Machine configuration.

The PiTFT touchscreen display board has a standard 26-pin header on the back, so you have easy access for hooking devices up to the GPIO. On this prototype, I attached a push button to pin number 17. The Rasp Pi has built-in pull-up resistors [6], so you only need to enable them in your code. Building a voltage divider circuit to negate the effects of floating input isn't required.

Recycling used parts is a great way to reduce the cost of your projects, if they serve your needs. In this case, I salvaged an old 34-pin IDE hard-drive connector that was cut down to 26 pins (two rows of 13 pins) to mate to the traditional Raspberry Pi 1 header on the back of the display (Figure 2). To achieve this, grab an old IDE cable and pull the clamp off the back of one of the 34-pin connectors. Then, gently separate the ribbon cable to get a usable connector; you can use a pair of needle nose pliers to pull out a pair of unused pins and shorten the connector body (at the now vacant pin locations) with a little saw or Dremel tool. You can make any sized connector you need, while recycling old parts. If you don't have a "junk box" of old electronics parts, now is a good time to start recycling.

Figure 2: The traditional Rasp Pi header on the back of the PiTFT touchscreen display board.

The 22-gauge wires in solid-core CAT 5 cable are great for connecting things together. I used a pair of wires to connect push buttons to the 26-pin connector (Figure 3). Use a "third-hand" device [7] to steady the wires against the connector pins while soldering.

Figure 3: The modded connector and buttons.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content