The screenshot below shows all five of my currently active bird boxes. The foot in the top Left box belongs to a blue tit that spends quite a lot of time in there the moment (roosts too). The temperature graph and widgets are populated by a temp + humidity sensor in the bottom R box that logs to its own internal environment every minute - the data really is an in-box box environment monitor.
EDIT Nov 2019: New blog post describing addition of web-sourced weather data to grafana
Prerequisites.. quite a lot of groundwork. This project relies on various stuff already existing:
(1) Multiple birdbox camera streams
Most of mine use Raspberry Pi ZeroW mini computers + v2 camera modules running motion capture & streaming software called pikrellcam. The top L one is a motion jpeg stream from a webcam on an early first raspberry pi model that has been going strong since 2014, the camera window could do with a clean though, our early evening roosting blue tit is present in this one:
(2) Some environmental data.
The aim is to present environmental data relevant to to the camera feeds. The bottom R bird box has a sensor that logs its internal temp & humidity every minute to a mysql database, and is used to populate the temperature plot:
Temperature plot over time, current humidity and temps also showing |
Equally there are plenty of free sources of weather data that could be used to provide a feed - it would be fun to see what the weather is locally too.
(3) A 'video dashboard'
The main point of this post. The dashboard runs on the newest model from the Raspberry pi foundation, the Model 4B (4Gb ram version). This has faster wired networking, more ram available, and generally more processing ooph. I would NOT advocate putting one in a bird box unless you're planning on keeping roosting birds warm over the winter. Mine sits 'headless' (ie with no monitor/keyboard etc) in the lounge behind the TV. I've set it up with fixed IP address (wired, not wireless), and is accessed via SSH from a laptop. I'm not going into detail for that as there are countless 'how-to's' out there. Lets call this machine 'Hub-Pi'.
Hub-Pi setup as follows
Docker
Docker provides a seamless(ish) way of running 'OS-level virtualization software in packages called containers'. Basically there are a lot of freely available pre-configured software 'images' that allow rapid deployment of software without having to fiddle about with setup. I've used a Docker image of a dashboard application called Grafana.
Install Docker on Hub-Pi: I used the guide on this site, up to the bit about 'swarming' (ignore from then).
Docker works by first downloading a specified image. It then creates a live 'container' from that which is what you 'do stuff with'. The 'docker run...' command specifies how the resulting container is configured. If a container is deleted then all configuration data within the container is lost and you need to re-create a container from the original image and loose all your work in the process. You can 'commit' a container back to a fresh image at any time, again Google is your friend.
Install Grafana Docker image: Docker images are supposed to run on any hardware running Docker... sort of. A base image is built with respect to the architecture of the CPU of the machine it runs on. This basically means that Raspberry Pis are different to PCs (Arm vs AMD64). I'm not totally clear on the difference, but an image built for one may not work on the other. Many images are built for both CPU architecture and Docker intuitively picks the right one to run. Mostly.
On writing this, the most recent Grafana image is 6.4.3. The Arm (is for Raspberry pi) version is somehow broken, so I had to revert back to version 6.3.6, which runs fine. The Docker command to pull down the right Grafana image and create a Docker container that runs it is...
docker run -d --name=grafana -p 3000:3000 grafana/grafana:6.3.6
If you omit the :6.3.6 bit you'll get the current image which may be fixed in a future version, but didi not work for me.
This command is saying:
- Pull down the v6.3.6 of the Grafana image from DOckerHub.
- Run it (make container) and forward port 3000 to the host computers port 3000.
- Assuming the container runs, if you navigate to the Pi's IP address in a web browser that you fixed earlier, using port 3000 (http://HubPiIPaddressHere:3000), if its connected to a screen & keyboard use localhost:3000 directly then you get to the Grafana main login screen where you can assign a new password
To make a camera feed in Grafana, got to..
Add Panel, then choose 'Text' from the visualisation options.
Based on the two types of video feds that I currently have, I edited the text in html mode as shown below.
My network video streams are of two flavours:
(1) Using webcams to generate a motion JPEG (MJPEG) stream, add the following to the html:
<img src="http://XXX.XXX.X.XX:YYY/?action=stream">
where XXX.XXX.X.XX is the IP address of the remote source and YYYY is the port it streams from
(2) Using Raspberry Pi v2 camera modules and pikrellcam software, add the following to the html:
<a href="http://XXX.XXX.X.XX" target="_blank"/a>
<img src="http://XXX.XXX.X.XX/mjpeg_stream.php"">
Where XXX.XXX.X.XX - the IP address of the remote Pi running pikrellcam. This also adds a convenient hyperlink to the video in the dashboard to the main pikrellcam page for that camera where motion captured video can be reviewed.
Once a video feed is added you can manually drag it about and resize it to fit your screen. Simple.
Potential developments...
This is an early version. I plan to add in local weather data, e.g. from https://www.wunderground.com/. I have entrance hole activity counter on one of my boxes (soon three), so it would be good to see a plot of activity associated with each video feed too.
UPDATE Nov 2019: see a new post which discribes the addition of a live weather feed
https://nestboxtech.blogspot.com/2019/11/birdbox-camera-dashboard-now-with-live.html
I am very impressed with your system. It should allow you and your family to get a better appreciation for the way that garden birds live, and for the variations in behaviour between individuals.
ReplyDeleteWe have only seen birds sheltering in boxes by chance, as I've never had a 'tidy' enough system that I could leave running throughout the year. I thought small birds generally stayed out of boxes (unless the weather is really bad) because it can be dangerous to be trapped in a box with only one way out. Just shows that even birds are individuals.
Re: weather data, I've been using OpenWeatherMap for a few years (https://openweathermap.org/current) which has been simple, free and reliable.
We have already seen large mixed tit flocks coming to our feeders; sometimes 30+ including coal, blue, great, long-tail & marsh. Its costing a fortune in sunflower seeds/hearts and peanuts!
Thanks Steve, THere's quite a lot of boxes in the area, we get roosting bird in one most nights, they tend to favour one box for a bit then move on. they only roost in the closed boxes (not the open fronted ones). The Blue Tit above has spent ?half of today in the box at the top right of that picture. Thanks for the openweathermap suggestion, I'll look into it
ReplyDelete"The Blue Tit above has spent ?half of today in the box..."
ReplyDeleteThat sounds worrying. It should be stuffing food into beak for most of the hours of daylight, if it is going to stand a chance of surviving the winter ahead.
Ever seen a great tit with a bright white tail? We have one that I've be trying to photograph. It just looks like someone has used him to stir a tin of white paint. Its only the tail, the rest of the body is normal.