Category Archives: featured

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.

Screen

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.

Buttons

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

Power

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.

Light

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)

Filter

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.

Links:
kiosk
https://github.com/elalemanyo/raspberry-pi-kiosk-screen
Pikrellcam
http://billw2.github.io/pikrellcam/pikrellcam.html
Start / stop python script from python
http://stackoverflow.com/questions/3054740/terminate-a-python-script-from-another-python-script

Results

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

Improvements

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.

Supplies

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

 

Gallery

Elite dangerous controller

Whilst ordering some new arts for a couple of projects, I came across the zero delay arcade by Reyann.

board

It is intended for raspberry pi etc. controls for creating arcade consoles and appears to be USB plug and play so I thought I’d give it a go and make some additional controls for elite:dangerous.

dscn4619

This prototype has been lovingly crafted for the cardboard box that my delivery arrived in. No setup required and it just plugged in and worked.

The kit comes with the wiring loom and usb cable so it’s just a case of slipping the buttons on to the wires and off you go. It connects perfectly with the arcade buttons but not so well with the smaller tactile ones which required some structural blu-tak – a couple of mins soldering would fix it but these buttons are only temporary.

dscn4610

Windows sees it as a generic controller and E:D responds in a similar way, so there is no issue in assigning the buttons to the massive list of controls available (copy and save your key binds though. They’re very fickle).

The arcade buttons themselves are made by Sanwa and are spot on arcade quality – you can roll your finger on them like a real arcade machine and they feel like they could go on forever.

The joystick too is a Sanwa item and just oozes quality.

The larger buttons are (I think) from Adafruit. They are a bit more clicky than the arcade ones but very tactile. The 100mm HAL special in the middle is impossible not to touch and brings out the father dougal in everyone.

lit

They also light up, I’ve not tried this yet but it looks to be pretty straightforward and some of the online pictures make them look very effective (e.g. the HAL 9000 replica on adafruit )

dscn4616

For a prototype it works perfectly and the next step is to work on the case and assemble the required buttons. This was pretty much thrown together to see if the board worked however having played for a bit today the HAL9000 / pacman mashup has really grown on me so I think I’ll keep it!

dscn4617

In summary:

Controller board

By Reyann. mod my pi link: https://www.modmypi.com/raspberry-pi/arcade/arcade-controllers/zero-delay-arcade-usb-encoder-and-wire-set/?search=arcade

Arcade buttons

 By Sanwa – mod my pi link : https://www.modmypi.com/raspberry-pi/arcade/arcade-buttons/official-sanwa-arcade-button-black/?search=sanwa%20arcade%20buttons

Arcade stick

By Sanwa Mod my i link : https://www.modmypi.com/raspberry-pi/arcade/arcade-joysticks/official-sanwa-8-way-arcade-joystick-jlf-tp-8yt/?search=sanwa

Illuminated buttons.

By Adafruit. Mod my pi link : https://www.modmypi.com/electronics/buttons-and-switches/massive-arcade-button-100mm-red/?search=arcade%20buttons

Trailcam – 1. Introduction

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

 

Camera in window cill mode
Camera in window cill mode

Description

The intention is to create an animal camera to video the wildlife of the garden and the window cill bird feeder. The idea is that the camera could be used outside (night or day) powered by battery then be moved indoors to the window cill to record the bird feeder where it can be powered by mains.

Previous versions

This is the 3rd version of the animalcam / trailcam with the older versions showing the progression and further useful information. Previous versions can be found here:

Version 2

Version 1 

General construction

To create this I’ve used a raspberry pi A,* powered by battery (which can be disconnected when connected to the mains) along with a pi noIR camera that has a moveable IR filter to give reasonable colour in the day and respond to IR light in the dark.

*: now using a pi zero – see here

The trailcam comprises of a main breakout board with the other elements attached separately – this helped me to construct the project in sections and allows for a level of upgrade later on. I ran in to issues on the previous version where the female to female jumpers kept coming off, resulting in a bunch of wires that I had no idea where they went, so this time I’ve soldered on JST connectors and colour coded them.

inside the camera

Overall concept:

