Raspberry Pi Camera Setup - Motion detected movie creation (obsolete): Difference between revisions

From Wurst-Wasser.net
Jump to navigation Jump to search
Line 46: Line 46:
  exit 0
  exit 0
<del>* Make it executable</del>
<del>* Make it executable</del>
  <del>chmod +x webcam.cgi
  <del>chmod +x webcam.cgi</del>
</del>
This won't work very reliably, because this will occur:
stdout: mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates
No solution yet, so I decided to don't let [[motion]] execute the cgi, but crond.


=== Check if it works ===
=== Check if it works ===

Revision as of 13:21, 16 August 2013

This article describes the setup of the Raspberry Pi Camera with motion to take pictures on [1]motion.

Notes

Das muss noch in die Seite rein:

  • issue nicht lösbar
  • cgi weggeworfen
  • neues sh script in crond
  • neues dir mit dem snapshot in /var/www/webcam
  • motion.conf: netcam changed

Setup

Get package list

apt-get update

Update all packages

apt-get upgrade

Enable the camera

raspi-config

Raspicam01.png
Then answer the following stupid questions ("really enable?" and "reboot now?"), and you're done.

Configuration

Now we've set up drivers, we need to verknuspel[2] the Raspi Cam with motion. That is a bit tricky, since motion does not support the Raspi Cam. But it supports webcams. So we need to convert our Raspi Cam into a webcam.

Make the Pi take pictures

Since /usr/lib/cgi-bin/ is the default CGI-directory...

  • make sure, everyone can access the camera device[3]:
chmod o+rwx /dev/vchiq 
  • create a folder named webcam:
cd /usr/lib/cgi-gbin
mkdir webcam
chown pi webcam

* create this script named webcam.cgi:

#!/bin/bash
echo "Content-type: image/jpeg"
echo ""
#
# timeout should not be 0, since images will be to dark and are noisy
#raspistill --nopreview -t 1 -w 1024 -h 768 -o -
# 
# Since my cam is mounted wrong, I prefer to flip it :)
raspistill --nopreview -t 1 -w 1024 -h 768 -o - | convert - -flip -
#
#raspistill -t 0 -w 1024 -h 768 -o -
exit 0

* Make it executable

chmod +x webcam.cgi

This won't work very reliably, because this will occur:

stdout: mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

No solution yet, so I decided to don't let motion execute the cgi, but crond.

Check if it works

http://YOUR_PI_S_IPA/cgi-bin/webcam/webcam.cgi

Get motion to check 'em

Install motion

apt-get install motion

Configure motion

Edit /etc/motion/motion.conf:

netcam_url http://127.0.0.1/cgi-bin/webcam/webcam.cgi

and

target_dir /var/www/webcam-archive



  1. guess what! :)
  2. yes, I just coined the term. I hope it will make it! More about verknuspel!
  3. including web users