Raspberry Pi & PS2 EyeToy

Last week I finally got around and bought my first Raspberry Pi. Getting it up and running with Raspbian via Noobs was a breeze and after playing around with the OS and Python for a while I decided to get some real use out of this little machine. My first experiment aimed at a home security camera. As I did not want to invest in additional hardware, I used what I could find in the household’s scrap heap – in this case a no-longer-in-active-use PS2 EyeToy camera.
My first intention was to use SimpleCV and Python to take regular snapshots and let a rudimentary WebAPI expose the latest image to the outside world. The code for this would be very simple and easy to extend with additional features. But, this experiment failed as I could not get a proper driver for the EyeToy working with SimpleCV.

My next test was to use an open-source tool for talking to the EyeToy. I tested Motion and it connected right away with the camera. Motion is a very powerful motion detection tool with tons of configuration options. The features that I was interested in were available:

  • Take a photo at a regular interval
  • Expose the photo via a web interface
  • Security options for the web interface

Basically, to get it up and running for my purposes, these where the steps I used:

  1. Install motion
    sudo apt-get install motion
  2. Change the default settings to suite my needs:
    in /etc/motion/motion.config:
    * Turn off storing of movies and photo sequences created after a motion is detected (it would eat up the small SD card on my Raspberry otherwise)
    * Expose the live streaming web interface to a dedicated port
    * Add a login for the web interface
  3. Get the motion service working (see section below)
  4. In my router, add a port-forwarding to my Raspberry Pi and the port used by motion

Motion service

Motion can be started manually from the command line, but the installer adds an init.d-service so that motion is started as daemon process when the Raspberry Pi boots. I had to add r+w permissions on three files to make the service work though:

chmod u=rw,g=rw,o=rw /tmp/motion.log
chmod u=rw,g=rw,o=rw /var/run/motion/motion.pid
chmod u=rw,g=rw,o=rw /etc/motion/motion.conf

I also had to set start_motion_daemon=yes in this file


If you still have problems you can switch to the motion user (created by the motion installer) and start motion manually to view any errors.

sudo su -s /bin/bash motion

My motion configuration

motion.config has so many options that it can be hard to get started. Here are the settings that I use (the settings that are different from the default configuration), if anyone reading this wants to use the same setup that I have:

logfile /tmp/motion.log   # log to this file
output_pictures off       # don't store images
ffmpeg_output_movies off  # don't store videos
stream_localhost off      # allow access outside localhost
stream_auth_method 1      # use basic authentication for access
stream_authentication USER:PWD

Where USER and PWD is the authentication that you want to use for accessing the image stream from a browser.


The EyeToy does not produce high-quality images and has a hard time in badly lit surroundings, but as a first IoT-experiment it is sufficient and now I can keep an “eye” (though not in HQ) on parts of our home from a web browser while being away. With the correct setup, motion provides streaming from USB cams in a simple way.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: