Night Vision camera project

By Phil King. Posted

Unlike eating carrots, this ingenious infrared camera really does enable you to see in the dark. Phil King stops munching veg to take a look.

It’s late at night and all the lights are out in the house, but someone is sneaking around… Don’t worry, it’s just Dan Aldred testing out his latest Raspberry Pi-powered invention, a portable infrared camera enabling him to see in total darkness.

Dan Aldred is a Raspberry Pi enthusiast, NCCE facilitator, teacher, and coder who enjoys creating new projects and hacks to inspire others to start learning (see magpi.cc/rwepTs). He's still trying to get a Kinect 360, Python, and Raspberry Pi working with each other.

As a child, Dan was a fan of the Splinter Cell stealth shooter video game. “The iconic image from the game is the night-vision goggles that Sam Fisher wears,” he recalls. “I have always been fascinated by the idea that you can see in the dark, and this formed the foundation of my idea to build a portable handheld night vision piece of equipment.”

Success by stealth

Sam’s Night Vision project features a Raspberry Pi Zero and a ZeroCam infrared camera equipped with IR LEDs for night-time ‘illumination’. The live camera view can be shown on a Pimoroni HyperPixel 4in TFT touchscreen, which is also used for a graphical user interface.

The touchscreen GUI offers a selection of options, including a live camera view

For the housing, Dan upcycled a handheld camera flash unit. “The original plan was to use an old-fashioned camera and make a camera that took photos in the dark, but when I went to a car boot sale, all I found was the pivoting flash – it cost a pound, which was a bargain.”

As well as being large enough to house a Raspberry Pi Zero, IR camera, and screen, the flash unit has the bonus of a tilting handle, enabling the user to angle the camera to the desired position.

One of the hardest challenges was that Dan wanted Night Vision to be standalone, portable, and bootable, with minimum interaction from the user to get it running. “The obvious solution was to use a crontab [task scheduler], but this did not load the GUI,” he reveals. “I spent about two weeks trying to find a solution. In the end I opted for a desktop icon which, when you click it, the program runs and the GUI loads.”

From vision to reality

While Dan planned out what he needed to do before he started putting the camera together, not everything went to plan. “There were several points at which I had to take a break and reassess how to find a solution to a problem,” he admits.

“All was going well until I ran the program and realised that the camera image displayed back on the HyperPixel was upside down! Luckily at this point I was using elastic bands to hold the case and hardware together, so I could flip it around. But the IR LEDs were secured in, and breaking the Sugru might damage or split the plastic. As a stroke of fate, the IR LEDs are mounted into holders and guess what, you can pop the LEDs out of the holder. So, I popped them out and then rotated the camera unit and then popped it back into place!”

The ZeroCam and its IR LEDs were mounted in drilled holes of a piece of clear plastic and secured with Sugru

More trouble was to follow when Dan accidentally cracked the touchscreen. “The whole project was working and perfect, so I was left with the conundrum of either replacing the screen and risking all the inner hardware not fitting back in, or just ‘make do and mend’. I settled for the latter, so the 10-second button does not work, but who wants to see in the dark for only 10 seconds anyway?”

Fridge raid? A photo taken using the night vision camera

Quick facts

  • The GUI is created in Python using

  • Dan has experimented with object detection using

  • Night Vision is powered using a portable phone charger

  • It would be ideal for detecting vampires/werewolves at Halloween…

  • …or a large bearded man in a red suit at Christmas

See also:

This article was written by Phil King and first appeared in The MagPi 86. Get a free Raspberry Pi with a 12-month subscription to the print edition of The MagPi magazine.

More articles from The MagPi magazine

Subscribe