Configuration for the 3EYE

From B-Wiki
Jump to navigation Jump to search

Original post:

Just managed to get my PS3 Eye camera working with the Pi, so thought I'd share how it's done in Debian. The following steps will get the camera and Pi working together as a simple motion detection device with a web stream that you can view on your local network:

  1. Install the 'motion' package (

Code: Select all

sudo apt-get install motion

  1. Install the ffmpeg package:

Code: Select all

sudo apt-get install ffmpeg

  1. Edit the /etc/motion/motion.conf file and change the following setting from 'on' to 'off'. This is optional, but will allow the camera to be viewed using another PC on your local network:

Code: Select all

webcam_localhost off

  1. If you wish to have basic control over the camera from a web browser (see step 11) then you can change the following setting in the same file to 'off':

Code: Select all

control_localhost off

  1. Since the PS3 Eye camera is capable of capturing at a resolution of 640x480, we can make the following further changes to the /etc/motion.conf file:

Code: Select all

width 640 height 640

  1. Plug your PS3 Eye camera into a USB port on the Pi.
  1. Find out the IP Address of your Pi and make a note of it for step 10:

Code: Select all

ifconfig This will give the following output: Code: Select all

eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx

         inet addr:  Bcast:  Mask:
         inet6 addr: fe80::ba27:ebff:fe40:357a/64 Scope:Link
         RX packets:31800 errors:0 dropped:0 overruns:0 frame:0
         TX packets:27108 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:20174919 (19.2 MiB)  TX bytes:29838750 (28.4 MiB)

The address in the above example is

  1. Start up the motion application. Note that it has no GUI and can be run from the command line when you first start up the Pi. It doesn't need to run within startx:

Code: Select all

motion -n

  1. This will run the software in command-line mode, displaying startup information and errors directly to the console. It also allows it to be stopped using Ctrl-C. If you want to run the software in the background as a 'daemon', simply type 'motion' without the -n switch.
  1. If everything has worked okay, you should be able to go to another computer on your network and browse to your Pi's address to see the camera output:

Code: Select all Using your Pi's address of course!

  1. You can also browse to the feed on the Pi itself, although this will only work in Chrome and not Midori.
  1. If you browse to the 'control port' address below, you also get rudimentary control over the motion software:

Code: Select all 13. Since this is a motion detection package, it automatically detects movement on the camera and creates '.jpg' image and '.swf' video snapshots each time it sees movement on the camera. These are stored in the following directory: Code: Select all


  1. Note that these files will build up quite quickly if the camera is pointed at something that moves a lot, so make sure you have plenty of space on your sd card. Also, since the files are stored in /tmp, they will be deleted each time you reboot your Pi.

Scratching the Surface... The above instructions should be enough to get you going, but the Motion package seems to be capable of a great deal more, so it's worth having a good read of the Motion website ( to see what else it can do.

Some things you could have a play with:

  • Baby/Pet monitor
  • Security camera
  • Automatically email pictures of movement to you (catch the thief who is stealing from your chocolate stash!)
  • Time lapse camera (plants growing, weather, sunrise, etc)

Please post any interesting configurations/uses here!

Edit 1: I should have pointed out that Motion will work with other USB cameras not just the PS Eye. I couldn't say which ones, but if anyone gets others working then again post the results here.

Configure Octolapse

<syntaxhighlight lang="Bash">

  1. !/bin/sh
  2. Put the arguments sent by Octolapse into variables for easy use


  1. Check to see if the snapshot directory exists

if [ ! -d "${SNAPSHOT_DIRECTORY}" ]; then

 echo "Creating directory: ${SNAPSHOT_DIRECTORY}"


  1. IMPORTANT - You must add gphoto2 to your /etc/sudoers file in order to execute gphoto2 without sudo
  2. otherwise the following line will fail.
  3. edit the /etc/sudoers file
  4. add at the end
  5. pi ALL = (root) NOPASSWD: /usr/bin/motion

sudo gphoto2 --capture-image-and-download --filename "${SNAPSHOT_FULL_PATH}"

if [ ! -f "${SNAPSHOT_FULL_PATH}" ]; then

 echo "The snapshot was not found in the expected directory: '${SNAPSHOT_FULL_PATH}'." >&2
 exit 1

fi </syntaxhighlight>

Configure snapshot script

<syntaxhighlight lang="Bash"> curl -s http://localhost:8082/0/action/snapshot > /dev/null </syntaxhighlight>