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.
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).
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/cam.py $ 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
Pages: 6
(incl. VAT)