Wednesday, July 31, 2013

Interfacing PIR sensor with AT89s52

    Today,I am going to tell you about the technique of interfacing Passive Infrared Sensor (PIR) with AT89s52 MCU (a microcontroller from 8051 family) with a detailed description about this sensor. This is an easily available sensor and figure of this sensor
is shown below in figure a.
figure a. PIR sensor

INTRODUCTION:-

PIR which stands for passive infrared sensor is a pyroelectric device that detects motion by measuring changes in the infrared level emitted by the surrounding objects. This comes from the fact that any object having temperature above absolute temperature emits heat energy in form of infrared radiation which are invisible to human eye.

since, PIR device do not radiate or emit IR rays and works by detecting the heat energy radiated by objects in the form of IR rays they are called passive infrared sensors.

The sensor has three pins in its layout which are supply pin , ground pin and a data pin. Supply pin is connected with +5 V, ground pin to ground and data pin to any pin of microcontroller.


USES:-

1) detecting motion of humans, animals etc.
2) used in bulgar alarm.
3) used in automatic lighting systems.
4) as a remote thermometer.


HOW DOES IT WORKS?

PIR sensor have a crystalline material that generates an electrical charge when exposed to IR radiation.The change in the amount of infrared radiation changes the voltage and this voltage is then amplified by an amplifier in the sensor.A filter called fresnel lens is used in the sensor which focuses the IR radiation to the crystalline material.

SCHEMATIC:-


Figure b:- schematic


As shown in schematic above, LCD is connected to PORT2, three control pin of LCD are connected to first three pins of PORT1 and data pin of PIR sensor is connected to pin number 4 of PORT1. The microcontroller is programmed to display a suitable message like "motion detected" when the logic level at PORT 1^3 goes from 0 to 1.

SOFTWARE:-

Microcontroller used in this project is AT89s52 with 11.0592MHZ crystal attached to it and Source code for this project is written in Keil uvision c51 compiler.

To download complete source code, click here.