A novel nest-monitoring camera system using a Raspberry Pi micro-computer
Abstract
enThe utility, availability, cost-effectiveness, and reliability of prefabricated video systems designed to monitor wildlife have lagged behind the unique and varied needs of many researchers. Many systems are limited by inflexible video settings, lack of adequate data storage, and cannot be programmed by the user. More sophisticated systems can be cost prohibitive, and the literature describing remote wildlife video monitoring has, for the most part, not incorporated advances in camera and computer technology. Here, we present details of a pilot study to design and construct a lower cost (US $340) nest camera system to record the behavior of Acorn Woodpeckers (Melanerpes formicivorus) in artificial tree cavity nests. This system incorporates a Raspberry Pi micro-computer, Pi NoIR infrared camera, a wireless adapter to transmit video over the Internet, and Deka rechargeable gel batteries for power. We programmed the system to motion-sense, to record exclusively during daylight hours, and to automatically upload videos to the cloud over wireless Internet. The Raspberry Pi micro-computer does not require advanced programming or electrical engineering skills to build and configure and, because it is programmable, provides unprecedented flexibility for field researchers who wish to configure the system to the specific needs of their study.
Un sistema de monitoreo de nidos novedoso usando micro computadoras Raspberry Pi
esLa utilidad, disponibilidad, la relación eficiencia costo y la confiabilidad de sistemas de video prefabricados diseñados para el monitoreo de vida salvaje han estado atrasado de las necesidades únicas y variadas de muchos investigadores. Muchos sistemas están limitados por los ajustes de video inflexibles que no tienen la capacidad adecuada para guardar datos y no pueden ser programados por el usuario. Sistemas más sofisticados pueden ser prohibitivos por su costo y la literatura describiendo monitoreo de vida salvaje con videos, ha estado mayormente, desacoplada de los avances tecnológicos en cámaras y computadores. Aquí presentamos los detalles de un estudio piloto para diseñar y construir una cámara para nidos de bajo costo (US $340) para grabar el comportamiento de Melanerpes formicivorus en nidos en cavidades artificiales. Este sistema incorpora microcomputadoras Raspberry Pi, cámara infrarrojo Pi NoIR, un adaptador inalámbrico para transmitir video a través de internet y baterías recargables Deka de gel. Programamos el sistema con sensores de movimiento para grabar exclusivamente durante horas del día y para que automáticamente subiera los videos a la nube a través de internet inalámbrico. La micro computadora Raspberry Pi no requiere de programación avanzada o habilidades en ingeniería eléctrica para su construcción y configuración. Debido a que es programable provee flexibilidad sin precedentes para investigadores en el campo que desean configurar el sistema para las necesidades específicas de su estudio.
Despite rapid advances in the miniaturization, image quality, data storage, portability, and utility of video-camera technology, the flexibility and cost-effectiveness of many camera systems has largely lagged behind the needs of many field researchers (Cutler and Swann 1999, Steen 2009, Cox et al. 2012, Waldstein 2012). For example, the increasing popularity of “nest cams”, which are video streams of bird nests hosted by a wide array of organizations online, has been mirrored by the proliferation of prefabricated bird-box camera systems built specifically for installation in back-yard nest boxes. However, the capabilities and prices of back-yard nest cameras vary widely (Table 1). Moreover, use of nest cameras for research in a field setting, as opposed to a backyard, requires camera systems with more capabilities as dictated by the research, such as motion detection, video capture, online streaming, programmability, long battery life, significant data storage, and adjustable video settings such as frame rate, brightness, and contrast (Table 1). Thus, finding the right ready-made camera with the right plug-and-play capabilities for research can be a challenge.
Device | Wireless | Online Streaming | Video Capture | Motion Sensing | Long (24 h +) Battery Life | Adjustable Video Settings | Programmable | Total Cost ($US) |
---|---|---|---|---|---|---|---|---|
Hawk Eye™ Wireless Nature Cama | Yes | No | No | No | No | No | No | $150 |
Nestbox Co.™ Wireless Nest Camera Kitb | Yes | No | No | No | Yes | No | No | $270 |
UK Wildlife Cameras™ Wireless Nest Camera Kitc | Yes | No | Yes | Yes | No | Yes | No | $332 |
GardenNature™ Wireless Nest Camera Kitd | Yes | Yes | Yes | Yes | No | Yes | No | $205 |
Handykam™ Wireless Nest Camera Kite | Yes | Yes | Yes | Yes | No | Yes | No | $306 |
Cox et al. (2012) Nest Camera Systems | Yes | No | Yes | Yes | Yes | Yes | No | $350–$725 |
Zárybnická et al. (2015) Nest Camera | Yes | Yes | Yes | Yes | Yes | Yes | Yes | $1400 |
Raspberry Pi Nest Cam | Yes | Yes | Yes | Yes | Yes | Yes | Yes | $340 |
- a Birdhouse Spy Cam, West Linn, OR.
- b Nestbox Co., Solihull, West Midlands, UK.
- c UK Wildlife Cameras, London, UK.
- d GardenNature, Essex, UK.
- e Handykam, Cornwall, UK.
When prefabricated camera systems are unsuitable for use in the field, researchers must build their own. User-built nest-monitoring camera systems, such as those described by Cox et al. (2012), feature large memory capacity and long battery life, but call for large data storage devices such as DVRs, and remain relatively expensive (US $350–$725; Table 1). Recent advances in camera and circuit board miniaturization, as well as software applications, now allow systems that can be controlled and modified via the Internet, are easily programmable, and can be integrated with other electronic devices, such as environmental sensors. For example, the camera system developed by Zárybnická et al. (2015) to monitor Boreal Owls (Aegolius funereus) incorporated a control board, cameras, infrared lights, motion detection, and a radio-frequency identification reader all in a single unit. The cost of this “Smart Nest Box”, however, was over US $1400 (not including development time) due to the use of expensive cameras, and required a level of electronic engineering skill that not all researchers possess.
We argue that the most useful attribute of a remote-sensing camera system is its programmability, which allows for countless user modifications. As Table 1 illustrates, programmability is not a common feature of most nest cameras. To achieve the aim of creating an adaptable, user-friendly remote surveillance system, we report the design and construction of an economical, programmable camera system using Raspberry Pi Model B micro-computer components to record the behavior of Acorn Woodpeckers (Melanerpes formicivorus) in tree cavities. This system is versatile, cost-effective, robust enough for long-term use in a field setting and, most importantly, can be programmed to meet a number of independent research goals.
Methods
Our study was conducted in 2014 at Hastings Natural History Reservation (HNHR; 36°12′30″ N, 121°33′30″ W) in Carmel Valley, California. The population of cooperatively breeding Acorn Woodpeckers at HNHR has served as a model system because of their unusual polygynandrous mating system and family group compositions (MacRoberts and MacRoberts 1976, Koenig and Mumme 1987, Koenig and Walters 2014). The 647-ha reservation (Alagona 2012) has three solar-powered, wireless hotspots available for research use. Two Acorn Woodpecker family groups had territories near power sources. A third group was located > 600 m from a power source and thus a 12V rechargeable battery was used to power the system.
Raspberry Pi
The Raspberry Pi (hereafter RPi) is a reliable, low-cost (~ US $35) micro-computer developed in 2006 by the University of Cambridge's Computer Department, and produced by the Raspberry Pi Foundation in 2012 as a tool to encourage students to learn programming language (Fig. 1; Severance 2013). This credit card-sized micro-computer boots to a programming environment that allows users to customize their RPi using Python programming language and uses the UNIX/debian-based Raspian operating system, a free operating system optimized for RPi hardware. To use the computer, several readily available components are connected, such as an HDMI cable that links the RPi to a television or computer monitor (Fig. 2). A USB keyboard and mouse connect to USB ports on the circuit board and allow programming of the RPi. The computer is powered by a micro-USB cable (a common cell phone adapter), and uses an SD card for booting and long-term data storage. It connects to the Internet using an Ethernet cord or a wireless USB Internet adapter. Two to four USB ports (depending on the RPi model) are provided for additional USB components. Included in the circuit board design are 26/40 general purpose input/output (GPIO) pins capable of powering additional electrical elements connected to the computer.


