I just got my Camera Board and a Model A Raspberry Pi to use as a security camera for my house. I had been using Motion with a Logitech C170 USB camera on my Model B board and it worked great except for the quality. I was expecting the Raspberry Pi Camera Board to show up as /dev/video0 but when I run Motion I get an error:

Failed to open video device /dev/video0: No such file or directory

The camera works fine with raspistill -d. This has to work with Motion as it has to take videos/pictures when movement is detected and I have to be able to access it from work.

This question was no good for me as it never answered my question and I'm not using python.

up vote 50 down vote accepted

You can access the camera board on /dev/video0 by running the command:

sudo modprobe bcm2835-v4l2

This will have to be run on every boot of the device. Or you can put modprobe bcm2835-v4l2 in /etc/rc.local to make it run on every boot automatically.

  • 9
    You can add the line to /etc/modules to get the kernel to insert the module on boot automatically. <code> echo "bcm2835-v4l2" | tee -a /etc/modules </code> Ensure you can run the command first <code> sudo modprobe bcm2835-v4l2 </code> – Drew Anderson Feb 3 '15 at 22:16
  • Note: it is an "L" not a "1" for bcm2835-v4l2. – Timothy L.J. Stewart Jan 28 at 23:47
  • why does this work ? what's the magic behind it. – AK_ Feb 12 at 2:06
  • is there any rationale behind it not being enabled automatically on every boot? Any clue why raspi-config doesn't do that when you enable the cam? – dethSwatch Sep 9 at 4:20

to load the model after each reboot, use this setting

  1. sudo nano /etc/modules
  2. enter bcm2835-v4l2
  3. exist and save the fle
  4. sudo reboot

The standard motion dosn't work with the RPI camera. There is a variant called motion-mmal in development which works with the RPI camera

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=44966&p=379561#p374790 is a forum chat on setting it up

http://www.codeproject.com/Articles/665518/Raspberry-Pi-as-low-cost-HD-surveillance-camera this is a guide on using motion mmal to set up a security camera.

  • The standard motion works fine through v4l2 after loading module bcm2835-v4l2. Though probably not as good as with MMAL. – scai Feb 15 '17 at 18:41

to get motion to work(out of the box) you can install the Userspace Video4Linux2

It will create the /dev/video0 device node correctly on the Raspberry Pi.

I have just followed the install instructions and not only does motion just work, the example(optional) motion.conf sets up the Pi as a streaming server so that you can access it remotely in a browser.

the developer is asking for donations, I am definitely going to contribute.

  • Some dead links. – nu everest May 18 '17 at 3:08

(from https://raspberrypi.stackexchange.com/a/18214/12486)

You will be able to access to the raspi camera like other V4L2 device using :

sudo modprobe bcm2835-v4l2

uv4l --driver raspicam --auto-video_nr

I had the same problem. I tried this, it set up /dev/video0 OK but it did not work with motion: http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=16

But then found this blog which seems to work: http://rbnrpi.wordpress.com/project-list/setting-up-wireless-motion-detect-cam/

Note that the motion-mmal apparently only supports 3 resolutions right now: 352x288; 640x480 and 1024*576

Hope this helps.

I had a similar problem.

Today it was working, the next day it died.

tried a couple of the stuff here and other procedures found on google.

I eventually fixed it by activating the I2C protocol in raspi confing.(didn't think that was the problem since from what i know the camera uses the CSI-2 protocol and I never tweaked with it)

I used motionpie https://github.com/ccrisan/motionPie to turn it into a IP cam.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.