Hello and welcome back. In this project, we will learn how to make a security system using a Raspberry Pi board. For that, I mainly used the PIR motion sensor, and using this sensor we can detect movements. I think this project is best for our home, shop, office, etc. Also, I assembled this project on a breadboard. But you can make a PCB (Printed Circuit Board) for this project. Then, we can use this project as a professional system.
Also, motions can be detected within 10m and 160 degrees through this sensor and it can be changed according to our needs. For that, you can use preset in the sensor. That’s a good feature of this sensor. Also, we can change the input delay time using another preset. Ok, let’s go ahead.
If you want to do it with Arduino, please use this link.
OK, let’s do this project step by step. The required components are given below.
- Raspberry Pi board — Amazon
- PIR motion sensor x 1 — Amazon / Banggood
- Buzzer x 1 — Amazon / Banggood
- LED bulb x 1 — Amazon / Banggood
- Breadboard x 1 — Amazon / Banggood
- Male to Female jumper wires x 4 — Amazon / Banggood
- Female to Female jumper wires x 2 — Amazon / Banggood
Firstly, identify these components.
Secondly, place the LED and Buzzer on the breadboard. And then, connect these components to the Raspberry Pi board.
Thirdly, connect the PIR sensor to the Raspberry Pi board. For that, use the circuit diagram above.
Now, connect the mouse, keyboard, monitor, and SD card(OS installed) to the Raspberry Pi board.
Finally, connect the power supply to the Raspberry Pi board. And then, copy and paste the following script on the Thonny IDE.
- Full details of this project — Download
#include the library from gpiozero import MotionSensor,Buzzer,LED # include the PIR sensor pin pirSensor = MotionSensor(22) # Include the buzzer pin buzzer = Buzzer(27) # Include the LED bulb pin led = LED(17) while True: pirSensor.wait_for_motion()# Detect the motion buzzer.on()# Turn on the buzzer led.on() # Turn on the LED bulb print("Motion") pirSensor.wait_for_no_motion()# Detect the no motion print("No motion") buzzer.off()#Turn off the buzzer led.off()# Turn off the LED bulb
Now, save this code and click the run button.
OK, enjoy this project. The full video guide is below. So, see you in the next project or tutorial.