- Basic setup & Power
- PIR sensor
- IR lamp
- IR filter
- Completed pics, improvements and parts list
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.
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.
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)
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()
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