38

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.

11chubby11
  • 4,784
  • 5
  • 25
  • 32

8 Answers8

57

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.

11chubby11
  • 4,784
  • 5
  • 25
  • 32
11

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
jefwu
  • 111
  • 1
  • 3
5

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.

Graeme
  • 172
  • 2
  • 2
    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
2

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.

rob
  • 2,803
  • 2
  • 21
  • 31
2

(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

mpromonet
  • 1,124
  • 18
  • 37
1

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.

0

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)

Daniel
  • 1
-1

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

Aaron
  • 141
  • 6