In its current form, the trailcam simply uses pikrellcam to record video when it detects motion.  In the dark, a PIR sensor is activated which turns on an I.R. lamp, pikrellcam then records the motion event as if it were daylight. A switchable I.R. filter is fitted to the camera which enables good quality day time video and I.R. sensitive night time video.

The facility for bypassing the software motion detection is built in so that the recording of video can be triggered by the PIR if required.

Useful links:

I’ve cobbled this together using the how-to’s, programs, diagrams and general knowledge of some very clever and generous people that have taken the time to make their information public knowledge online. Despite my limited skill level it actually works!

The following are the main personal blogs and websites that I’ve used for help. In addition, the suppliers as noted in section 7 have really useful websites and blogs to go with their products.

South Somerset Weather

This was the original inspiration and also has some great videos.

http://www.afraidofsunlight.co.uk/weather/index.php?page=trailcam

 

Pikrellcam

The motion detection software used for this trailcam

http://billw2.github.io/pikrellcam/pikrellcam.html

 

Envatotuts+

Description, diagrams and python prog to control the L293D chip that operates the IR filter

http://computers.tutsplus.com/tutorials/controlling-dc-motors-using-python-with-a-raspberry-pi–cms-20051

 

Trevor Appleton

Handy guide for explaining cron

http://trevorappleton.blogspot.co.uk/2014/06/scheduling-python-programs-using-cron.html

 

Raspberry pi spy

Lots of useful tutorials

http://www.raspberrypi-spy.co.uk/

 

This description has been split down in to the following sections:

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list

Trailcam – 3. PIR sensor

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

 

Description

The PIR sensor is a pretty standard piece of kit – I got mine from Tandy however they’re really common and stocked by the usual suspects (adafruit, pimoroni, Modmypi,maplin)

In the first version I had the PIR sensor triggering the recording however for this version I’ve altered it so that it just turns the IR lamp on leaving the motion detection in the software to do its thing..

Install

Camera in window cill mode
PIR at bottom of trailcam

I had hoped that the PIR would “see” through the plastic on the box however it wasn’t happening so I ended up removing the defractor / lens, drilling a hole through the box to push the sensor through then stick the lens on the outside. It does increase the chance of letting water through however there isn’t really much choice and a big chunk of gaffer tape should sort it out.

PIR
Dismantled PIR sensor (main). I cut a hole and pushed the sensor section through it, then fixed the diffuser on the outside (insert)

Control programme

I modified the control program from raspberry pi spy to run the previous version of the trail cam however this version only needs to turn the light on an off, hence why it is a bit of a mess.

EDIT: Revised version here

#!/usr/bin/python
# Original
# By : Raspberry Pi Spy
# Author : Matt Hawkins
# Date : 21/01/2013
# Modification
# By : G
# Date : 24/04/2016


# Import required Python libraries
import RPi.GPIO as GPIO
import time
import subprocess

# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)

# Define PIR GPIO to use on Pi
GPIO_PIR = 22

print "PIR Running (CTRL-C to exit)"

# Set PIR pin as input
GPIO.setup(GPIO_PIR,GPIO.IN) # Echo

Current_State = 0
Previous_State = 0

# Define GPIO for lamp control
GPIO_LIGHT_ON = 17

# Set lamp on GPIO as output
GPIO.setup(GPIO_LIGHT_ON,GPIO.OUT) # Echo

try:

 print "Waiting for PIR to settle ..."

 # Loop until PIR output is 0
 while GPIO.input(GPIO_PIR)==1:
 Current_State = 0 

 print " Ready" 
 
 # Loop until users quits with CTRL-C
 while True :
 
 # Read PIR state
 Current_State = GPIO.input(GPIO_PIR)
 if Current_State==1 and Previous_State==0:
 # PIR is triggered
 print " Motion detected!"
 GPIO.output (GPIO_LIGHT_ON,1)
 print " Light on"
 # Capture a 5 second video
 # print " Record start"
 time.sleep(20)
 # Record previous state
 Previous_State=1
 elif Current_State==0 and Previous_State==1:
 # PIR has returned to ready state
 GPIO.output (GPIO_LIGHT_ON,0) 
 print " Light off" 
 print " Ready"
 Previous_State=0
 
 # Wait for 10 milliseconds
 time.sleep(0.01) 
 
