Summary of Motion detection alarm using a PIR sensor module with a PIC12F635
This project details a motion sensor alarm using a PIR module and a PIC12F635 microcontroller. The system detects human movement via infrared radiation changes, triggering a buzzer through an NPN transistor interface. It includes power regulation options using AA batteries or a 9V battery with a regulator, ensuring reliable operation by avoiding rapid environmental thermal shifts.Parts used in the Motion detection alarm using a PIR sensor module with a PIC12F635:
- PIR sensor module
- PIC12F635 microcontroller
- Buzzer
- NPN transistor (BC547)
- Dropping diode
- LM7805 regulator IC (optional for 9V supply)
- 4 AA alkaline batteries
- NI-MH rechargeable batteries (tested alternative)
- 9 V battery (tested alternative)
Introduction
This project describes a motion sensor alarm based on a Passive Infra-Red (PIR) sensor module. There are many vendors that manufacture the PIR sensor modules and almost all of them are pretty much the same in function. They have a single output that goes high (or low, based on specification) when the motion is detected. In this project, a PIC12F635 microcontroller continuously monitors the output from the sensor module and turns a buzzer on when it goes active.
Theory
Certain crystalline materials have the property to generate a surface electric charge when exposed to thermal infrared radiation. This phenomenon is known as pyroelectricity. The Passive Infra-Red (PIR) sensor module works on the same principle. The human body radiates heat in the form of infrared radiation which is maximum at about 9.4 um. The presence of human body creates a sudden change in the IR profile of the surrounding that is sensed by the pyroelectric sensor. The PIR sensor module has an instrumentation circuit on board that amplifies this signal to appropriate voltage level to indicate the detection of motion.
The PIR sensor requires an initial stabilization time of about 10 to 60 seconds in order to function properly. During this time, the sensor gets familiar with the surrounding environment, and any motion in its field of view should be avoided. The PIR sensor has a typical range of 20 feet, and is designed to adjust to slowly changing conditions such as the gradual change in the thermal profile of the surrounding as the day passes. However, any sudden change in the profile (e.g. human body motion) is responded by the sensor. That’s why the PIR sensor module should not be placed near a heater, AC outlet or anything that could create a rapid change in the surrounding environment.
PIR sensor modules usually have a 3-pin connection: Vcc, Output, and Ground. The pinout may vary, so I recommend to check the manufacturer’s datasheet to confirm the pins. Sometime, they do have labels on the board next to the pins. The one I have got does so, and it can be powered through 5-12 V supply as it has its own voltage regulator on board. The output goes high when the motion is sensed.
Besides it also has a 3-pin jumper selection for single or continuous trigger output mode. The two positions have labels H and L. When the jumper is at H position, the output remains high when the sensor is re-triggered repeatedly. In position L, the output goes high and low every time the sensor is triggered. So a continuous motion will give repeated high/low pulses in this mode. The front part of the sensor module has a Fresnel lens to focus the infrared light on to the sensor element.
Circuit Design and Construction
The circuit diagram is quite simple. I have powered my circuit with 4 AA batteries that gives 6 V supply. A diode is used in series to drop the voltage down to 5.4 V as the operating voltage for the PIC microcontroller should be below 5.5 V. Besides, the diode also provides the protection to the circuit in case of reverse polarity of the power supply. I have tested the circuit with NI-MH rechargeable batteries (that gives 4.8 V) and it worked, but I recommend to use the alkaline batteries (1.5 V each) for better performance. You can also use a 9 V battery but then you need a LM7805 regulator IC in your circuit.
The output of the PIR sensor module is monitored through GP5 (pin 2) of PIC12F635. When the motion is sensed, this output is high at about 3.3 V (my sensor module has a 3.3V regulator IC on board). You could still use this voltage as a valid logic high for PIC12F635, but I preferred to use this voltage to drive the base of an NPN transistor (BC547) so that at the collector we will have the full swing of the logic voltages. Now, the microcontroller monitors the voltage at the collector of the transistor. During the normal condition, the transistor is cut off, and the collector output is at logic high (+5 V). When the motion is sensed, the high output from the sensor module saturates the transistor and the voltage at the collector drops down to logic low. The jumper selection for trigger is at H position, so the sensor output will remain active as long as the motion exists. Note that the PIC12F635 microcontroller uses the internal clock oscillator at 4.0 MHz. The MCLR function is disabled and WDT is OFF in this project.
For more detail: Motion detection alarm using a PIR sensor module with a PIC12F635
Quick Solutions to Questions related to Motion detection alarm using a PIR sensor module with a PIC12F635:
- How does the PIR sensor detect motion?
The sensor detects sudden changes in the infrared profile caused by human body heat radiating at about 9.4 um. - What is the initial stabilization time required for the PIR sensor?
The sensor requires an initial stabilization time of about 10 to 60 seconds to familiarize itself with the environment. - Can I use rechargeable batteries for this circuit?
Yes, NI-MH rechargeable batteries providing 4.8 V were tested and worked, though alkaline batteries are recommended for better performance. - How do I power the circuit if I use a 9 V battery?
If using a 9 V battery, you must include an LM7805 regulator IC in the circuit to step down the voltage. - Why is a diode used in series with the power supply?
The diode drops the voltage from 6 V to 5.4 V for the microcontroller and protects against reverse polarity. - What happens when the jumper is set to the H position?
In the H position, the output remains high when the sensor is re-triggered repeatedly as long as motion exists. - Does the PIR sensor output go high or low when motion is detected?
The output goes high when motion is sensed, which saturates the NPN transistor in this specific design. - What clock frequency does the PIC12F635 use in this project?
The microcontroller uses its internal clock oscillator set at 4.0 MHz.
Related projects
Spectrum Analyzer using TMS320F28023DA with Proteus Simulation
Introduction This project demonstrates a real-time audio spectrum analyzer using the TMS320F28023DA Piccolo microcontroller, simulated in Proteus VSM. The system captures an...
Sensors & TemperatureDHT22 Low Cost Humidity Sensor using PIC18F25K20 with Proteus Simulation
IntroductionThis microcontroller project demonstrates how to interface a DHT22 (RHT03) digital temperature and humidity sensor with a PIC18F25K20 using Proteus simulation.The project...
Sensors & TemperatureCrafting a Microcontroller-Based Temperature Monitoring System
Abstract As technological advancements progress, processes become increasingly intricate, demanding a corresponding expansion in the parameters necessary for efficient analysis. Data acquisition,...
Sensors & TemperatureAutomated Room Temperature Monitoring System using Microcontrollers
Abstract Monitoring the temperature within a computer server room stands as a crucial responsibility to uphold the server's performance amidst potential disruptions...
Sensors & TemperatureInnovative Approaches to Control System Design for 100KV Impulse Generators
1. INTRODUCTION An impulse generator is an electrical device designed to generate short-duration surges of high voltage or high current. Impulse signals...
Sensors & TemperatureSmart Baby Incubator: Enhancing Care with PIC Microcontrollers
INTRODUCTION Within the effective Baby Incubator system, the incubator serves as an infant-stimulation apparatus designed for the intensive care of newborns, particularly...