In 2013, the Raspberry Pi Foundation released a miniature camera (the Pi NoIR), measuring 25 mm × 24 mm × 9 mm, capable of capturing high-definition (1080p) infrared images and videos at up to 30 frames s−1 (Fig. 2; Senthilkumar et al. 2014). This camera connects to the Camera Serial Interface port on the RPi, is programmable and powered by the RPi, and is ideal for capturing images and video in dark environments, given an infrared light source.
Camera system assembly
We purchased three complete systems and each included an RPi Model B mini-computer, Pi NoIR camera, wireless USB Internet adapter (Edimax Wireless N Nano USB Adapter), micro-USB power adapter (5V, 1A Switching AC Power Supply), and Sony Class 10, 32GB SD card. To illuminate the cavity, we installed six 940-nm infrared LEDs in a breadboard (Solderless Breadboard, NKC Electronics, Weston, FL; 400 tie-points, four power rails, 84 × 56 × 9 mm; Fig. 3) using hot glue to secure them.

This circuit required the LEDs, insulated copper wire, and six 220 Ω resistors to provide enough illumination of the nest cavities without burning out the LEDs or generating excess heat. The breadboard circuit was connected to the one (3.3 V power) and six (ground) GPIO pins on the RPi using jumper cables (Phantom YoYo, Yingcheng, China; 200 mm, male to female, jumper cables) to power the infrared LEDs (Fig. 3).
Camera system installation
The three Acorn Woodpecker family groups in our study were chosen due to the proximity of their territories to power sources and wireless hotspots, and their prior use of artificial nest cavities. Artificial nest cavities were constructed from 75-cm sections of gray pine (Pinus sabiniana) logs that were hollowed out to create cavities ~ 30–40 cm deep and ~ 15 cm in diameter. A 5.5-cm entrance hole was drilled into each nest cavity, and the top of each cavity was covered by a removable board (Fig. 4). Cavities were mounted on horizontal branches ~ 7 m high in trees located centrally in woodpecker family territories. Artificial nest cavities were ideal for the installation of camera systems because they were easily accessible, and the cameras could be mounted on the cavity roof. Roosting behavior of each group of birds was observed for a week prior to installation of the RPi systems to ensure that they were using the cavities.

