Motion Detector Pi


Any actions and or activities related to the material contained within this Website is solely your responsibility. The misuse of the information in this website can result in criminal charges brought against the persons in question. Cyber Security Associates Limited, will not be held responsible for any criminal charges brought against any individuals misusing the information in these projects to break the law

Please ensure you are using the latest SD Card image which is available here.


Teacher Overview

The Raspberry Pi camera is a compact camera that can directly interface with the Raspberry Pi chipset. It is important that the students understand that the camera connector (CSI) can be difficult to handle but is very delicate as it holds the camera ribbon in place and makes sure there is a firm connection. The size of both the Raspberry Pi and the camera make this project very versatile and can be fit into many different types of environments. If the Raspberry Pi has a waterproof case, then this could also double up as a wildlife camera as well as providing security for sensitive areas. The software of this project works on the principle of pixel walking. Pixels are the units that a screen is measured in and there can be both very small numbers of pixels and very high numbers of pixels present. 4K resolution is currently the best resolution but there are companies like Samsung and LG that are also researching 8K and higher to make the picture even more detailed and defined.

This project analyses an image and then compares 2 images together to detect a difference in the number of pixels to then start recording. This process is called pixel walking and is very efficient as long as the camera being used is of a good enough quality to produce quality photos.

The main aim of this project is to make sure the software installs correctly and is working with the Raspberry Pi. The software can be modified by going into the python script and changing the sensitivity of the change detection, as very small changes will currently set off the camera. It is important that the students understand they can change the settings and that this will have a direct effect on the operation of the camera.


Suggested Year Group

The suggested age group is 12+ as this project is a good introduction to demonstrate how easy the Raspberry Pi is to configure.


Learning Outcomes

  • Introduce the students to the Raspberry Pi Camera;

  • Teach the students about pixel walking and how efficient this process can make motion detection;

  • Encourage the students to explore the additional hardware that can be used with the Raspberry Pi.


Hardware Required

Component Number (Peli Case)

(Base) 4 + 5

(Base) 5


(Level 1) 3

(Level 1) 3

(Level 1) 5

(Level 1) 1

Component Number (Box Case)

Slot 1

Slot 11

Slot 11

Slot 11

Slot 11

Slot 12

Slot 13


Raspberry Pi + Case

Raspbian SD Card

Pi Camera


Wireless Keyboard

Wireless Mouse

Power Supply





Initially the code settings are very sensitive and if this project was to be used further it would need to be modified to allow for less sensitivity. This is a very low resource and cost motion detector as other detectors rely on Infra-Red emissions to be detected and require more power and physical resources. There are numerous amounts of security cameras around us every day and they each use different methods to either constantly record or be triggered by a specific change. It could be possible to adapt this project so it was triggered by an IR sensor, making sure there was no recording in times it is not triggered. Allow the students to discuss the issues of creating a motion detector and challenge them to look for places around the school that need to be monitored and where the cameras would be best deployed.