Wednesday, 18 January 2017

BirdBox2017: using motionEye & streamEye

After a couple of weeks of investigation, procrastination and frustration, I think I have reached a decision.

I am going to use motionEye to stream and display video to a remote laptop.

But this has meant a lot of upgrading to the heart of (what was) my 2015 bird box.

In my last BirdBox2017 post I outlined my ideas for adding a second camera to my existing systems.

bench testing my new system

While looking for ideas for the new Pi zero powered camera, which is to capture video from the outside of the box, I came across some work by Calin Crisan.

Calin has been busy working with Kenneth Lavrsen's "motion" software. Calin's motionEye software generates a server web page which allows you to view the motion stream, adjust video & motion settings, and access saved media.

But as you will see shortly, motionEye also has a lot of application flexibility.

One other notable aspect of Calin's work is that it is so well documented!

Pi Zero "outside" camera

For the external camera which is pointing to the box entrance, I have decided not to use motion capture. When the box entrance sensor turns on the power, both the internal and external Pi boards are powered up.

The internal Pi will still record the number of times the entrance beam is broken, and will also capture video clips via motion. But the external camera will just stream video, and this will be viewable on a remote laptop.

On the Pi Zero used for the external camera, I have installed streamEyeOS. This is a small operating system for the Pi which captures and streams mjpeg video from the RaspiCam. It has a "Fast Network Camera" option which replaces the motion camera driver with streamEye and a Python program called This uses the GPU to produce higher resolution and frame rate than is possible with motion (which just uses the cpu).

Initially I'm using this fast mode, but only running with a resolution of 640x480 at 15fps.

motionEye web interface for the Pi Zero external camera

Once the system is deployed I can play around with settings, I just don't want to use up too much of my wifi bandwidth.

Bird box internal camera system

For this system, things got very complicated. I needed to update the software on my Pi to use motionEye, but found the new Pixel Raspbian was slowing down the boot time (and everything else) on my Raspberry Pi A+. With only 256MB of RAM, the whole thing was frustratingly slow, but I don't think it was anything to do with motionEye.

So I took the plunge and replaced the old board with a newer Pi2B. I think the extra RAM made a massive different, and I can now happily do lots of things, like open the Gambas IDE while other stuff is running.

One downside with using the Pi2B is the increase in current draw from my 12V 12Ahr battery.

I was hoping the new A+ would have been available during 2016, but it looks like it is still a few months away. This will probably be my first choice as replacement for the A+ assuming it has 1GB of RAM.

One upside for the Pi2B is that it boots and starts streaming in less than 20 seconds!

For this Pi I'm using motionEye and streamEye. I have modified my Gambas application which previously enabled/disabled motion, but now does the same thing to motionEye.

yes, the Pi2B cpu runs a good 10'C hotter than it did on the A+

I have also added a video stream option using RaspiMjpeg + streamEye. And I still have the option of capturing video and stills using RaspiVid and RaspiStill.

Remote display

On my remote laptop I have several options for accessing, controlling and viewing stuff. For the Gambas app above I still need to VNC into the main (internal) Pi. I should really get rid of this and replace with an active webpage (JavaScript?) so I would not have to boot into a desktop, and would be able to disable HDMI and save another 20-30mA.

SSH is enabled on both Pi boards and I can use "Connect to server" to access files via a remote gui file manager.

MotionEye can be accessed via a remote webbrowser. For the Pi Zero this is just the IP address (it uses port 80). For the Pi2B it is the IP address + port 8765. I can also pick up just a stream (Pi Zero is ip:8081, Pi2B with motion is ip:8081 or faster stream is ip:8089).

With this flexibility I can also play and record video streams using VLC media on a remote laptop.

But I have also installed motionEye on my remote laptop, which means I have the option of motion stream, main stream and external stream.

Had to move the box camera off centre. Now the entrance hole is not in the centre!

In the two video streams above, it is a shame that the external and internal entrance holes don't line up. This is because the Pi2B is 50% longer than the A+ that it replaced. So the camera is now badly off centre, even though the bottom of the box appears central.

It is also a pity that the two images are not scaled the same, but I did not want the external camera box too near the hole.

The solder sucker? This is just to stop the system shutting down after 20 minutes of inactivity. It also highlights the hole alignment issue.

No comments:

Post a Comment