Handheld Raspberry Pi Infra Red camera


Following the construction of my trailcam, I’ve created a new version that is also hand held.  The intention is to use it as a normal trailcam as before (leaving it in position and triggering the video / light via sensor), as well as using the IR lamp & camera to view wildlife in the dark via the screen.

Prototype , built in the modmypi packaging!

The main construction comprises of a 12v IR lamp from a security camera along with a pi noir camera and adafruit screen all controlled by a raspberry pi (model 2B). I’ve added a couple of buttons to control the light, video record etc for use in handheld mode with the pi controlling the functions in automatic / trailcam mode.

Front of camera

Raspberry pi

I’ve used a model B raspberry pi 2 for this project. Originally I’d hoped to use a zero with a pimoroni explorer pHAT however I had trouble getting the screen to work with the zero and the explorer so reverted back to my test system – the pi2. My main concern was battery life but it doesn’t seem to be too much of an issue.


Rear of camera

The screen is an adafruit 3.5″ pitft plus bought from pimoroni. This has a restive touch screen incorporated which can be used to operate some of the functions – I use a spare pointer from a Nintendo DS which is fairly accurate.


The buttons are connected to a board which is in turn connected to the pi gpio pins via the 26way ribbon cable at the back of the screen as well as from the pads on the screen.

The rear of the touchscreen

I’ve since moved the red wire in the pic above as it sat on, & made connection to the usb port on the pi B.

Board 1

There are quite a few gpio controlled functions so I’ve used 2 boards all linked together with with JST connectors. It is possible to shrink most of the connections down to a single, more compact board however I wanted it to be modular and by construction skills weren’t up to it.

Board 2


The lamp needs to be as bright as possible so I’ve had to use 12v. Rather than having 2 power sources as before (1 for the light and one for the pi) I’ve gone for a single source and used a step down power supply for the pi. I’ve used a batt borg power converter bought from modmypi and it is excellent, working flawlessly.

The power itself is supplied via 10 x 1.2v rechargeable batteries which last for quite some time. I’ve also fitted a socket for a power supply to be attached, for when I’m testing it and if it is deployed near a socket. A simple switch selects if it runs from batteries of power supply.


The light is a super cheap replacement board from a security camera. I’ve disabled the LDR using blutak so it could be used if necessary. There’s also a connection of the filter on the board – presumably it auto selects if the filter is required – I’ve not used this as I wanted the filter to be controlled by the pi.

light with filter inside

The light is controlled via a simple switch on the body of the camera as well as via a relay for use in trailcam mode. I bought a relay from an ebay seller as it was cheaper and easier than making my own. The supplier said that he’d imported some for himself but had a few spare to sell so  I don’t know if he’s got any left. Excellent seller, though and really quickly delivered and good item.

(I had experimented with making my own board but managed to kill a pizero in the process so went for the safer option)


The filter is pretty much the same as used previously and controlled by a motor controller chip on board 2.

I’ve described it in more detail on my previous post here: Trailcam 5 I.R. Filter.

Software & Code

I’ve once again opted for the excellent pikrellcam with its built in motion detection. This has worked very well on my previous trailcam and it works perfectly when used in manual record mode.

The pi boots up in kiosk mode and displays a modified version of the pikrellcam web page – I’ve altered it to change the size of the image and add the touch buttons at the side. If the main image is clicked it reverts back to the normal pikrellcam page giving access to the additional functionality and media storage.

The simplified web page

It is worth noting that the web page will be deleted if pikrelcam updates, so I’ve had to live without updates for the time being. If it should need updating I’ll copy back the modified page after the update.

EDIT: Billw has provided a solution for the issue here

Finally, a python script runs in the background which provides the functionality for the buttons, this is started in the same way as the kiosk mode and calls a separate piece of code to run the motion detection when the button is pressed – described here

I’ve put the code on a separate page here. I’m no programmer however it seems to work.

Start / stop python script from python


We took it out for a walk in the dark a week or so ago and the results were better than expected:

First test:

These were taken when it was in the cardboard box and held together with elastic bands. The light has been improved since then as well.

A montage of several situations:

