Usb Cam


  1. install motion
  2. enable user to use motion
  3. configure motion.conf
  4. access via network

1) install motion

apt-get install motion

1.1) RASPI: load module to create /dev/video0 for Raspicam

sudo modprobe bcm2835-v4l2

if it works you should get a


that you didn’t have before.
To permanently load the module at startup add the line to /etc/modules

# camera with v4l2 driver

2) enable user to use motion
To enable an user to run motion, it is advantageous to create a folder for motion and copy the configuration file to this folder.
Motion should be executed in this folder to apply the configuration in motion.conf.

mkdir /home/debian/motion
cp /etc/motion/motion.conf /home/debian/motion

3) configure motion.conf
disable daemon mode for easier testing

deamon off

select video device

videodevice /dev/video0
# Threshold for number of changed pixels in an image that
# triggers motion detection (default: 1500)
threshold 13500

stores pictures into this folder

# Target base directory for pictures and films
# Recommended to use absolute path. (Default: current working directory)
#target_dir /var/lib/motion
target_dir /home/debian/motion

enables access via network

# Restrict control connections to localhost only (default: on)
webcontrol_localhost off
# Output for http server, select off to choose raw text plain (default: on)
webcontrol_html_output off

4) run motion and access via network
run motion


and access the camera live pictures via

5) Start at daemon at startup
Edit the "/etc/motion/motion.conf" file and change to

deamon off

Make sure the "/etc/motion/motion.conf" file hast the following rights

-rw-r----- 1 root motion 27861 Aug  7 15:27 motion.conf

To enable motion to run as a daemon on startup edit /etc/default/motion


Next enable motion by entering the following at the command line:

sudo systemctl enable motion

Finally reboot. You can confirm motion is running by checking the output from the following command:

sudo service motion status
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License