A Portable, Automated, web-based Bird Trapping Mechanism Using Atmega644
Every year between early May and mid-June large amounts of tree swallows migrate to Ithaca, NY area to mate. The study of these birds invariably require a large number of specimens to be captured for purposes such as sample-taking, banding and measurements. The current method to capture a bird includes affixing a latch, attached with a fishing line, to the entrance of the nestbox that the birds nest in, waiting from as far a distance from the nest as the fishing line/field of vision of the nest would allow for the birds to land in the nest, and pulling the latch across the nestbox entrance with the fishing line. This is a time-consuming and labor-consuming process that can take up to an hour for the capture of one bird. The long waiting period is largely due to the fact that tree swallows have exceptional vision and are highly sensitive to potential predators (humans) in the vicinity of their nests; they will delay return to the nest as long as the rate of eggs cooling or chicks feeding requirement would allow when such potential predators are present in sufficiently close proximity to their nests. In addition to cost concerns the prolonged human presence in the field could also impact neighboring nests by increasing stress levels of the tree swallows in those nests as well as other organisms in CURP. Thus, an automated trapping device that could be hidden from the birds would be beneficial the study of tree swallows by increasing efficiency of bird trapping, greatly reducing manual labor, and decreasing stress to the tree swallow population as well as impact to the local ecosystem.
Our bird-trapping mechanism (BTM) is an attachment to the existing nestbox with an extended section for camera housing, and a modified latch for mechanical bird trapping. The Atmel Mega644 microcontroller is the brain behind the BTM. Via a passive infrared (PIR) sensor, the Mega644 determines when a bird has entered the nestbox. Upon trigger, it drives the Maxx 400 servo motor to close the latch, in addition to enabling a notification at a centralized base station.
In order to make this trapper portable, we want to remove the user from the minutia of waiting by a trap for a bird to approach. The most straightforward way to accomplish this is to centralize the waiting. This is possible through a system which monitors and reports on any significant trapper activity.
We chose to accomplish this by WiFi-enabling our trapper. The site where the trappers will be implemented is already WiFi accessible, and by operating entirely within the bounds of the 802.11 protocols and standards, we do not have to worry about formatting or transmitting data at the low level. The part we used to WiFi enable our device is the Roving Networks RN-134 (hereafter “RN-134”) SuRF Board. From the manufacturer’s description, the board “is a field ready, WiFi certified 802.11 b/g solution.” In addition, the board can be operated via either RS232 or TTL UART interfaces. Given our previous in-lab experience with both communication protocols, we were comfortable integrating this part into our design.
The RN-134 operates by periodically waking and transmitting a heartbeat to the central server. This heartbeat includes enough data for the server to represent the current state of the trapper to the end-user.
The webserver is written in PHP, a high-level scripting language used to dynamically generate web pages based on user input and records stored in a backend database. The server runs on the XAMPP platform, which is an easy-to-install packaged implementation of a LAMP server. While the initial plan was to use a single HTML page which reported the status of one trapper, we found that by using these web development tools, we could implement a system which is informative and scalable. Using the state received by the RN-134, the end-user can observe if a trapper has caught a swallow and/or is not responding. This will allow the user to interact with trappers which need attention, without handling trappers which are functioning nominally.
The servo motor used is the Maxx 400. It has an operating voltage of 5V and is controlled through a PWM signal. It turns from 0 to 180 degrees with a neutral position of 90 degrees. The turning angle is determined by the duty cycle of the pwm it receives. Theoretically the servo is expecting to see a pulse every 20 ms, setting the pwm frequency and 50 Hz and the neutral angle is obtained at 1.5ms width pulse. 0 degree is reached at 600us pulse with and 180 degree at 2400 us width. Here to obtain the maximum performance with the available pwm frequencies from mega644, were using 62 ns pwm pulses. The PWM we output from the Mega644 has a range from 0 to 255, with 0 corresponding to a full duty cycle and 255 corresponding to an empty duty cycle. We can resolve 37 discrete positions by controlling the servo with the PWM. PWMs of widths (255 8) and (255 45) correspond to the physical limits of the servo motor. We drive the servo between two positions: PWM widths of (255 8) and (255 30).
The servo motor is powered by a 5 V supply and is controlled through port B3 of the Mega644 controller using its Timer0 PWM. It is mounted on the bottom side wall of the nestbox on the side of the bird entrance using plumber’s tape. The servo motor is attached to the latch using a piece of 12 gauge wire. The wire is attached to the latch by twisting it to loop through an existing hoop on the latch used in manual trapping. On the servo motor side, the wire is wrapped around the arm with a combination of a loop on the 12 gauge wire and several turns of 22 gauge wire. The result is a rigid connection between the latch and servo motor arm, while keeping a slight degree of slack on the connection points (Figures 5 and 6). The precise location setting of the servo motor was achieved through trial-and-error by first moving the arm without attaching the latch until an approximate range was established, and fine-tuning with the latch attached. Positioning was deemed acceptable when it could open and close the latch without straining either the latch or the servo motor.
The PIR sensor used is the Parallax PIR sensor. It outputs a logic low (0V) when not triggered and a logic high (3.5V) when triggered. It has two modes of triggering, selectable by moving a jumper cable, it could either keep output high while repeatedly triggered or repeatedly pulse. For simplicity, the first option is used.
The sensitivity of the sensor initially gave us quite a headache. A warm-up phase, which varies from 0 to 60 seconds, calibrates the device. During this period, any motion (and in our experience, even sound!) will jeopardize its ability to properly detect motion. No concrete time for this initialization is given in the documentation, so we pass through a “safe” period upon system startup: 40 seconds during which nothing can trigger, and the device should be left completely still.
We tried multiple solutions to provide the PIR sensor with a very quiet and protective environment for it to warm up. Initially, we covered it with a PCR cap to confine its environment. Although this proved effective, the fact that we were mounting this inside the bird nest made this solution unnecessary. It turns out that the dark and confined environment of the nest provids very good “pre-operation protection” for the sensor.
Our second challenge was the starting high phase. While testing, we detected that after warming up, the sensor will start high for about 10 sec and then revert back to its initial low status. Since we set the Mega644 to react to a high signal when a bird is caught, the high starting phase returns a false positive. The problem is solved by enforcing the 40 second delay in software. Since the Mega644 cannot handle continuous delay for more than 15 sec, we break up the 40 seconds into 4 phases. We found that the signal will reliably fall back to its nominal state within this 40 second period.
A concern for the operation of the BTM is that it will be used largely in the summer months, during which the interior of the nest can have significantly elevated temperatures. Thus the concern exists that the PIR sensor may be triggered by the temperature. The datasheet for the Parallax sensor mentions that the sensor should only trigger on temperature gradient, and that uniform heating of the nestbox should not affect the sensor. Since the BTM will be used to trap live animals, we conducted tests to ensure that the sensor is not tripped on increased outside temperature. We used a hair dryer to heat up all sections of the outside of the nestbox to simulate increased outside temperature. We noted that unless the hair dryer is pointed directly into the bird entrance of the nestbox at extreme close proximity, the PIR sensor is not triggered.
Our final hurdle was the significant sensitivity of the sensor. The sensors range is approximately 20ft, and as long as the sensor is on, any motion, even light or sound may trigger it easily – there is no thresholding device embedded on the sensor. Motion from a feather, wood strand or fiber is enough to trigger the sensor. One possible solution was to put an incandescent lid on top of the hemispherical sensing surface in order to filter the light passing through it, so as to lower its sensitivity and make it trigger only when obvious motion is presented. Positioning also matters, since the sensor can detect changes over its entire hemisphere. As long as we position it such that only 20-30 percent of the surface is available to trigger, false triggering can be minimized. The small hole – intended for a camera – above the nest enables us to mount the sensor with the optimized position. Tests proved that false triggering was reduced to about 2%, a large improvement from the 50% false-positive rate beforehand.
The RN-134 allows us to automate a module of the system which we thought would require manual communication between the Mega644 and the RN-134 via UART. It is set up to broadcast to the server periodically, regardless of whether the BTM has triggered. This is to assure an operator who is monitoring the web site that the trapper is still functional. In order to configure the RN-134 to this behavior, two connections had to be established: personal computer to RN-134, and RN-134 to server.
|Part Name||Vendor||Part Number||Cost (USD)||Qty||Total cost|
|Parallax PIR sensor||Jameco||2082927||9.95||99.5||Total|
|Maxx 400 Servo||N/A||N/A||15||1||15|
Leave a Comment
You must be logged in to post a comment.