The Hastings Reserve averages 523 mm of rain per year (Koenig and Walters 2015) so our camera systems had to be weatherproof. Moreover, Acorn Woodpeckers can be destructive towards objects near their nest cavities so the systems also had to be robust enough to withstand woodpecker pecks. To this end, all components were installed in weatherproof, electrical 10.2 × 10.2 × 10.2 cm junction boxes affixed with machine screws to the lids of the artificial cavities, and sealed with caulk (Fig. 4). A 7.5-cm diameter hole was drilled through the bottom of the junction box and lid of the artificial cavity to provide the camera with a full field of view of the interior of the cavity. This opening also provided an adequate depth of field (~ 35.5 cm) to allow the camera to focus on the bottom of the cavity using the default settings.
The RPi computer, in a small acrylic case designed to protect the RPi circuit board (Raspberry Pi Board Case Box for Model B, Tontec, Kowloon Bay, Hong Kong), was fastened to the lid of the junction box with M4 × 0.7 × 76.2 mm machine screws and nuts, and the LED breadboard was affixed to the lid of the RPi case. The Pi NoIR camera was in turn glued to the middle of the breadboard, between the infrared LEDs. This entire assembly was positioned pointing down from the lid of the box to face the bottom of the cavity (Fig. 5). Finally, a clear acrylic shield was attached to the front of the assembly to protect it from the woodpeckers, while still allowing infrared light to pass through, with a small 1-cm pinhole drilled in the center to provide the Pi NoIR camera with an unobstructed view of the cavity. Power was provided by drilling a small hole in the side of the junction box for the power adapter, which was then plugged into an outdoor extension cord attached to an outlet in a nearby outbuilding. The hole for the adapter was filled with silicone to maintain a waterproof seal (Fig. 4).

