atmega8535 and door sensor and other sensor

getzme4u

Joined Aug 12, 2011
6
hello everyone
i made a alarm system for my home. in that use
atmega8535 and door sensor, motion sensor,and vibration sensor.

problem: sometime it make false alarm

i have codevision avr for programmming
controller pina.1 and pina.2 are initially equal to 1(one) and pulled up by 10 k resistor through +5 v dc supply
there i made a function to check();
check()
{
if( pina.1 ==1)
alarm_bit=1;

if(pina.2==1)
alarm_bit=1;

}
///////// main function start here
main()
{

while()
{
if(alarm_bit==1)
then start hooter;

}

}

hardare : there are 2 zone
in 1 zone input for door sensor is gnd supply and its output ==0 goes to controller and reads normal condition means no alarm condition
because gnd i flowing then door are cloesed so contrller gets 0( zero)
and this pulled up also by +5 supply

then any door open then it open and it get +5 dc state alarm start

this is ok working but mine problem it does sometime false alarming while all doors are closed properly
please tell me the how i can make this in industrial or without false alarming
_________________
working at atmega32 nad modem and want to work with rf ,ir .
i am to learn wireless and to make projects realted with that.

hgmjr

Joined Jan 28, 2005
9,029
Rich (BB code):
check(){
if( pina.1 == 1)
alarm_bit = 1;

if(pina.2 == 1)
alarm_bit = 1;

}

///////// main function start here

main(){

while()
{
if(alarm_bit==1)
then start hooter;

}

}
One thing that I notice is that there is no call to the function check() from within main().

hgmjr

hgmjr

Joined Jan 28, 2005
9,029
Also missing is an initialization section. Perhaps you have only provided a snippet of your code.

It would be more helpful if you could post your entire soruce code.

hgmjr

RiJoRI

Joined Aug 15, 2007
536
Don't feel too bad about false alarms. I write firmware for alarm systems, and a LOT of the code is in there to prevent false alarms!

One method we use is debouncing. All zones (pina.1 or pina.2 in your system) are scanned periodically. If a zone is active, a counter for that zone is incremented.

If the counter reaches a certain number, the alarm sequence (hooter in your case) is started. If the zone has NOT tripped, the counter for that zone is set to 0.

Also, check your local laws. If your hooter is outside your dwelling, it may need to be shut off after a certain amount of time, or your local police will be giving YOU the ticket!

AND you'll want to decide when your alarm clears -- will it be when the zone restores, or when you disarm the system?

--Rich