Bird box gate
For the last couple of years I have had a bird box mounted on the wall outside my room. All the time I have had a USB webcam inside so I (and a lot of other people including the kid’s school) could monitor the progress of nest building all the way to the new birds leaving.
When watching the parents bringing food to their chick I started wondering just how many times they fly in and out of that box. So now I’m working on a ‘Bird box gate’ that will count when a bird goes in to the box and when it leaves, and logging it on a SD card or live on a SQL server on my main server (haven’t decided on this yet).
But this is what I have got this fare;
An IR gate on each side of the wall of the bird box. One cable that I can run through the wall and hook up to my FEZ Domino inside.
I spent some time on the programming bit. It might seem straight forward but problems arise when a bird just peeks its head in and then flies away. Even the tail feathers might give some sort of false reading on its way in. So what I came up with is this;
Every time the state of the inside IR gate or the outside IR gate changes I add a character to a string. The logic being;
Outside gate goes high add “A”
Outside gate goes low add “B”
Inside gate goes high add “C”
Inside gate goes low add “D”
So if a bird is on its way inn I should get “ACBD” as the first 4 characters of the string. If I get “CADB” it’s on its way out. The rest of the string will be ignored as that’s probably false signals from the tail feathers.
So what if the bird is just peeking in? Then the string would read “AB” and nothing else. The system clears the string every 500ms from last trigger so hopefully this would work.
I’m using a FEZ Domino for this but as you see, there is not much going on.
I’m still not sure if I should just keep the data on a memory card, or go all the way and hook it up to my network. I would be great to see the data in real time.
A well, I have the whole autumn and winter to decide.
One of the things that has me worried is the loss of power. That would reset the internal clock and I would get the wrong date stamp. Then I remembered that the FEZ Domino has an internal RTC and with a coin battery I will have correct time even if the system restarts.
The other thing is how to communicate with my SQL server. I could buy a Ethernet shield but that’s about $40,-. So I’ll think I will use the USB directly from the Domino and hook it up to my Windows Home server and make a small program on that to take data from the microcontroller and put it into the SQL server.