Near-IR camera on RpiZeroW

NIRbackyardtiny_pi_camThe "pi camera" is a tiny digital camera available in several forms to attach to the camera input on the Rpi Zero. Turns out this camera has some sensitivity in the near infrared (NIR), so the standard model of the camera has an IR filter over the aperture, which hobbyists began removing to experiment with NIR photos. So the Pi Foundation started making these little cameras optionally available without that IR filter, even for version one of the camera. And that's what I got in a tiny format - a "NoIR pi camera v1 module" from Pimoroni (eg here), same camera unit but much smaller packaging than the other Pi Cameras available. (The orange backer is paper thin and totally flexible, so that the camera is typically folded behind the Pi.)

NIRfloodOmnivision_OV5647It's not very far into the NIR, but enough to do some nighttime photography/video using a cheapie little NIR LED floodlight. The spectral response of the camera's blue, green, and red sensors is readily found on the internet (eg here), as someone digitized and replotted them from the plots in the camera chip datasheet. The curves only go up to 700nm though, and I couldn't find response above that anywhere, so it came down to "just trying it". The NIR floodlamp centers at 850nm, and NIR LEDs with 850nm peak have a roughly 50nm bandwidth (fwhm). Extrapolating the red curve in this plot out to 800-850nm had me pessimistic, but it turned out to work quite well - maybe the curve levels out at longer wavelengths. In any case it was really striking to me that I looked outside during the IR photo above and it looked essentially pitch black out there to my eyes. Cool!

My 7 year old son helped me put together a framework to hold the Rpi and the tiny camera in a stable position with some dew/weather covering, and to hold the small floodlight in place. Lego bricks work great for such things! Note in the photos below, the Rpi being held vertically, the Lego bricks holding the floppy little camera in place peeking out of a window opening in front, the flat tan shelf piece over the camera opening to help shield from sky glare (we used it in daylight too), and the inverted tupperware held in place by more Lego bricks for weather protection. The Rpi's USB power was supplied from an AC adapter; that and the cord to the floodlight were routed into the house and the setup looked out from a chair on the deck into the back yard.


Here's the backyard scene from the chair as taken on my iphone in daytime, and the comparable scene taken from the Rpi NIR camera later that night:

The Rpi was setup on my home wifi network, so then I logged in and set the cron table to take one picture per minute for the whole night, with hopes that in the morning we'd look through the pictures and see various nocturnal animals scrounging around the yard in the night. In Seattle here at somewhat high latitude, this time of year (summer) it doesn't get dark till 10pm and starts getting light again around 430am, so I had some daylight photos in evening and morning too. (The colors are off in those because there's no IR filter on there, and then the software putting the colors together normalizes the colors all strangely because of it.) Well I looked through every single photo from nighttime, and not a single darn animal came through there! But first thing after dawn, our neighborhood rabbit came wandering through the yard (manually circled in red below). I know we have raccoons and other critters, so next time maybe I'll set this thing up along the edge of the flowerbed which I think is more of a critter thoroughfare.

Anyway, to configure the Rpi to take the pictures with that camera was really quick and easy, using the directions in the "raspicam" online documentation:
Note the part in there about creating an executable shell script to take the picture and put it in a timestamped file, and the part in
about calling from the crontab file each minute.

My goal with the pictures of critters wandering the backyard was to then use a tool like recurrent neural networks (RNNs) to track the critter(s) from the photos, and compare their paths night to night. Um, looks like I might have to revisit that goal. (I guess I could drop the IR aspect and try tracking Mr. Bunny in the mornings... but the IR capability is sure neat on that cheap tiny camera...)