Setup the Camera and PIR Motion Sensor Module on your Raspberry Pi

In this post I will show you how to setup Raspberry Pi Camera Module and the Passive Infrared (PIR) Motion Sensor to your Raspberry Pi.

I will also show the basic usage of using raspistill and raspivid to take a photo and video. I will write up another post on using Python to interact with the Camera and PIR module to take photos when motion is detected.

What you will need:

I'm using the following:

  • Raspberry Pi (Raspberry Pi 2 Model B)
  • Camera Module (C3 camera NOIR 8MP)
  • 15 Way Flat Cable for the Camera
  • PIR Infrared Motion Sensor (HC-SR501)
  • Jumper Cables

Connect the Camera

The camera:

Lift the holders on the side and you will find that the silver side will face the soldered side and the blue tape will face the ethernet module.

Slide in and close the holders.

Connect the PIR Module

Connect the jumpers on the module, starting from the top to bottom, black, brown, red

as illustrated below:

Note: The image above has a broken link and a updated post can be viewed how to connect the PIR module and how to use Python to interact with the module.

Then connect the other end on the GPIO pins of the raspberry pi: 2, 4, 26

Software Side

I have formatted my Pi with Raspbian Stretch, you can follow these instructions to load the OS onto your device.

Boot your Raspberry Pi, after you logged on enter the raspi-config section:

$ sudo raspi-config

Select the Interfacing Options section and Select Camera to enable the camera, then save and reboot:

$ sudo reboot

Interact with the Camera

This is just the basics to take a photo and video, I will write up another post on how to use a programming language like Python to interact with the camera.

To take a Photo:

$ raspistill -o /home/pi/helloworld-photo.jpg

To take a Video for 10 Seconds:

$ raspivid -o /home/pi/helloworld-video.h264 -t 10000

You will need VLC to view the video.

Interact with the PIR Motion Sensor

Have a look at this post on how to use python to interact with the PIR module