Showing posts with label Activity counter. Show all posts
Showing posts with label Activity counter. Show all posts

Friday, 7 April 2017

2017 Double camera Bird Box - Intro

Our 2017 double-camera bird nestbox went up a couple of weeks ago.  This is a two-camera setup built around a conventional wooden box design... with a Raspberry Pi 3 for a brain.  The box gives a day and night (infra-red / IR) video options (e.g. to check for roosting at night), with separate 'from above' IR and 'from the side' daylight cameras.  It has a temperature, humidity and ambient light sensors, the latter to automate interior illumination with either visible light or IR leds, all of which have high and low settings.  It's connected directly to the local network so all video storage is handled off-box (as it were).  All we need now is some birds...
2017 double camera bird box
Components

Brain: RaspberryPi 3.  Most of the electronics gizmos interface via a female to male header + perfboard 'shield' that plugs into the GPIO header pins of the raspberry pi.
Power: This is via Power-overEthernet (PoE) using this TP-LinkPoE kit (~£20).  This allows one cable for power and network access, and provides a 12v feed for the LED illumination and IR-cut, which is also dropped to 5v for the Raspberry Pi using a RECOMR-7885.0-1.5 module (~£10)
Top-down camera (Cam -1): InfraRed Raspberry Pi v2 camera module (~£22.79).  This does higher resolution, fixed focus motion-activated video and image capture, using the excellent PikrellCam software.  Video is saved direct to my local network to overcome local storage issues.
InfraRed cut-out filter:  This switches a filter in front of Cam- ( the Pi v2 IR camera), in the daytime for normal-looking daytime images a and video.  In low light/dark, the IR filter is pulled back and IR led array activated for unobtrusive night viewing.  this is interfaced to the Pi's GPIOs via an L2930NE ic.
Side-view camera (Cam-2): MicrosoftLifeCam Cinema (~£15 ebay).  This is the 'dumb-camera', and just generates a video stream that is monitored by a windows PC running iCatcher CCTV software.
Illumination: There are 3 lighting circuits, (1)3x 'White' leds recycled from a broken torch, (2)4x  'Warm' leds (from the 'drawer of stuff'), (3) an 36 LED IR led.  The latter is coupled to a 5k variable resistor as full power causes a white-out.  These three lighting options work off the 12v feed and have low and high settings.  The 12V LED circuits are switched by the Pi's GPIO pins via a ULN2003AN ic.  I used some different types of LEDs since I didn't know what would work the best ultimately.
IR array
Temperature and Humidity: HDC1008  I think these are now discontinued, but as this was 'in the drawer of stuff', in it went.   This sits in a separate, vented compartment and logs outside temperature and humidity to a MySQL database.

Entrance hole counter: The box has a 25mm entrance hole, with in outer and inner IR detector beam, as such we can distinguish between entering/exiting/head pop in/head pop out.
see these updated posts for a 2019 version of the entrance hole counter:
http://nestboxtech.blogspot.com/search/label/EntranceCounter

Other stuff:  I've also added inside and outside PIRs as an alternative way of measuring activity - but haven't worked this bit up yet...

It's built in a modular fusion so that it can be relatively easily dismantled.  The circuitry for the entrance counter is housed separately, into a compartment in the front panel of the box, and connected via a hacked cat5 cable and jack to the Pi shield.

Some pictures...
Easy access side door.
Showing position of side camera and opaque windows for illumination

The main box area is under the wiring bit, with glass partition separating webcam section
Raspberry Pi Shield in detail

One of two vents for the HDC1008 temp and humidity sensor

In situ

As I develop more of the software side of things I'll post updates at intervals.

Sunday, 4 May 2014

Bird Box activity counter


UPDATE Sept 2019: I wrote an updated version of this here (v3)

Activity counter v1

I've been working on getting the activity counter working on my side-view bird box.

This works on the basis of 2 infra-red beams built into the entrance hole.  The front panel  of the box is constructed of several layers of plywood with channels cut for cable inclusion.


The IR beams interface with a PiFace add-on board on a Raspberry Pi.  The principle is that by breaking outer and/or inner beam its theoretically possible to distinguish between entrance, exit, head bob in/out.

My design is based on that described in chapter 17: "The Techno-BirdBox: A Wildlife Monitor" of Andrew Robinson and Mike Cook's book: Raspberry Pi Projects.

Parts
2x IR LEDs: SFH484-2
2x IR photodetectos QSE113
2x 1k ohm resistors
2x 330 ohm  resistors

RaspberryPi + PiFace in-situ
For full description on wiring guide and setup, please go buy the book!

Activity counter scripts
I did feel slightly aggrieved that the included python scripts for recording and processing the beam breaks has quite a few printing errors in the book,and does not work as-is.  I have made corrections such that I think it now all works fine.  You can find my versions of these scripts in a GitHub project page together with some sample activity log data, which I've used to create the graph below.

One cool thing about Andrew's scripts is that he describes a way of programatically generating  graphs of activity.  The following is generated from my version of these scripts:

Activity graph generated from sample activity data

The plus side of having had to tweak these scripts is that I have learned some python and I now have some idea of what a state machine is.  All I need now are some bird box visitors!