It’s got a range of about 40m showing movement with 20m and less giving reasonable detail.

The danger of looking at a screen rather than concentrating on where you’re going:

I’ll post up some more videos when I’ve experimented a bit more – I’m desperate to see if I can video a hare in the nearby fields.

Main youtube:  https://www.youtube.com/channel/UCBhztnk1gHhY_zLZJRJL_Rw


There is some glare on the lens from the lamp. Currently I’ve got an old toilet roll holder inside the light, this needs to be made more permanent and increased in length.

It could do with a new box that’s a bit more suitable for leaving outside.

I’ve got some new buttons to replace the current ones. They’re waterproof so I can use them in conjunction with a new, more robust housing for prolonged trailcam usage.

Being left handed, I’ve built it to be easier to use with the left hand in terms of both button position and weight distribution. Right handed people seem to find this hugely difficult to use so perhaps I could modify it to be ambidextrous.

I’d like to further tweak the python coding as there are a couple of areas that I’m not too happy with. Ultimately it needs a good few workouts in both handheld and trailcam modes to see what needs work.


element manufacturer supplier link
Screen adafruit Pimoroni https://shop.pimoroni.com/products/pitft-plus-480×320-3-5-tft-touchscreen-for-raspberry-pi-pi-2-and-model-a-b
Proto boards adafruit modmypi https://www.modmypi.com/raspberry-pi/breakout-boards/adafruit/adafruit-perma-proto-half-sized-breadboard-pcb-3-pack/?limit=100
IR filter ebay  electronics_lee http://www.ebay.co.uk/usr/electronics_lee?_trksid=p2060353.m2749.l2754
IR lamp ebay xrst_511 http://www.ebay.co.uk/usr/xrst_511?_trksid=p2060353.m2749.l2754
Lamp relay ebay puretekuk http://www.ebay.co.uk/itm/272272819712?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
Power convertor – batt borg https://www.piborg.org/ modmypi https://www.modmypi.com/raspberry-pi/breakout-boards/piborg/piborg-battborg/?search=batt%20borg
JST connectors modmypi https://www.modmypi.com/search/?search=jst
buttons maplin maplin http://www.maplin.co.uk/p/250v-15a-square-push-to-make-switch-red-ff98g



10 thoughts on “Handheld Raspberry Pi Infra Red camera”

  1. May I ask which Pi2 B you have (cat /proc/cpuinfo) and the camera revision number ? I have a pi2 v1.1 a01041 (Sony, UK) and two v 1.3 cameras. Neither of the cameras work on the Pi2 but both work on my old Pi A. Same sd card,at first wheezy and then Jessie.There’s lots of misinformation on the net blaming the cameras but I think it’s the Pi variant.I’d love to get to the bottom of this mystery so trying to gather info.

    1. Hi David.
      I’ve taken a look at the hardware revision and it is the same as yours – pi2 V1.1, made in UK & hardware revision a01041
      Camera is a pi-noir V2.1
      While building this I swapped back to my old pi-noir a couple of times (a V1.3) by keeping the ribbon cable connected to the pi and changing the camera, and it was fine.
      It’s a long shot but have you done any experimenting with the ribbon connector cable on the pi2? It might have a fault or a bad connection.

      1. Thanks.It helps a lot to know that a 1.3 and a 1041 can work together.I’ll have to get some fine points on my meter and have a poke around.

  2. Thanks for the great writeup. One thing I notice from the “fall” video clip is that the camera lens appears to be focused very close, at least in IR mode. You may get a better image with some refocusing. Nice use of the IR filter switcher, I have a few of these but haven’t rigged up the drive circuit yet.

    1. Good idea with the focus, John.
      When putting this together there were a couple of things relating to the IR switch that I didn’t explore fully that may have made things easier- the IR lamps that I’ve used on this and another project both have a socket on them that I assume will trigger the filter from the onboard LDR, and a pimoroni explorer board looks like it has the facilities to connect up the filter to the motor controller to save having to put together the motor driver board.

    1. Hi Rich.

      Please feel free to use any image you fancy.
      I’ll check out the electromaker site to see about uploading.
      Thanks Gary

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.