Archive | December 2015

Raspberry Pi B with Camera Module and Motion

I was struggling to find a step by step process for getting the camera module + motion up and running on the pi with recent instructions due to broken links and missing repositories so I figured I’d write up what worked for me as of

Dec 23, 2015

This is using a raspberry pi B, 2015-11-21-raspbian-jessie-lite, and an ethernet connection to the internet.

I initially set mine up using the camera module and a usb wifi module but those two together seem to draw more current than the board can supply, which caused brown outs and a corrupted sd card.

To the steps:

As with most things, start with

sudo apt-get update

sudo apt-get upgrade

 Reboot

sudo reboot

Install video dependencies (this was the hard part to find lately)

sudo apt-get install -y libjpeg-dev libavformat56 libavformat-dev libavcodec56 libavcodec-dev libavutil54 libavutil-dev libc6-dev zlib1g-dev libmysqlclient18 libmysqlclient-dev libpq5 libpq-dev

Install motion and its dependencies

sudo apt-get install motion

Update Oct 29, 2016: The newer versions of motion available for raspberry pi now have mmal support built in so the instructions struck through below should no longer be necessary. 

From your home directory download this prebuild version of the motion application

wget https://www.dropbox.com/s/6ruqgv1h65zufr6/motion-mmal-lowflyerUK-20151114.tar.gz -O motion-mmal-lowflyerUK-20151114.tar.gz

Unpack it

tar -zxvf motion-mmal-lowflyerUK-20151114.tar.gz

Copy the unpacked version of motion over the stock one

sudo cp ./motion /usr/bin/motion

Copy the unpacked motion-mmalcam-both.conf to /etc/motion.conf

sudo cp ./motion-mmalcam-both.conf /etc/motion.conf

Run raspi-config and enable the camera, and any other pi options you like

sudo raspi-config

Reboot again

sudo reboot

Test it

motion

If the application seems to be running ok then at this point you should be able to browse to http://:8081 and see a live view of your camera.

If that’s working, and you’d prefer motion to start on boot, edit the file at /etc/default/motion, and change start_motion_daemon=yes

The bulk of this information was harvested from this forum thread, thanks to all the guys on that thread for their explainations. Hopefully this consolidation of info will help some people.

Here’s a link to the current motion github https://github.com/Motion-Project/motion