PIR Sensor

The motion sensor can detect motion of an object. This motion sensor module uses the LH1778 passive infrared sensor and the BISS0001 IC to control how motion is detected. There are two variable register to control the sensitivity and time delay adjustment

There are two operating mode in the PIR sensor. They are the

Low when IDLE(no motion detected). There is a problem in single mode that if any object comes again when output is high the sensor can’t detected the next object. This can be overcome in Multi-trigger mode.

Let’s turn on light when motion detect and stray high as long as the output high. The PIR motion sensor will works on single mode operation. The main program is very simple-

/*
 * Motion Sensor (Active High when motion detected)
 * Sensitivity Adjustment: 3m to 7m(CW--Increase CCW--Decrease)
 * Time Delay Adjustment : 1s-3min (CW--Increase CCW--Decrease)
 * LS Mode: Output High as time delay adj. after motion detected
 * HS Mode: Output High as time delay adj. after last motion detected
 * Author : sunny
 */ 

#include <avr/io.h>
#define PIR_SENSOR 0
#define LOAD       1
int main(void)
{
	DDRA|=(1<<LOAD);        //load to connect
	DDRA&=~(1<<PIR_SENSOR); //PIR sensor as input
    while (1) 
    {
		(PINA&(1<<PINA0))?(PORTA|=(1<<LOAD)):(PORTA&=~(1<<LOAD));
    }
}