Optional erhältlich zu den PI Medellen ist die Rasppi CAM (z.B. bei Reichelt)

 

Die Einrichtubng der CAM ist hier sehr schön beschrieben.

Einrichtung Motion-Detection Software

siehe dazu auch:  Artikel in der PC-Welt

Vorausgesetzt wird, das die USB Cam ordnungsgemäß erkannt wurde.
Installieren der Motion Software

  1. sudo apt-get install motion          (19Mb)
    „/etc/init.d/motion“ --> YES
  2.  Motion manuell starten
    sudo /etc/init.d/motion start
  3.   (nur zum Testen bzw Fehler ermitteln)
    sudo motion
  4. Erweiterte Rechte vergeben
    sudo chgrp +r /etc/modtion/*.conf
  5. Konfiguration in /etc/motion/motion.conf
    webcam_ localhost off
  6. Browser 192.168.1.XXX:8081
  7. Kontrolle Bewegungserkennung (mittels FTP oder via ls)
    momentan liegen die Bilder in /tmp/motion
  8. Konfigurationen vornehmen (je nach Bedarf)

Einrichtung PI-Video

Mittels des Kommandos raspivid kann ein Video[stream] bereitgestellt werden.
Zu beachten ist, dass während das Kommand raspivid läuft keine Bilder mit der Cam aufgenommen werden können.
Will man ein Bild machen, so ist vorher das raspivid Kommand zu beende, da die Kamera als "globale" Ressource sonst blockiert ist.

Ich habe das ganze in 2 Scripte verpackt:

video.sh

startet den Videostream
raspivid -o - -t 0 -hf -w 600 -h 300 -fps 5 |cvlc stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:6666}' :demux=h264
 

novideo.sh

beendet den Videostream
pid=`ps -ef | grep -v grep|grep vlc| awk {'print $2'}`
if test $pid > 0 ; then  
   kill -9 $pid  
sleep 1
fi

Aufgerufen wird das ganze über das folgende Scrip

#!/bin/bash

./novideo.sh

xx=`date +%H%M`
echo Snapshoot $xx 
/home/pi/picture $xx

USER=xxxxxxxxxxxxxxx
PASSWD=xxxxxxxxxxxxxx

raspistill -t 0 -o /home/pi/smartcam/$xx.jpg

ftp -n webftp55.1blu.de < user $USER $PASSWD
binary
passive
cd picture/
lcd picture
put $xx.jpg
quit
SCRIPT

./video.sh &

Cron Eintrag (crontab  –e )

# m h  dom mon dow   command
* * * * * /home/pi/pic2ftp