Motion detector

The Raspberry Pi camera module can take picture when a motion occurs, so you can use it for surveillance purposes. Here is how this can be done:

1. First, make sure that your Raspberry Pi is running the latest firmware by running the sudo rpi-update command:

rpi update

2. If not already installed, install the picamera python module by using the sudo apt-get install python-picamera command in the terminal:

install picamera

3. You will also need to install Python Imaging Library (PIL) to add image processing catabilities to your Python interpreter. This can be done by running the sudo apt-get install python-imaging-tk command in the terminal:

install python imaging tk

4. Now, copy the code on this link to the text editor of your choice: motion.txt

Make sure you get the right indentation of the code. Save the file with the extension .py.

5. Make the file executable by running the chmod +x FILENAME command:

chmod file

6. Run the script with the python FILENAME command:

start motion detection

That’s it! Your Raspberry Pi should now detect motion and take a picture every time it happens.

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019