except KeyboardInterrupt:
 print " Quit" 
 GPIO.output (GPIO_LIGHT_ON,0)
 # Reset GPIO settings
 GPIO.cleanup()

Trailcam – 4. I.R. Lamp

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

 

Description

The IR lamp is a kit from Maplin. I’d priced up getting the LED’s individually and putting them on to a bit of veroboard and the kit worked out much cheaper.

inside front of camera
from top to bottom: I.R. lamp, camera and I.R. filter and P.I.R. lamp, as seen from the inside of the front section of the trailcam.

It is designed to be 12v but it works satisfactorily with a 9v source. I have bought another of the kits when they were on special offer so I may end up swapping out the resistors to make it truly 9v.

light
12v I.R. lamp kit from Maplin (My spare one)

Powering the lamp

I wanted the lamp to be powered separately from the PI, initially because it is much easier to do but also because it’ll let me be a bit more flexible if I choose to change the lamp or power source (It also helps to reduce the load on the battery).  I settled for a relay kit from Ciseco – as with the lamp it proved cheaper than buying the bits.

relay
Ciesco 3v3 relay kit

I’ve soldered this board so many times the tack has come off, so I’ve had to find alternative places to put the wires! This has become a major weak point of the build.

For debug purposes I’ve produced 2 python programs – one to turn it on and the other to turn it off.

On
#!/usr/bin/python

import RPi.GPIO as GPIO
import time
import subprocess

# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)

# Define GPIO for light
GPIO_LIGHT_ON = 17

# Set light on GPIO as output
GPIO.setup(GPIO_LIGHT_ON,GPIO.OUT)
GPIO.output (GPIO_LIGHT_ON,1)
print " Light on"
GPIO.cleanup()


Off
#!/usr/bin/python

import RPi.GPIO as GPIO
import time
import subprocess

# Use BCM GPIO references
# instead of physical pin numbers
GPIO.setmode(GPIO.BCM)

# Define GPIO for light
GPIO_LIGHT_ON = 17

# Set light on GPIO as output
GPIO.setup(GPIO_LIGHT_ON,GPIO.OUT)
GPIO.output (GPIO_LIGHT_ON,0)
print " Light off"
GPIO.cleanup()

	

Trailcam – 5. I.R. Filter

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

 

Description.

I bought the filter from an EBay seller in China. It took a while to arrive but was extremely cheap and pretty good quality. It comprises of a main body with an electrical connection coming out of it and works by sliding a tiny IR filter in front of the camera, replacing the missing filter on the pi noIR camera to give a better colour reproduction under natural light.

To get it to work the wires need to receive a brief current, when this is reversed (i/e the previous +ve connection becomes –ve) it goes the other way. I needed to find something that could reverse the polarity on a pair of wires and came across this description about a motor controller. http://computers.tutsplus.com/tutorials/controlling-dc-motors-using-python-with-a-raspberry-pi–cms-20051

I built this one using the diagram provided by Envatotuts+ on to a lovely adafruit permaproto board.

filter board

IC

Mount to cam

The IR filter is clearly from some sort of CCTV camera and so comes with a couple of mounting holes. These almost line up with the mounting holes on the camera board and pimoroni camera holder so I’ve bolted them together with some nylon nuts and bolts.

I tried to fit the camera unit behind the clear plastic of the box but the result was disappointing with a very noticeable blue / grey tinge so I ended up cutting a hole through it and pushing the camera assembly through. I’m not too happy about the camera position in relation to the filter housing and intend to jiggle it about a bit in the future.

In order to prevent water getting in I’ve put a clear lens over the outside. This is from a go-pro and was a very cheap pattern part. A bit of tape and some blu-tak and it’s firmly in position.

Automatic switching.

In order to use the camera as both a night time trail cam and a daytime birdfeeder camera I needed to get the IR filter to switch automatically. This will also help to give a better picture on the trailcam in the summer when full darkness is brief.

