Professional Documents
Culture Documents
PIC Based Security Alarm Project
PIC Based Security Alarm Project
AliExpress
Advertisement
(https://www.electroschematics.com/wp-content/uploads/2013/04/PIC12F675-Security-Alarm-Circuit-Schematic.png?
t=795%2C484)
PIC12F675 (/tag/pic12f675)
Share this:
(https://www.electroschematics.com/pic-based-security-alarm/?share=twitter&nb=1)
(https://www.electroschematics.com/pic-based-security-alarm/?share=facebook&nb=1)
(https://www.electroschematics.com/pic-based-security-alarm/?share=linkedin&nb=1) More
Crime in general is still on the rise, and having a security alarm installed is no longer a perquisite of the
wealthy! Here is a simple and compact security alarm system to protect your home/shop and valuables. The
circuit is built around a tiny microcontroller chip PIC12F675. Besides, a ready-made Passive Infrared (PIR)
module is integrated with the alarm system for reliable(/)human-motion detection.
The built-in passive infrared sensor detects human movement by sensing temperature changes over the scene,
and works even in the total darkness. Human body heat moving across the scene will trigger the PIR sensor, and
the trigger signal will be sent to the control circuit instantly. As the output of the alarm system can be
connected to external lamps or alarm sirens, these devices will be instantly activated upon the detected motion.
As a result, the intruder who entered the guarded area, even in total darkness, will instantly be exposed.
Note that PIR sensor can be used not only for detecting motion in the darkness, but it can even be used
e ectively in daytime where it may produce much less false alarms compared to other motion detection
mechanisms. Here, the PIC12F675 works as a “logic interface” between the detection device and the alarm
actuator.
(https://www.electroschematics.com/wp-cont
ent/uploads/2013/04/security-alarm-architecture.png)
The circuit can be powered from four AA/AAA cells that gives 6 VDC supply. A 1N4007 (D1) diode is used in series
to drop the voltage down to near 5.3 V as the operating voltage for the PIC microcontroller should be below 5.5 V.
As well, this diode provides the protection to the whole electronics in case of reverse polarity of the power
supply. PIR sensor modules usually have a 3-pin connection (Vcc, Output, and round). The pinout may vary, so it
is recommend to check the manufacturer’s datasheet to con rm the pins. Sometime, they do have labels on the
PCB next to the pins. Most PIR sensor modules can be powered through 5 to 12 VDC supply as it has its own
“low-drop voltage regulator” chip, on board.
(https://www.electroschematics.com/wp-
content/uploads/2013/04/PIC12F675-Pin-Assignment.png?
resize=537%2C137)
Pin Assignment of PIC12F675
The output of the PIR sensor module (PIR1) is monitored through GP5 (pin 2) of PIC12F675. PIC12F675 is an 8-
Pin Flash-Based 8-Bit CMOS Microcontroller. Note that,here the PIC12F675 microcontroller uses the internal
clock oscillator at 4.0 MHz. When the motion is sensed, this output is high at about 3.3 V . You could still use
(/)
this voltage as a valid logic high for IC1 by changing the code , but It is preferred to use this voltage to drive the
base of a BC547 transistor (T1) so that at the collector we will have the full swing of the logic voltages.
When power supply is turned on by the on/o switch (S1), IC1 monitors the voltage at the collector of the
transistor after a delay of about 60 seconds. This initial delay is introduced deliberately to avoid false
triggerings, because the PIR sensor requires an initial stabilization time of about 10 to 60 seconds in order to
function properly. A red LED (LED1) is connected to port GP0 of IC1 (pin7) with a current limiting resistor (R3) in
series. The LED blinks at a slow rate during this delay time.
After this delay, IC1 starts monitoring the voltage at the collector of T1. The LED blinking pattern is now
changed to indicate the “standby” mode. In standby mode, T1 is cut o , and the collector output is at logic high
(+5 V). When a “valid” motion is sensed, the high output from the PIR sensor module saturates the transistor
and the voltage at the collector drops down to logic low. Consequently, of port GP1 (pin 6) of IC1 goes high to
switch on the 5V DPDT relay (RL1) through transistor T2. This output will remain High, as long as the motion
exists, and this active condition is indicated by a steady-glow of LED1. DPDT Switching contacts of RL1 can be
connected to powerful external lamps and/or alarms.
(https://www.electroschematics.com/wp-cont
ent/uploads/2013/04/PIC12F675-Security-Alarm-Circuit-Schematic.png)
(https://www.electroschematics.com/wp-cont
ent/uploads/2013/04/security-alarm-pcb-layout.png)
PIC12F675 Software
The rmware is written in C and compiled with MikroC Pro for PIC. When the power is rst turned on, the
microcontroller waits for 60 seconds before it starts monitoring the PIR sensor output. This wait time is
required for the PIR sensor to stabilize when rst powered on. When the microcontroller detects the PIR sensor
(/)
is triggered, it drives the relay switch. Multi-mode control of the visual indicator (Red LED) is also managed by
the PIC microcontroller.
////////////////////////////////////////////////////////////////////////////////
// Microcontroller = PIC12F675
// Operates on Internal 4MHz Clock
// Compiler Used is MikroC Pro for PIC by Mikroelektronica
(/)
// Demo version can be downloded from http://www.mikroe.com
// In Demo version, the programcode limit is 4 Kb
// Program Developed By Vineesh Viswam,Emkor Technologies
// Tested by TechNode Engineering Electronics
//
////////////////////////////////////////////////////////////////////////////////
#define LO_IN GPIO.F5
#define LED GPIO.F0
#define BUZ GPIO.F1
#define LOW 0
#define ON 1
#define OFF 0
////////////////////////////////////////////////////////////////////////////////
int i,j=0;
////////////////////////////////////////////////////////////////////////////////
void interrupt()
{
INTCON.GIE = 0;
if (INTCON.T0IF)
{
j++;
if(j == 80)
{
LED = ON;
Delay_Ms(80);
LED = OFF;
j = 0;
}
}
INTCON.T0IF = 0;
INTCON.GIE = 1;
}
////////////////////////////////////////////////////////////////////////////////
void main() {
TRISIO = 0b00100000; //GPIO.F5 configured as input and all others are output
GPIO = 0b00000000;
CMCON = 0b00000111; // Turn OFF All Comparators
OPTION_REG = 0b10000111;
INTCON = 0b00100000; // Enable Timer0 Interrupt
TMR0 = 0b00000000;
OSCCAL = 0b11111100; // Internal 4MHz Oscillator Configured to operate at Maximum frequency
ANSEL = 0b00000000;
LED = OFF;
BUZ = OFF;
INTCON.GIE = 0;
for(i=0; i<60; i++)
{
LED = ON;
Delay_Ms(500); // LED Flashing
LED = OFF;
Delay_Ms(500);
}
LED = OFF;
BUZ = OFF;
INTCON.GIE = 1;
while(1)
{
if (LO_IN == LOW)
{
INTCON.GIE = 0;
LED = ON;
BUZ = ON;
while(LO_IN == 0);
}
else
{
LED = OFF;
BUZ = OFF;
INTCON.GIE = 1;
}
}
}
////////////////////////////////////////////////////////////////////////////////
About Co-author
PIC coding for this circuit was handled by Vineesh Viswam (vineeshtviswam@gmail.com) design assistant at
(/)
Emkor Technologies, Kottayam, Kerala. Vineesh Viswam is also a “freelance coder” of TechNode Engineering
Electronics, Pallimukku, Kadakkal, Kollam, Kerala – an independent electronics R&D lab, founded by me. At
present, I am the copyright owner of this work.
Share this:
(https://www.electroschematics.com/pic-based-security-alarm/?share=twitter&nb=1)
(https://www.electroschematics.com/pic-based-security-alarm/?share=facebook&nb=1)
(https://www.electroschematics.com/pic-based-security-alarm/?share=linkedin&nb=1) More
Previous
Trailer Stop & Turn Signal
Converter
(https://www.electroschematics.com/trailer-stop-turn-signal-converter/)
Next
Arduino Based Part Fill (https://www.electroschematics.com/arduino-
Automatic Valve
auto- ll-valve/)
Related Tutorials
No related posts.
Recent posts
12 Comments
solangi01
Dear
circuit not working properly rst power up led blanking 1 minute and continues on and relay also continues on plz help what
can i do.
(/)
solangi01
I would like to use this project for my home plz send me HEX le I m very thankful to u
solangi01@gmail.com (mailto:solangi01@gmail.com)
moataz-monsefgmail-com
Please i need the hex le urgently i will use it in my project
josephwilonjayahoo-com-au
I would like to use this project for my diploma project Please send me the hex le and i will using compiled with MikroC Pro
for PIC
josephwilonjayahoo-com-au
I would like to use this project for my diploma project
Please send me the hex le and i will using compiled with MikroC Pro for PIC
maithili k
Please send me the hex le
Rukmal Hettiarachchi
Thank you for the circuit
I want this circuit hex le.
pankaj
please send me ahex hex le for this circuit
preda
Please upload complete Hex le to be use in page.
rawi
Thanks. This is a good project.
I would like to use this project for my presentation, however,I want to also add a normal light bulb for bicycle beside the
blinking led.
How do I draw the schematic diagram and the additional coding required for the bicycle normal bulb to light up during usual
situation but turn o , then , replaced by the led blinking bulb for 30 seconds before turn o during emergency and then the
normal bulb light up again.
I really need your help…please.
Thanks you very much.
Login
Email
Password
Remember Me
Log In
(/)
Register (https://www.electroschematics.com/register) | Lost your password?
(https://www.electroschematics.com/lostpassword)
View More ()
Download
Datasheets
POWERED BY DATASHEETS.COM
Part Number
e.g. LM317
Search
Featured Design
(/)
Bajada de precios
-5%
price drop
(https://www.facebook.com/groups/electroschematics/)
28 y 29 de octubre
(/)
Descuentos online en grandes marcas
ASPENCORE NETWORK
DESIGN: TOOLS:
(https://aspencore.com/)
All contents are Copyright © 2019 by AspenCore, (http://www.aspencore.com/)Inc. All Rights Reserved.
Contact Us (https://aspencore.com/contact-us/) About Us (https://aspencore.com/) Privacy Policy (https://aspencore.com/privacy-policy) Terms of Use (https://aspencore.com/terms-of-use)
Site Map (/sitemap.xml)