User Tools

Site Tools


raspberry:rpiprojects:rpiobservationcamera

:!: THIS GUIDE IS NOT YET FULLY TESTED :!:

ParrotPi (or whatever you want to observe with it) in 10 steps

First of all, this implementation uses the Motion software. Not any version but a specially tweaked one that supports the PiCamera module for image taking. Probably we will see PiCamera support also on the standard version of Motion in the future, but for now let's use this how-to. And again this is not my invention or anything, I only adjusted the one or other thing to fit my purpose. For my setup, you simply need a “naked” Raspbian. The software will be running under user pi.

:!: Befor you even start, make sure your Raspberry Pi is configured for and working with the PiCamera module.

  1. Get the software prerequisites fixed
    sudo apt-get update
    sudo apt-get install libjpeg62 libjpeg62-dev libavformat53 libavformat-dev libavcodec53 libavcodec-dev libavutil51 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev
  2. Next we go to a working directory which we can clean up afterwards
    mkdir /tmp/motionsetup
    cd /tmp/motionsetup
  3. Then get the special Motion software and unpack it
    wget https://www.dropbox.com/s/xdfcxm5hu71s97d/motion-mmal.tar.gz
    tar xvfz motion-mmal.tar.gz

    This will extract into the binary motion and a sample configuration motion-mmalcom.conf.

  4. We need to move the motion binary now to /usr/bin/
    sudo mv motion /usr/bin/motion

    and we can clean up the other two files which we do not need any more (of course you can keep them if you like to)

    rm motion-*
  5. Then I carried on by downloading the project files which comprise of a config file, an init.d-script and a HTML wrapper. For my purpose I had to modify the first two a bit. You can download them below from a), b) and c) if you like.
    :WARNING: If you use the mentioned project files, the Motion binary and the init.d-script are both called motion. If you did not copy the motion binary to /usr/bin/ before, you might overwrite it with the init.d-script.
    1. My tweaked config file - I do not want to actually store videos or pictures. For me this is just a live webcam.
    2. My init.d-script - I changed the user from motion to pi because I didn't have the official motion package installed before and didn't want to create an extra user.
    3. And the simple HTML wrapper which I modified to show the picture with 100% browser width and retaining the aspect ration.

  6. My working directory sports now the following files
    motion.conf
    motion.service
    weatherpi.html

  7. Next we need to create a file called motion.default and add the following lines
    # set 'yes' to enable the motion daemon
    start_motion_daemon=yes
  8. We now have all necessary files and can start putting them where they belong
    motion.conf
    motion.default
    motion.service
    weatherpi.html
    sudo mv motion.conf /etc/motion.conf
    sudo mv motion.default /etc/default/motion
    sudo mv motion.service /etc/init.d/motion
    sudo chmod 644 /etc/motion.conf
    sudo chmod 644 /etc/default/motion
    sudo chmod 755 /etc/init.d/motion
    sudo chown root.root /etc/motion.conf
    sudo chown root.root /etc/default/motion
    sudo chown root.root /etc/init.d/motion
  9. Next up is the installation of the init.d-script
    sudo update-rc.d motion defaults

    If you want to uninstall the service later, this can be done by

    sudo update-rc.d -f motion remove
  10. Finally restart the Raspberry and keep your fingers crossed. ;-)
    After about 30 to 60 seconds you should be able to connect to your webcam stream via a webbrowser on <ip-of-your-raspi>:8090 or connect via e.g. VLC.

If you payed attention, you recognise that there is still the HTTP wrapper in our working directory. You could install a web server on your Pi, put the wrapper into its htdocs directory and add localhost:8090 as image source. Or you can put it on another web server and point it to your ParrotPi. Or just skip this if you are fine with the results so far.

raspberry/rpiprojects/rpiobservationcamera.txt · Last modified: 2014/01/09 10:41 by christoph