This configuration was altered slightly to accommodate an alternate power source in a territory located away from any outbuildings. Power was provided by a 12V Deka solar photovoltaic (type 8G27, 88 ah) rechargeable battery. A 12V micro-USB to USB 2.0 power cable connected the RPi to a USB cigarette lighter adapter plugged into a standard male 12V to 5V 2A USB automotive adapter that was then connected to the rechargeable battery and placed in a waterproof, plastic box. The RPi camera system drew about 1 mA of power so the battery had to be replaced every one to two weeks (Fig. 6).

Programs
The Raspian operating system was downloaded to the SD cards from the Raspberry Pi website (https://www.raspberrypi.org/downloads/raspbian/). Several default computer and camera settings were then altered to make the system operate within our desired parameters, including booting our programs immediately on startup, changing the scheduled time to record to exclude night-time roosting, and programming the lights on the computer and camera to remain off to reduce disturbance to the birds. The motion-sensing (motion-MMAL), streaming (motion-MMAL), and uploading (Google Drive Uploader) applications used in our study were programmed into our system using open-source code obtained from open-source RPi forums, which were then altered according to our needs, as described below.
To minimize recording time during the day and reduce video size, the motion-sensing program was used to record video only when birds were present. To facilitate motion-sensing and streaming using the Pi NoIR cameras, we used the open-source program motion-MMAL from the raspi repository using “sudo apt-get install motion.” This program enables motion sensing by detecting changes in a certain (user-controlled) percentage of pixels in the screen, which prompts the camera to begin recording. The motion-MMAL program can also stream video, take time-lapse photographs, and capture still images simultaneously. For further details, including the motion-MMAL code, instructions for implementation, and additional (extensive) capabilities of this program, see Appendix S1.
To reduce the volume of data stored on the RPi SD cards, we programmed each RPi to upload the recorded videos from the RPi SD cards to individual Google Drive accounts set up for each nest using the Google Drive Uploader program (http://jeremyblythe.blogspot.com/2012/06/motion-google-drive-uploader-and.html). Videos were thus uploaded to the Google Drive accounts each hour, and were erased from the SD card following each upload to conserve memory. Without this program, the SD card would reach capacity within 3 d during the peak activity period surrounding nesting and provisioning of young. This program has since been rendered defunct due to new Google security authentication protocols developed since our study. To remedy this issue, a new Uploader program that incorporates the changes to the Google protocols is available at the link listed above.
A static IP address was created for each RPi on the private Hastings Reserve network. The video streams of the nests were thus available to view by entering the static IP address of each RPi device in an Internet browser. As mentioned, we programmed the RPi to automatically boot our programs at startup, bypassing normal start-up procedure, in the event that power to the systems was temporarily lost, and then re-established, making it a stand-alone unit without requiring a keyboard, mouse, or a display for every bootup. By enabling streaming and automatic booting capabilities, the need for direct monitoring of the camera systems in the field was reduced substantially.
Results
The three RPi systems were installed and began recording on 20 April 2014, coinciding with initiation of the Acorn Woodpecker breeding season. Two woodpecker groups began roosting, and subsequently nesting, in the artificial cavities outfitted with an RPi within 2–3 d of installation. Woodpeckers in these groups exhibited curiosity toward the hole in the cavity lid, and the acrylic shield therein, for a week following the installation of the camera. This curiosity was characterized by several minutes of pecking the shield per day, but the behavior generally abated within a week (Fig. 7). Both groups nested successfully. Woodpeckers in the third group did not roost or nest in the artificial cavity after installation of the RPi system. The cost of the three RPi systems was < US $860 (~ $180 each for three camera systems, and $320 for two rechargeable batteries [so one can be recharged while the other is being used]).

In total, we obtained more than 3500 videos (40 GB) of Acorn Woodpecker behavior from 20 April to 15 July 2014. Videos ranged in duration from 1 s to 20 min (Video S1). The RPi computers and Pi NoIR cameras remained in operation at temperatures ranging from 1.1°C to 37.8°C.
After extensive testing, we found that setting the sensitivity of the motion sensing program to detect motion when 1600 pixels changed in the image reliably picked up the behavior of the birds, with few instances of light changes or outside motion causing the program to record empty videos. Setting the frame rate to 15 s−1 in the motion-sensing program resulted in relatively smooth videos (Video S1). We were also able to stream the video from each system on the Hastings network. Moreover, the Deka rechargeable battery powered the system continually for 7 d before needing replacement, but we estimate it would have lasted 9–10 d (5 Ah per day, keeping the 80 Ah deep cycle battery above 40%).
Discussion
The programmability of our RPi camera systems allowed us to take advantage of wireless technology to upload videos to the cloud, alter programs, and troubleshoot problems without removing the units from the woodpecker nests. In total, our RPi camera systems yielded 3500 videos that captured the full range of breeding season activities, including nest creation and maintenance, egg-laying, hatching, provisioning of young, nestling behavior, and fledging. Predation of nestlings at one of the nests by a Pacific gopher snake (Pituophis catenifer catenifer) was also recorded.
One of the three woodpecker family groups did not roost or nest in the artificial cavity after installation of the RPi system. Acorn Woodpeckers may fail to breed for a variety of reasons, including changes in family group composition, risk of predation, or lack of resources (Hannon et al. 1985, Hooge et al. 1999, Koenig and Stahl 2007). In this case, a new female joined a single male breeder in March. This change in group composition, rather than the presence of the camera system, may have led to the failure of this group to nest.
The angle of the PiNoIR camera at the top of the nest cavity allowed us to see color bands on one or both legs of each woodpecker that entered ~ 70% of the time, but use of an infrared camera muted the colors of the bands. Installing the camera at an angle to the cavity entrance may increase the visibility of the color bands and make it easier to identify birds as they enter.
Although we were able to use the wireless hotspots available at the Hastings Reserve to stream and upload recorded videos, as well as outdoor outlets for power, we acknowledge that wireless Internet signals and readily available power sources are rare commodities in most field research. A useful capability of the RPi that we did not explore is the ability of the RPi to be programmed to use 3G/4G cellular data connections in places where wireless Internet is not available. To remedy the limited memory problem when access to the cloud is not available, the USB ports of the RPi computer allow for a variety of alternative video storage methods, such as flash drives and external hard drives. This system does not require the use of cumbersome DVRs as described by Cox et al. (2012). The RPi USB ports, micro-USB power port, and GPIO pins further allow solar energy to power the system, as well as the incorporation of additional components potentially valuable for research, such as environmental sensors to record temperature and humidity, microphones to record audio, or radio frequency identification sensors to identify individual birds entering a cavity (Zárybnická et al. 2015). Furthermore, this design can be altered relatively easily and simplified for use in standard songbird nest boxes by mounting the PiNoIR camera and one or more LEDs under the box lid, and installing the RPi and power source in a weatherproof container outside the box. We have yet to devise a way to install a camera system in Acorn Woodpecker natural cavities, but the small size of the PiNoIR camera and diminutive RPi circuit board facilitate research in tight spaces that are accessible to human hands.
With a basic understanding of programming language, and availability of numerous active RPi forums online, the RPi can be modified to accommodate a wide array of studies involving remote surveillance. This system is well-suited to the needs of researchers with limited electrical or programming expertise who would like to incorporate video into their research.
Acknowledgments
We thank J. del Valle for help designing and building the external camera housing, M. Prinz for his assistance troubleshooting the RPi system, and E. Nishikawa and E. Cali for monitoring the artificial cavities after installation was complete. This study was supported by the North American Bluebird Society, the National Science Foundation (IOS-0918944, IOS-1455900), and through start-up funds to ELW provided by Old Dominion University. Our study was conducted under permits from Old Dominion University, United States Department of the Interior, United States Fish and Wildlife Service, and the California Department of Fish and Wildlife.