I’ve looked at putting in an LDR (and may still do in the future) however for the time being I’ve set up cron to run the on / off program at specific times. Pikrellcam also has the facility to run scripts and I will investigate this in the future also.

Python script (taken from the Envatotuts+ blog)

filter off

import RPi.GPIO as GPIO
from time import sleep
 
GPIO.setmode(GPIO.BOARD)
 
Motor1A = 16
Motor1B = 18
Motor1E = 22
 
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)
 
print "Sending signal"
GPIO.output(Motor1A,GPIO.HIGH)
GPIO.output(Motor1B,GPIO.LOW)
GPIO.output(Motor1E,GPIO.HIGH)
 
sleep(0.1)
 
print "Filter off"
GPIO.output(Motor1E,GPIO.LOW)
 
GPIO.cleanup()

filter on

import RPi.GPIO as GPIO
from time import sleep
 
GPIO.setmode(GPIO.BOARD)
 
Motor1A = 16
Motor1B = 18
Motor1E = 22
 
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor1E,GPIO.OUT)
 
print "Sending signal"
GPIO.output(Motor1A,GPIO.LOW)
GPIO.output(Motor1B,GPIO.HIGH)
GPIO.output(Motor1E,GPIO.HIGH)
 
sleep(0.1)
 
print "Filter on"
GPIO.output(Motor1E,GPIO.LOW)
 
GPIO.cleanup()

Addition to the cron

00 16 * * * /usr/bin/python /home/pi/filteroff.py

Trailcam – 6. Control buttons

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

 

Description.

When the camera is put out in the garden it often drops the Wi-Fi link on the way so I wanted to fit the facility for a hardware button so that I could press it when the camera is positioned outside and re-establish the link.

buttons
The buttons on a small breadboard taken from my Pumoroni explorer hat (main). Buttons in place during “indoors mode” inset

When indoors & for testing I can use simple buttons however anything put outside stands the chance of being chewed so I’d like to be able to fit a waterproof button at a later date.

I’ve taken the button control straight from the main breakout board and it has the pull up resistors fitted before the male connector pegs, so it is simply a case of getting the new buttons fixed in the case and wiring on to them. I also added an LED that flashes (1, 2 or 3 times) depending upon which button is pressed.

main board

The button wiring has been a huge pain. The single core wires regularly snap at the join with the board resulting it a confusing mess of soldering and bodging. The board and wires perform perfectly and it is all an issue with my workmanship – this are would really benefit from having a custom PCM made.

The following basic python script monitors and controls the buttons / LED and is run at startup via my new favourite thing – cron!

Python prog

#! /usr/bin/python
 
import RPi.GPIO as GPIO
import os
import sys
import time
 
# set up button references
BUTTON1 = 18
BUTTON2 = 4
BUTTON3 = 7
GREEN = 3
 
 # set up buttons
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON1, GPIO.IN)
GPIO.setup(BUTTON2, GPIO.IN)
GPIO.setup(BUTTON3, GPIO.IN)
GPIO.setup(GREEN, GPIO.OUT)
# button 1 = green - reboot
# button 2 = yellow - restart wifi
# button 3 = red -
# turn light off
GPIO.output(GREEN,GPIO.LOW)
 
while True:
 if GPIO.input(BUTTON1) == GPIO.HIGH:
 print("button 1")
 GPIO.output(GREEN,GPIO.HIGH)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.LOW)
 time.sleep(.5)
 os.system("sudo reboot")
 elif GPIO.input(BUTTON2) == GPIO.HIGH:
 print("button 2")
 GPIO.output(GREEN,GPIO.HIGH)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.LOW)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.HIGH)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.LOW)
 time.sleep(.5)
 os.system("sudo ifup --force wlan0")
 elif GPIO.input(BUTTON3) == GPIO.HIGH:
 print("button 3")
 GPIO.output(GREEN,GPIO.HIGH)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.LOW)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.HIGH)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.LOW)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.HIGH)
 time.sleep(.5)
 GPIO.output(GREEN,GPIO.LOW)
 time.sleep(.5)
 else:
 print("pin is low")
 time.sleep(2)

Trailcam – 7. Completion

