This project describes a home security alarm based on a Passive Infra-Red sensor module (HC-SR501) and PIC18F45K22 . PIR sensor is used to detect motion in the environment and is commonly known as motion sensor. When the microcontroller detects the PIR sensor is triggered, it drives the relay switch and trigger an alarm. Its quite helpful in security projects where you need to detect motion.
PIR sensors allow you to sense motion. They are often referred to as PIR, “Passive Infrared”, “Pyroelectric”, or “IR motion” sensors. When an object (human or animal) emitting infrared radiations passes through the field of view of the sensor, it detects the change in temperature and therefore can be used to detect motion . So they are used to detect whether a human has moved in or out of the sensors range.
A PIR has three pins :the VCC, the Ground and the Output pin. The PIR acts as a digital input, so all you need to do is chech for the output pin to flip high or low :
– Output pin high :motion detected (the sensor produce 3.3 volt)
– Output pin low :motion not detected (the out pin will be 0 volt).
The firmware is written in C and compiled with MikroC Pro for PIC. The microcontroller waits for 60 sec before it starts monitoring the PIR sensor output. This wait time is required for the PIR sensor to stabilize when first powered on. When the microcontroller detects the sensor is triggered, it drives the piezo buzzer with a 659Hz and the LAMP is on.Since the sensor is in retriggering mode, the buzzer remains on as long as the motion is continuously sensed. If the motion disappears, and the sensor output changes to logic low, the buzzer will not stop immediately, but still be on for about 250ms and the LAMP is off. And if it detects the motion again, it will drive the piezo buzzer at its peak resonant frequency (695 Hz)and the LAMP is on again.
After the c code is successfully compiled, a HEX file is generated.
For simulating with PROTEUS ISIS hit run button and click the logic button to 1, which will indicate that motion is detected and you will get above output .Now let’s make the logic state to 0, which will indicate that no motion detected, as shown in the simulation.
PIR sensor is ideal for alarm systems, light switch controllers, and similar systems where human presence needs to be detected.
You can download the MikroC Source Code and Proteus files etc from here HOME SECURITY USING pic:
This Our Group (thanks to join and participate) : https://www.facebook.com/groups/816450708460518/
Facebook page : https://www.facebook.com/Lets-Think-Binary-1728910547340654/
Youtube Channel (thanks to subscribe) :