Chicken Coop Livestream

We have two chickens, and their coop is located at the back of the garden. Looking for a project idea for element14’s Going Green challenge, I decided to build a Pi-based streaming device to check on the chickens and check for eggs.

The idea is to use a Pi Zero with Pi NoIR and a set of IR LEDs which can be enabled/disabled on demand.

Hardware

The hardware required for this project is:

Because the coop is located at the back of the garden, I opted for a regular Pi Zero with external wifi dongle, ensuring decent connectivity to my home network.

A Pi NoIR combined with Bright Pi’s IR LEDs takes care of the night vision in the coop. By glueing Bright Pi to the case’s lid and connecting to the Pi’s GPIO from the back, a neat little package is obtained.

I’m also experimenting with a 10W solar panel I had at hand from an older kickstarter. The idea would be to have everything powered from a USB battery pack, while recharging it during the day.

This slideshow requires JavaScript.

Software

On the software side of the project, I went for the all-in solution provided by MotionEyeOS, a streaming OS compatible with the Raspberry Pi.

After downloading the software image for my device, I flashed it onto an SD card using Etcher. I copied my “wpa_supplicant.conf” file to the SD card, before ejecting and inserting it in the Pi, as per the Wifi Preconfiguration procedure. Upon first boot, the Pi automatically connected to the wireless network and set up the camera. I honestly didn’t expect the entire setup to be this easy.

Browsing to the web interface, various options are available to configure frame rate, resolution, camera name, etc …

MotionEye also allows the creation of action buttons. Just what I need in order to enable/disable the BrightPi’s IR LEDs.

In the “/data/etc” folder, I created two files called “light_on_1” and “light_off_1”.

Inside those files, a short bit of code to control the Bright Pi via I2C.

MotionEye detects these scripts, and adds the button overlays to the video streams.

Power Consumption

One of the goals of this project, is to try to power it from a battery pack and solar panel if possible. In order to hope to achieve that, I tried to lower the power consumption of the project using various little tricks.

A first change is to disable the Pi’s and camera’s onboard LED. This can be achieved by editing “/boot/config.txt” and appending following lines:

Another change that can be applied, is to disable the HDMI output, as no display is required for this project. This can be done by adding a cron job using the “crontab -e” command, and append:

While previous changes are applicable to Raspbian, there are some MotionEye specific changes that can be applied as well.

By default, MotionEye enables various services such as FTP, Samba and SSH. Other features such as motion detection are also enabled. It’s always a good idea to disable anything you don’t need, as not only will this save a little bit of power, it will also increase security.

It’s a good idea to explore the settings, including the advanced ones, and disable anything you don’t require.

Finally, the streaming settings play a role as well. The lower the resolution and frame rate, the lower the power consumption. It’s worth experimenting with the settings depending on your streaming needs.

Here are some quick measurements after applying above tricks:

MeasurementComment
140mAidle
220mAstreaming 320x200 @ 2fps
300-400mAstreaming 1920x1080 @ 30fps

As I don’t need quality streaming, the lower resolution is fine for my application. Taking a bit of buffer, the average power consumption is 250mA @ 5V, or 1.25W while streaming. About 30W / day.

My first battery pack had a 5200mAh capacity, but as the cells are 3.7V boosted to 5V, this results (ideally) in 19Wh. A conversion loss of 10% should be taken into account, meaning the battery would discharge completely after a bit more than half a day.

The current battery pack has a capacity of 20000mAh, (ideally) resulting in about 74Wh. Applying the same conversion loss, this battery would still last about two days without recharging.

My solar panel can generate 10W of power in perfect conditions. Assuming an average of 6 hours of sun during the day in summer, in theory, 60W of energy could be generated.

Long term testing will have to determine if this is a viable solution, though the limited sunlight during the winter will certainly pose a problem.

Infrared

Finally, a little night test using the Bright Pi and Pi NoIR combination.

The IR LEDs can be enabled/disabled on command using the action buttons, as demonstrated in the video below.

 

Conclusion

Though the solar charging will probably not work out in its current form, it remains a good experiment which will hopefully yield useful data.

The streamer itself works as expected, with MotionEyeOS making the setup and configuration extremely easy. The combination of Bright Pi and Pi NoIR is a good one as well, and being able to control both from within MotionEye is great.

 

What would you keep an eye on with such a streaming device? Have experience with other software? Let me know in the comments!

13 thoughts on “Chicken Coop Livestream”

  1. I suggest that you also add a DHT22 or similar temperature/humidity monitor an code in some alert conditions that trigger some sort of alarm or notification. You can then run to the monitor when the alarm goes off.

  2. Hello, any test if you’re able to detect there are some eggs available based on image detection and recognition?

    1. The latency depends on resolution and framerate. The lower both are, the lower the latency.
      I’d say about 1 second delay at lower resolutions.

      I’m not recording, only streaming 🙂

Leave a Reply to Frederick Cancel reply

Your email address will not be published. Required fields are marked *