Connecting PIR sensors to a microcontroller is really simple. The PIR acts as a digital output so all you need to do is listen for the pin to flip high (detected) or low (not detected). Our module has two modes: non-retrigger and retrigger. It has also an adjustable delay and adjustable sensitivity 
Its likely that you'll want retriggering, so be sure to put the jumper in the H position! Power the PIR with the 5V (red wire) and to ground (black wire). Then connect the output (yellow wire) to a digital pin. In this example we'll use PORTB pin 0.

The code is very simple, and is basically just keeps track of whether the input to PORTB.0 is high or low. It also tracks the state of the pin, so that it prints out a message when motion has started and stopped on the LCD display.

// project : atm328 - PIR sensor
// Version : 1.0
// Website : www,avrprojects.net
// Date Created : 23.12.2016
// Target : ATmega328P microcontroller
// Language : C WINAVR
// Hardware requirements: LCD display, ATM328 board , PIR sensor
// Description : detect movement with a PIR sensor

// INCLUDES
#include <avr/io.h>
#include <stdlib.h>
#include <string.h>
#include <util/delay.h>
#include <util/lcd.h>

struct DATE{
int month;
int day;
int year;
};

struct DATE today = {22,12,2016};

void ShowCase (void)
{
LCDgoto(0,0);LCDtxt ("....PIR sensor.....");
LCDgoto(0,1);
LCDtxt("**** ");
LCDint(today.month);
LCDtxt("-");
LCDint(today.day);
LCDtxt("-");
LCDint(today.year);
LCDtxt(" ****");
}


int main(void)
{
DDRB = 0x00; //set port B as input
LCDinit();
LCDcmd (0b00101100);
//turn on display
LCDcmd (0b00001100);
//clr display
LCDcmd(clr);
LCDgoto(0,0);
ShowCase();
_delay_ms(3000);

while(1)
{
if (PINB == 0x00000001)
{
LCDgoto(0,2);
LCDtxt ("Movement !!!");
}
else
{
LCDgoto(0,2);
LCDtxt (" clear ");
}
_delay_ms(100);
}
}