Build your own infrared camera

The Case

You will soon be controlling the camera entirely via the touch display. A stiff cardboard box or something similar that is easy to mold and shape can be used to create a case prototype. Remember that the case will need to provide good ventilation.

One challenge in putting the camera together is finding a threaded connector for the camera module that you can use to attach the filter. A normal step-up ring can serve as a connector (Figure 5). The camera I built for this article includes a 30 by 37mm step-up ring, which in turn permits the use of a filter with 37mm threading. You might want to consider using a connector that is somewhat larger, because then you can choose from a larger selection of filters and lenses.

Figure 5: A step-up ring makes it possible to attach a so-called infrared filter to the camera module.

You should attach the step-up ring for the filter on the side of the camera case that is opposite the touch display. Once you have finished putting the camera together, the results look like a cross between an old medium-format camera and a modern compact camera (Figure 6).

Figure 6: The finished camera looks like a hybrid made from a compact and medium format camera. For purposes of illustration only, the battery that is normally integrated into the case, is shown separately.

The Control Software

Up to this point, the touch display has been ignored. Instead, the camera was configured over the Internet. When you've finished building the Rasp Pi camera, however, it should start its "firmware" and display a live image in the viewfinder. Adafruit [8] offers a Python application for its own touch display that also functions with other displays.

Theoretically, this version should work, but it is plagued with performance problems and also lacks a number of useful functions. Therefore, you will find a modified version of the software online [9]. To install the software, unpack the archive and copy the contents to /usr/local/picam. Additionally, you will need two more Python packages (Listing 2). Adafruit recommends version 0.8 for python-picam. For the modifications I made for this article, I used version 1.8.

Listing 2

Additional Python Packages

$ sudo apt-get update
$ sudo apt-get install python-picam
$ sudo apt-get install python-pyexiv2

The touch display appears as an input device and is designated event0 under /dev/input. Depending on the existence of any other connected devices, the touch display might be designated event1 instead. It is a good idea to assign a permanent alias for the device by creating an /etc/udev/rules.d/95-ads7843.rules file and filling it with the lines from Listing 3.

Listing 3

Assign a Permanent Alias

# /etc/udev/rules.d/95-ads7843.rules
SUBSYSTEM=="input", ATTRS{name}=="ADS7843 touchscreen", \
  ENV{DEVNAME}=="*even*", SYMLINK+="input/touchscreen"

Usually, you can derive the exact name for the device from the output of sudo dmesg. In my project, one line of the content that appears is input: ADS7843 touchscreen as /devices/ … . After re-starting, /dev/input/touchscreen should appear as a symbolic link to the input device.

The final modification of the system involves setting up the camera software to start automatically after a boot. To do so, you should enter the lines from Listing 4 in the /etc/rc.local file and finish with exit.

Listing 4

Automatic start of camera software from /etc/rc.local

$ python /usr/local/picam/
$ shutdown -h now

If you want to close the camera software later with the corresponding menu option, then the system will also shut down. For purposes of testing, you should comment out the second line of Listing 4. To restart the camera software, you will have to log in via SSH and execute the first command via sudo.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • New Products

    What's new in the SBC, IoT, and maker realm

  • Working with the Raspberry Pi camera module

    The amazing Raspberry Pi camera module opens into a whole new world of useful projects. We'll show you how to use the Pi camera for time-lapse photography, and we'll even help you set up a motion-detecting surveillance camera.

  • Extensions for the Raspberry Pi

    The resourcefulness of private and commercial users has led to the creation of many practical and novel extensions for the Raspberry Pi. We provide an overview of some useful supplementary circuit boards.

  • Snapshot

    The remarkable Raspberry Pi has spawned a myriad of supporting projects – Android apps, program libraries, specialized Linux distributions, and an assortment of hardware accessories. The rapid changes within these projects is testament to the excitement and enthusiasm that developers around the world have given to the Raspberry Pi.

  • Building a video-enabled nest box

    We show you how to build a completely wired nest box that charts the movements of nesting birds and delivers photo images of hatchlings.