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!


2 comments:

  1. That RapsberryPi wiring is a really tidy, professional job, right down to the mag-catch. Do you do this kind of thing for a living?

    I also like the activity counter. That graphing feature could save me a bit of time.

    ReplyDelete
  2. Ha! no, not for a living.. I just like neatness in my projects... I wouldn't recommend routing wires through straws though - its a bit of a fiddle.

    ReplyDelete