Showing posts with label SideViewBirdBox. Show all posts
Showing posts with label SideViewBirdBox. Show all posts

Monday, 12 December 2016

Blue tit argument...

The bird box has been recently used as an overnight roost for a blue tit.  On a couple of occasions we've had two in there.  Today was a little different since tit 1 didn't appreciate tit 2 in the same space, as can be seen in the following clip:



It's interesting that in addition to feet and beaks being used as offensive weapons, there are a couple of hooks using a wing...

Right hook


The posturing at the beginning is also interesting:

Posturing

Reminded me a bit of this



Sunday, 10 January 2016

Why webcam autofocus in birdboxes is sometimes bad

The 2014 bird box has a Raspberry Pi + Microsoft lifecam cinema usb webcam in it that has been faultlessly streaming video since being setup. I had to switch all cameras off over the Summer & Autumn for building work, and on reactivating them... I have discovered a design flaw.

My design has a glass partition between camera / electronics and area for the birds.  Over the Summer this has got filthy - I blame my builders!  The dirt means that the camera now 'sees' the window and focuses on it rather than any in-box activity.  An example from last week (Jan 6 2016),  shows the problem:


While I don't resent the odd insect, I don't want this sort of thing:


There is an obvious solution - CLEAN THE GLASS!
...which would be great if I could locate the keys for my securely locked ladder :(
Plan B is to turn the auto focus OFF and fix the focus to a specific focal distance

Introducing uvcdynctrl
This is a handy application that gives control over your webcam's settings.  Apparently the one I'm using (Microsoft Lifecam cinema) is notorious for a skittish auto focus.

Since I'm running this on a Raspberry pi, to install do:
sudo apt-get install uvcdynctrl

To list the controls available to you do:
uvcdynctrl -c

I get the following (output depends on webcam model):
xx@xx ~ $ uvcdynctrl -c
Listing available controls for device video0:
  Brightness
  Contrast
  Saturation
  White Balance Temperature, Auto
  Power Line Frequency
  White Balance Temperature
  Sharpness
  Backlight Compensation
  Exposure, Auto
  Exposure (Absolute)
  Pan (Absolute)
  Tilt (Absolute)
  Focus (absolute)
  Focus, Auto
  Zoom, Absolute

Now, obviously I cant control all of these, there's no pan and tilt controls available to me, however I can change the autofocus behaviour.
To turn OFF that pesky autofocus:
uvcdynctrl -v -d video0 --set='Focus, Auto' 0

Auto focus is OFF... just need to manually set the auto focus until it's in the correct place:
uvcdynctrl -v -d video0 --set='Focus (absolute)' 10
The number at the end is the focal distance - just needs playing with to hit the correct focal point

You can 'get' i.e., query what the focus setting is at  as follows:
uvcdynctrl -d video0 -g "Focus (absolute)"

So auto focus is off for now... just need to find my keys /access ladder, clean/remove the separating glass  and I can sort it properly, then switch auto focus back on with:
uvcdynctrl -v -d video0 --set='Focus, Auto' 1

Wednesday, 11 February 2015

Spring 2015 nest boxes - early interest

We've seen daily interest in our side-view bird box, but this has been limited to a 'once daily' blue tit.
Today up'd the ante with a pair of Great Tits in addition to the usual mid morning Blue Tit.

Both these clips are from the same day (Feb 9th 2015).  You can see I may need to do a bit of a Spring clean too...

Blue tit



Pair of great tits


Of note is that its the first time I've seen any bird inspect the window at the top of the nest box.  As you can see, the window does not overlook the nest site directly, evident in the ramp up which the Great tit is attempting to climb.  Oddly, both birds attempt the same thing for the first time on the same day.  Front view of this box as shown (although its mounted on the side of the house).

'pre in-situ' picture last Spring.
See the following posts of more detail: Inception, activity counter,

Squirrel box update

Over the  Autumn and Winter, the squirrel box continues to be used as an occasional refuge from rain and windy weather.  They've been only intermittent visitors recently, but lots of activity approx 1 month ago.  Periodic addition of nesting material continues as show in this series:






...or with the squirrel:



Next job is to get this year's bird nesting box completed and up in time for Spring...

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!


Tuesday, 29 April 2014

Side-View bird box, early interest

Well, I am usually genuinely surprised when things actually work, so it was with great excitement that we spotted this fella poking his head into our new bird box to take a look.

Blue tit inspecting potential home


We're pretty sure its a blue tit.  My first thought was to check the activity log that is generated via the two infra-red beams at the entrance hole.  There are two IR beams, an inner and an outer one, so theoretically one should be able to distinguish between entrance / exit / head-in / head-out.  Why you might ask...? ;)

Nest box in situ, and activity log.  Yellow activity is this blue tit.

The log shows the activity to date, where the two numbers represent the beam, then the beam state:
1=Outer, 0=Inner  and 1=Whole, 0=Broken, for example 1,0=outer beam broken.
On closer inspection of the log, I seem to have mis-coded that...


I originally thought Mr Blue tit was the first look-in I'd had, as it was the first caught on camera, however the log showed otherwise, with some interest five days ago.  A quick re-visit of recorded footage showed a shadow briefly obscuring the entrance hole at the exact time of the logged event on the 24 April.  There's no way I would have spotted this so it shows the IR beams are doing their jobs.

I'm considering putting up a miniature gallery along the lines of 'Birds & insects that have made brief appearances in our nesting boxes'.  Fascinating viewing I'm sure !

?Coal Tit making brief appearance into owl squirrel box

Sunday, 20 April 2014

Side-View, Raspberry-Pi powered bird counting bird box

As I mentioned in an earlierpost, I've been looking to setup a small bird nesting box with camera feed that can be viewed from any internet-enabled device (PC, tablet, phone).  While there are plenty of solutions out there to directly connect an analogue camera to a TV, there are no affordable compact off the shelf 'stream-across-the-web' (or home network options).  

My 'Mark I' box is based on the side view 'Odd-Box' design, variants of which are available commercially from various UK retailers.  This design is interesting as it gives a 'side-on' perspective, rather than the usual 'top-down' view from the traditional nest box with camera at the top.  I've added an entrance counter which should allow me to monitor coming & goings from the box.   

My side-view, Raspberry-Pi powered bird counting nest box

As described in an earlier post, I've taken advantage of the Raspberry Pi's flexibility to connect to a variety of devices, and have hooked it up to a webcam to stream live footage of an owl nesting box, which  is currently intermittently occupied by squirrels.
  
Bird Activity Counter
I've also incorporated two entrance hole infra-red beams that when used together should be able to detect entry and exit from the box.  This is based on the bird box project in Andrew Robinson and Mike Cook's Raspberry Pi projects book:


The final chapter ' Chapter 17 - The Techno-Bird Box, a Wildlife Monitor' describes a method of utilising the PiFace interface board with the Raspberry Pi to record entry and exits to the box.  This YouTube video shows the sort of thing that is possible.
Update May  4 2014:  Python scripts for this aspect of the project are described in this post
   
Box Construction
The wiring, IR illuminators and detectors are housed in the multi-layer plywood section on the LHS of this picture.


All wiring is goes via a terminal block to the PiFace interface board + Raspberry Pi.  The box is powered via power over ethernet (PoE) using a TP-LinkTL-POE200 PoE kit.  The camera is a Microsoft Lifecam cinema.   The box is linked into my home network, and can be viewed from any connected device as a motion jpeg stream.

Video streaming
The LifeCam is capable of 1280x720 video, but unfortunately the viewing angle is too wide, and there's a gain in frame rate if I drop it to 800x600.  At this resolution I can also zoom in, which isn't possible at the higher resolution using the LifeCam.  I'm using mjpeg_streamer to stream the video across my network, and can get a framerate approaching 20fps, but limit it to approx 12fps as this is still perfectly adequate.

View from each end of the box (not web-cam view)
I haven't gone for artificial light in the box, and have instead cut a window into the box lid and put a sheet of transparent acrylic over the lid.  This seems to give plenty of natural light, and we'll see if the skylight puts them off or not. 

For a future 'Mark II' box, I'm planning to use the Raspberry Pi camera board as its a good resolution, cheap and much more compact.

Motion detection
The Raspberry Pi is essentially a small computer running Raspbian, a version of Linux.  This is an open-source operating system that benefits from a wide community of open-source software (read = free).  I'm currently taking advantage of the Lifecam's facility to stream mjpeg natively, which puts very little load on the Pi.  Optionally, you can run a program called 'motion' which analyses a video stream for movement configured to record any detected activity.  I haven't used this, as a while ago I setup a PC running iCode's iCatcher Console software which does the same thing.  This is windows based, commercial software, which operates on a per-camera licensing basis, so there is a per-camera cost involved. I have maxed-out my available iCatcher per-camera licences at the moment, so may look at using motion for the next nest box / feeder / whatever build.  Using this software, I can capture any activity and export to a video file, for example this week has seen plenty of squirrel mating in my Owl nest box.



If you exclude the motion detection (which can be setup for free on the Pi), the cost for this build would be approx £100, which when you compare to how much the cost of a TV-only analogue kit would cost is very favourable.  The 'downside' is that you have to build & program this yourself, but there are plenty of guides out there to help with that.

Mounting
Since we're not dealing with a battery or solar powered box, this had to be put up near a network point and power.  The advantage of a PoE setup is that I can run an ethernet cable a long distance from the house and send power and a data signal through it.  The TP-Link kit I've used allows a step down to either 12, 9 or 5V at the destination, so I've assumed that it must send a higher voltage down the wire.  My assumption is that since the step down occurs at the destination, there's no need to fiddle about with voltage drops if you planned to send 5V from the power source. 
To keep it simple, I'm mounting this one on the side of the house, and running ethernet cable through the wall.  My other similarly setup owl-come-squirrel box is set up exactly the same way, and is a good 150ft from the house.

This is a view from the lifecam camera with the box outside:

View from Bird box camera at 800x600 resolution

My main concern is that the electronics compartment gets a little warm, and I don't want to kill the Pi... hopefully being on North-East facing wall, it shouldn't get too hot.  The next version will incorporate some better ventilation.

I hope that I haven't left it too late putting this nest box up, but last season we have great tits nesting in May, so I'm ever hopeful!