Interfacing PIR sensor to 8051

PIR sensors are widely used in motion detecting devices. This article is about interfacing a PIR sensor to 8051 microcontroller. A practical intruder alarm system using PIR sensor and 8051 microcontroller is also included at the end of this article. Before going in to the core of the article, let’s have a look at the PIR sensor and its working.

PIR sensor.

PIR sensor is the abbreviation of Passive Infrared Sensor. It measures the amount of infrared energy radiated by objects in front of it. They does not  emit any kind of radiation but senses the infrared waves emitted or reflected by objects. The heart of a PIR sensor is a solid state sensor or an array of such sensors constructed from pyro-electric materials. Pyro-electric material is material by virtue of it generates energy when exposed to radiation.Gallium Nitride is the most common material used for constructing PIR sensors. Suitable lenses are mounted at the front of the sensor to focus the incoming radiation to the sensor face. When ever an object or a human passes across the sensor the intensity of the of the incoming radiation with respect to the background changes. As a result the energy generated by the sensor also changes. Suitable signal conditioning circuits convert the energy change  to a suitable voltage output. In simple words the output of a PIR sensor module will be HIGH when there is motion in its field of view and the output will be LOW when there is no motion.

Interfacing PIR sensor to 8051

DSN-FIR800 is the PIR sensor module used in this project. Its image is shown above.  It operates from 4.5 to 5V supply and the standby current is less than 60uA. The output voltage will be 3.3V when the motion is detected and 0V when there is no motion. The sensing angle cone is 110° and the sensing range is 7 meters. The default delay time is 5 seconds. There are two preset resistors on the sensor module. One is used for adjusting the delay time and the other is used for adjusting the sensitivity. Refer the datasheet of DSN-FIR800 for knowing more.

Interfacing PIR sensor to 8051

The 8051 considers any voltage between 2 and 5V at its port pin as HIGH and any voltage between 0 to 0.8V as LOW. Since the output of the PIR sensor module has only two stages (HIGH (3.3V) and LOW (0V)) , it can be directly interfaced to the 8051 microcontroller. The circuit diagram for interfacing PIR sensor to 8051 microcontroller is shown below.

Schematic Interfacing PIR sensor to 8051

The circuit shown above will read the status of the output of the PIR sensor and switch ON the LED when there is a motion detected and switch OFF the LED when there is no motion detected. The output pin of the PIR sensor is connected to Port 3.5 pin of the 8051. Resistor R1, capacitor C1 and push button switch S1 forms the reset circuit. Capacitors C3, C4 and crystal X1 are associated with the oscillator circuit. C2 is just a decoupling capacitor. LED is connected through Port  2.0 of the microcontroller. Transistor Q1 is used for switching the LED. R2 limits the base current of the transistor and R3 limits the current through the LED. Program for interfacing PIR sensor to 8051 is shown below.

For more Details: Interfacing PIR sensor to 8051

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top