Building a video-enabled nest box

The Camera

A camera can let you go live watching birds as they sit on their eggs and raise their young. It also serves to avoid disturbances that bird-watching might otherwise cause. The interior of a nest box is typically dim, so you will need technology that functions in the dark. Night-vision cameras with infrared spotlights are normally used under these circumstances, but they can be fairly high priced.

The intrepid hobbyist will find that infrared LEDs offer a more economical way to illuminate the interior of the nesting box. The HE3-290AC model functions here quite well. These LEDs have a large beam angle and shine very brightly.

A simple, off-the-shelf webcam can be used for a camera; however, it will filter out infrared light and therefore not capture light from the diodes. The chip in the camera is still capable of capturing the necessary wave lengths, though, so you can simply remove the filter built into the camera (Figure 4). In the model shown in this example, I found the filter directly behind the optics. The filter is easy to recognize because it has a red and blue shimmer. Sometimes, however, this part breaks when removed (Figure 5).

Figure 4: The lens has already been removed. It is easy to recognize the video chip but not the shimmer of the infrared filter. Probably this is because the camera being used has a built-in filter as well.
Figure 5: The only way to remove the IR filter is to cut it out.

Getting all of the camera pieces back together and functioning correctly proved to be a complex task in the trial run. The risk of inflicting irreparable damage to the lens during this process is great. It makes sense therefore to buy a somewhat larger model made with good workmanship.

Pay special attention as to whether the lens sits correctly when putting all of the pieces together. If the lens does not sit right, all of the photographs taken by the camera will be blurry. A good way to check on the position of the lens is to use V412ucp or similar tool to test whether the stream looks right. Otherwise, you can also turn the lens until the image comes into focus. You should avoid touching the surface of the lens with your fingers.

The modified camera in this example produces black-and-white images. Depending on the model you started with, the images may also be somewhat noisy. The lack of light inside the nest box means that the image quality will be lower than images made in full daylight.

The infrared LEDs receive voltage via a small transistor power amplifier, and a motion detector (PIR module) turns on the amplifier. A small solar-powered system provides all of the energy needs in this trial project, making it economical to run.

A relatively small 180-ohm series resistor was used for the LEDs because they each need 50 milliamps for maximum performance (Figure 6). You will find the circuit diagram in both gEDA and EPS format online [2]. Figure 7 shows a camera design layout that lets you install the resistor directly.

Figure 6: It is easy to set up a bird-watching post in the interior of a birdhouse by adding a few extra components.
Figure 7: A strip board can be used as a base for the camera, the PIR module, and the IR LEDs.

The choice of software depends on the type of camera you use and the surrounding environment for connecting the Raspberry Pi. For example, do you need software for full HD streaming or do you prefer uploading individual images to an FTP server?

The Photoelectric Sensor

The photoelectric sensor serves two purposes in the design and is one of the most complex parts. First, the sensor lets you know whether a bird has flown into or out of the box. Second, the sensor will need to store the results temporarily until the analysis software has finished processing the data.

Circuit diagram 2 (schaltplan2.sch) [2] shows how to solve both of these issues using SN7400 logic gates, which provide the capability to adapt the digital gauge via the photo coupler. The concepts underlying the design are straightforward.

You will need two photoelectric sensors to determine the direction in which the birds are moving. Each of the component parts sets an SR flip-flop [4]. As soon as a bird flies through both photoelectric sensors, the last flip-flop that was triggered is the one that remains active. This is how you figure out the direction of flight. The Raspberry Pi has to reset both flip-flops each time the information is read so that the movements of one bird are counted only once.

Special infrared transmitters and receivers are used with the photoelectric sensors to avoid interference that might be caused by daylight. In any event, there will be a negative number of birds in the nest at some point, because young that have hatched in the nest box will eventually fly out and not return.

Figure 8 shows one possible layout for a circuit board. Attaching the photoelectric sensor to the entry hole is a little tricky because the presence of the sensor must not result in any injuries to the birds. Also, the sensor must be reasonably protected from the elements. A solution is simply to make a groove on one edge of the entry hole and glue the photoelectric sensor to the groove. Figure 9 shows the photoelectric sensors before final assembly.

Figure 8: The component parts for the photoelectric sensors also fit onto the circuit board.
Figure 9: The photoelectric sensors should be placed directly across from one another to guarantee error-free operation.

WiringPi

The WiringPi library provides easy access to the GPIO interface of the Rasp Pi. Gordon Henderson developed the software and still maintains it. It has simple commands and a C API for reading and writing the I/O ports. Among other things, the software also includes a driver for the I2C bus. Listing 1 contains the steps for installing the library. After the build step, you should test whether the installation was successful with gpio readall. The result should look similar to the output in Listing 2. Additional information on WiringPi is available on the homepage of the project [3].

Listing 1

Installing WiringPi Library

$ sudo apt-get update
$ sudo apt-get upgrade
$ git clone git://git.drogon.net/wiringPi
$ cd wiringPi
$ ./build

Listing 2

Output of Successful Installation

$ gpio readall
+-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
|   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |
|   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
|   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
|     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
|  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
|  27 |   2 | GPIO. 2 |   IN | 1 | 13 || 14 |   |      | 0v      |     |     |
|  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
|     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
|  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
|   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
|  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
|     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|  28 |  17 | GPIO.17 |   IN | 0 | 51 || 52 | 0 | IN   | GPIO.18 | 18  | 29  |
|  30 |  19 | GPIO.19 |   IN | 0 | 53 || 54 | 0 | IN   | GPIO.20 | 20  | 31  |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+-Model B2-+---+------+---------+-----+-----+

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content