Other sections

  1. Introduction
  2. Basic setup & Power
  3. PIR sensor
  4. IR lamp
  5. IR filter
  6. Buttons
  7. Completed pics, improvements and parts list
  8. Updates

 

Box / case

I’ve built the camera to be modular which helps when tinkering about with it but does take up a lot of space, hence the rather cramped appearance.

Camera in window cill mode
Camera in window cill mode
inside the camera
The tangly, wirey mess inside the trailcam. Generally, sensing on the front front piece, switches to the right of the main section and wi-fi on the left. 9v battery to the top with the switched tucked away from squirrely teeth.
inside front of camera
Inside of the front section with the IR lamp (top), camera and filter, PIR sensor. All held on with non committal bl-tak and gaffer tape! – it’s the future.
front view
Front (animal eye) view. I shall call him HAL and he shall sing nursery rhymes while he looses his mind.

Component list & suppliers

 

Item supplier Link
Battery – Easy Acc 1200mAh power bank. Amazon UK http://www.amazon.co.uk/gp/product/B008YRG5JQ?keywords=EasyAcc%2012000mAh%20Power%20Bank&qid=1452114498&ref_=sr_1_1&sr=8-1
Raspberry pi A RS Bought together but no longer available
Pi noIR camera RS
Wi-Fi adaptor Modmypi http://www.modmypi.com/raspberry-pi/accessories/wifi-dongles/wifi-dongle-ultra-long-range-high-gain-w-5dbi-antenna/?search=wifi
Relay Ciesco – now wirelessthings https://www.wirelessthings.net/3v-relay-board-supports-logic-level-kit
Lamp Maplin http://www.maplin.co.uk/p/infrared-spotlight-module-a23jn
IR filter eBay http://www.ebay.co.uk/itm/381270484479
Filter controller IC Modmypi http://www.modmypi.com/electronics/integrated-circuits-ics/l293dne-dual-h-bridge-ic-solenoid,-dc-and-stepper-motor-driver/?search=ADAS-807
Circuit board

Adafruit permaproto pi

Modmypi https://www.modmypi.com/search/?search=ADAS-1148
Circuit boards

Adafruit permaproto ½ size boards

Modmypi http://www.modmypi.com/raspberry-pi/breakout-boards/adafruit/adafruit-perma-proto-half-sized-breadboard-pcb-3-pack/?search=adafruit%20board
Buttons Modmypi http://www.modmypi.com/electronics/buttons-and-switches/colorful-tactile-button-switch-assortment-square-15-pack
PIR sensor Tandy  http://www.tandyonline.co.uk/pir-motion-sensor-module.html
Wires and other bits pimoroni https://shop.pimoroni.com/
Camera software pikrellcam http://billw2.github.io/pikrellcam/pikrellcam.html

GPIO Pin summary

Board

(physical)

BCM

(logic)

Use
12 18 Button 1 (green) – reboot
7 4 Button 2 (yellow) – restart wi-fi
26 7 Button 3 (red)
5 3 LED
16 23 Motor 1A
18 24 Motor 1B
22 25 Motor 1C
11 17 IR Lamp (connection to relay)
15 22 PIR sensor

Examples

Filmed through glass and saved as an mp4

Filmed outside running on batteries. Video has been cut down in length using windows movie maker so is saved as a wmv

 

Now using adobe elements and with the interesting vids cut together

Improvements

Now that the weather has given me the chance to run the project outside, there are a couple of areas that I’m not happy with:

  1. reflection – there looks to be a noticeable reflection from the light on the lens (not helped by the badger nosing it!. I need to find some way of keeping it waterproof whilst stopping the reflection – also might try and find a way to stop the IR filter cutting off the corners of the image.
  2. Brightness of image – the image is too dark and noticeably darker than the previous version. I think that this is partly due to the camera being set as “auto” (hence it brightening up after the bager nosed it) and partly due to the lamp
  3. Lamp connection – The hardware weak point is the connection to the lamp. At every opportunity the wires fall off to such an extent that the solder pads on the lamp have fallen apart.

Jay taking peanuts

This is a short video of a local Jay that takes peanuts from our window cill.

He’s as quick as a flash so I’ve edited the video to show a slow motion version of the nut theft!