Three's a Crowd

 

The easiest way I could think of to monitor the cat bowl is to have a fixed camera overhead.

If you're unsure you've fed your cat then whip out your phone and check to see if the cat bowl is full.

 

For this challenge I have already got two cameras working with a Raspberry Pi and OpenHAB.

One camera is one the Raspberry Pi hosting OpenHAB and the other is a PTZ (Pan, Tilt and Zoom) Network Camera.

 

Now I've got a third for the cat bowl. I've now configured another Raspberry Pi Model B+ with Camera to act as a network camera.

It was pretty easy to do using the Raspberry Pi version of motion-MMAL.

  • Install Raspbian (ensure you have the latest updates)
  • Enable Pi Camera
  • Install Raspberry Pi version of motion-MMAL
  • Install supporting libraries
  • Adjust the motion-MMAL configuration file to suit your needs
  • Start the application

 

And before you know it you can use a browser like FireFox and access the footage from the camera.

 

 

Always have a Plan B!

There's usually many ways to accomplish the same or similar result and there's not always the need for streaming video.

I just want to capture images from the remote RPi Camera and make it easily available for OpenHAB.

The easiest way I could think of was to install a lightweight web (HTTP) server and put pictures in the published area for OpenHAB to access it.

Sure enough there is a simple way to accomplish this with next to no knowledge or effort.

With the latest version of raspiban Wheezy with Pi Camera enabled the procedure is as follows;

 

Install lighttpd with sudo apt-get install lighttpd

This will automatically start the web service and publish the default installation page.

This can be tested from a remote web browser.

This will create folder /www/var that is published.

 

In this folder create another folder called images (/www/var/images).

This will be used to store the images from the camera to be published.

 

To enable OpenHAB to take snapshot on demand, the web server needs to be configured to respond to requests.

This is done quite easily with lighttp be enabling cgi-bin scripting.

To do this you need to add an entry into the /etc/lighttpd/lighttpd.conf file.

Under server modules add an item "mod-cgi",

 

To select the shells used for the cgi-bin based scripts add the following to the end of the .conf file

 

$HTTP["url"] =~ "^/cgi-bin/" {

    cgi-assign = ".py => "/usr/bin/python",

    cgi-assign = ".sh" => "/bin/bash" )

}

 

Create the cgi-bin folder (/var/www/cgi-bin) to house your scripts.

 

Then write up your server side scripts and configure the system security to do your bidding!