Using iR lamps with the Pi camera

For CCTV users, I would say 'don't bother with iR' = you will get far better results (for half the cost) with a couple of PIR's and some flood lamps (which will also act as a 'deterrent' to any intruders as well) However if you really need iR illumination - for example to record the activities of nesting birds or some other wild life where you want to avoid bright lights at night, read on. iR and motion blur The NoIR Pi camera has a rather low 'near iR' sensitivity, which means using high power iR lamps = for example, a couple of Univivi U06R WideAngle Long Range 130 Feet 6pcs LED Array Lights IR Illuminator or similar (note: with the Pi, you can expect 13ft per unit, not 130ft :-) ) eBay and Amazon sellers of 'CCTV lamps' tend to make wild claims about their products. Some claim 940nm is 'infrared' (it's not = you need 850nm or lower). Most claim their products produce an 'invisible' light - well, perhaps 'on the ground', but most iR LED's will give off a quite visible red glow - 805nm less so than the common 850nm - but it means the lamp itself is quire visible if it's within the intruders field of view) All make nonsense claims about the 'illumination distance' - as a 'rule of thumb', when it comes to iR lamps, just divide any 'distance' claims by 10 .. and then double the number of units you need. The problem is that at low light levels the Pi will 'integrate' the image over some seconds, leading to motion blur. The 'solution' is to use your iR lamps as 'strobes'. This means opening them up and separating the LED's from the rest of the circuitry (which can be done with the ones mentioned above). You can then drive a '12v' rated lamp for 1.5mS at 36v every 40mS (25 Hz), assuming the Pi camera is running at 24fps or so. In dark conditions the Pi camera video operates in a 'rolling shutter' readout process. Running the strobe at 25 Hz against a camera running at 24fps 'guarantees' that every camera frame will be 'exposed' by the flash - however as the strobe is not synchronized to the camera shutter, some part of the frame will be 'double exposed'. What you will get is a 'band' of double exposure that 'wanders' up the video frame. The rest of the frame looks perfectly normal, and much more detailed and crisp on moving objects than with normal illumination, due to an effective shutter speed provided by the 1.5 msec strobe, instead of the actual 42 msec shutter time. Avoiding double exposure Synchronising the strobe to the camera 'frame-start' can be done using a software phase-locked-loop based on the PTS (presentation timestamp) issued with the image data from the GPU. For actual working code, see the Pi forums.