For home security , we can build " Thief Detector " using PIC 18f2550 microcontroller and PIR Motion Sensor . When something will be moving front to the sensor , the thief detector system will give an alarm to us . That's the basic theme of this project .
PIR Motion Sensor :
Actually this sensor is continuously transmitting an Infrared Ray signal and receiving the reflected signal . According to the information of receiving signal it changes it's output signal . You can see the pin out of PIR Motion Sensor .
Generally when something moving in the front of it , the sensor produce 3.3 volt to it's out pin . Otherwise the out pin will be 0 volt . By applying this technique we can get information or status of out doors .
We will get the PIR Sensor connected with ADC(Analog to Digital Converter ) pin of PIC 18F2550 . We will use RA0 as input .
ADC(Analog to Digital Converter ) :
We need a basic knowledge about ADC . Let's take a look at here :![]() |
ADCON1 Register |
Basically ADC is like as voltage divider . According to voltage It produce output .
bit 5 : VCFG0: Voltage Reference Configuration bit (VREF- source)
1 = VREF- (AN2)
0 = VSS or 0 volt
bit 4 :VCFG0: Voltage Reference Configuration bit (VREF+ source)
1 = VREF+ (AN3)
0 = VDD or 5volt
We will set VCFG0[bit 5]=0and VCFG0[bit4]=0 . So we will get highest value 5volt[1023] and lowest value 0volt[0].The ADCON1 is a 10 bit register that means 2 to the power 10 is it's highest counting capacity and result is 1024 . So this register can count from 0 to 1023 . When 0 volt , we get reading at RA0 pin 0 .When 5 volt , we get reading at RA0 pin 1023. It means 5volt equivalent to 1023 .
If 5 volt equal reading 1023 .
So 1 volt equal reading 1023/5 [When something detect PIR Sensor provide 3.3 volt at Output Pin]
So 3.3 volt equal reading (1023/5)*3.3 =675.8 . When we get reading 675 at ADC channel , we understand that sensor detects something . So it make PORTB.F6 pin high and Buzzer turns on .
Circuit Diagram :
Source Code :
void main() {
int input;
CMCON=7;
ADCON1=0x0E;
TRISB.F6=0;
while (1) {
input = ADC_Read(0);
if(input>=675){
PORTB.F6=1;
delay_ms(4000);
}
PORTB.F6=0;
}
}
In this code, micro c give an error: input = ADC_Read(0); Undecleared identified
ReplyDeleteHow can ı solve this problem?
Sometimes it shows but I think code is alright.
DeleteI'm trying to add a switch where I can arm/disarm the buzzer. I'm having a hard time writing the code.
ReplyDeleteSimply add a switch I should work fine. Try same mcu and same circuit and it's supposed to work.
DeleteYour blog is really good and it helps others. It's a perfect solution for those who search for it. Please share more information like this. Security Monitoring Toledo
ReplyDeleteclearly, It is an engaging article for us which you have provided here about industrial automation companies in uae This is a great resource to enhance knowledge about it. Thank you
ReplyDeleteI unquestionably truly loved all aspects about VMS visitor Management System and I likewise have you spared to fav to take a gander at new data in your site.
ReplyDeleteYou done really nice work in this article. I hope in future you share more good updates with us. Thanks for sharing this article. Now it's time to avail https://quickshutterrepair.co.uk/ for more information.
ReplyDelete