Door Alert 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 main component of this project is the magnetic contact switch which consists of a reed switch and a magnet which when placed in contact with each other complete a circuit and then breaks when moved out of proximity of each other. The reed switch consists of a pair of magnetic contacts that are normally open, and close when in the presence of another magnet. By converting the signal created by the switch into binary it is possible for the Raspberry Pi to interpret the change and utilise this change within a program which will be demonstrated throughout this project. This project also uses the Raspberry Pi camera which is triggered by a change in the contact switch and creates a more complicated project that can be expanded on easily. This project could also be programmed to email any changes in the state of the switch and send the images and video as well. This doesn't require any more hardware but understanding about how to set up a simple email server is required.  

Bash is a very powerful scripting language that can interact directly with the CLI as though it was being typed in. Obviously, a computer can write thousand’s of times quicker than any human so any program is compiled and executed very quickly. Bash is also very helpful when different tools and file locations are required throughout the program and allows for each of these tools to be used in tandem. For example, within this project the sensor output must be detected, the Raspberry Pi camera must be engaged, and the files are being written to different areas. It is possible to do this using different programming languages like python or C++ but this would require a lot more lines of code and complicate the learning process as well. It is important to understand a couple of programming languages like C++ and Java because each language has an ideal application. Java is a programming language ideally suited for database applications but can also be applied to other projects as well.  

It is important that the students understand how the breadboard works, it is a prototype component that allows students and professionals to easily create electronic circuit prototypes without having to solder electronics into an integrated chipboard. The outside + and – run vertically down the edges of the board which conduct power. To complete any circuit it is important to integrate the power into the design or else the circuit will be incomplete. The inner connection inputs are then aligned into horizontal rows that when connected to the + power the entire row is part of the circuit. When the students understand this principle, it will be possible for them to then create their own circuits and then develop their own projects. 

Suggested Year Group

The suggested age group is 15+, this project requires some coding experience and understanding of both hardware and software.

Learning Outcomes

  1. Instruct the students how to assemble the project; 

  2. Provide understanding as to the mechanics of the breadboard and how it is used in electronic prototyping; 

  3. Instruct the students in coding the test and full script for the project.


Hardware Required

Component Number (Peli Case)

(Base) 4 + 5

(Base) 5

(Base) 12

(Base) 10

(Base) 11

(Level 1) 3

(Level 1) 3

(Level 1) 2

(Level 1) 3

(Level 1) 3

(Level 1) 5

(Level 1) 1



Raspberry Pi + Case

Raspbian SD Card


Door Alert Breadboard

Door Alert Magnetic Sensor

Male Male wires

Male Female Wires

Flat Head Screw Driver


Wireless Keyboard

Wireless Mouse

Power Supply

Component Number (Box Case)

Slot 1

Slot 11

Slot 11

Slot 8 & 9

Slot 8

Slot 11

Slot 11

Slot 11

Slot 11

Slot 11

Slot 12

Slot 13





This project is more advanced than the previous projects and introduces a range of new components that can all be configured to work with the Raspberry Pi. The next development of this project would be to configure an email server. It is important to remember that simple email servers require the email address and password for the email for it to send, this information can easily be accessed in plain text by accessing the email config files and needs to be kept sensitive. Instruct the students to research how they would develop this project, what additional electronics could be attached to it and what code would be required to make it work. Another development could be to combine it with some kind of facial recognition software, so the alert would be sent if the face couldn’t be identified but allowed specific users to enter.