June 05, 2020

PIR Sensor Interfacing with Arduino

PIR stands for Passive Infrared Radiation. PIR sensors are more complicated than many of the other sensors explained in these tutorials because there are multiple variables that affect the sensor's input and output. To begin explaining how a basic sensor works, we'll use this rather nice diagram.

PIRs are basically made of a pyroelectric sensor (which you can see below as the round metal can with a rectangular crystal in the center),
which can detect levels of infrared radiation. Everything emits some low-level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion detector is actually split into two halves. The reason for that is that we are looking to detect motion (change), not average IR levels. The two halves are wired up so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low.
The second important thing is the lens of the sensor. PIR sensors are rather generic and for the most part, vary only in price and sensitivity. Most of the real magic happens with the optics. This is a pretty good idea for manufacturing: the PIR sensor and circuitry is fixed and costs a few dollars. The lens costs only a few cents and can change the breadth, range, sensing pattern, very easily. In the diagram up top, the lens is just a piece of plastic, but that means that the detection area is just two rectangles. Usually, we'd like to have a detection area that is much larger. To do that, we use a simple lens such as those found in a camera: they condense a large area (such as a landscape) into a small one (on film or a CCD sensor). For reasons that will be apparent soon, we would like to make the PIR lenses small and thin and moldable from cheap plastic, even though it may add distortion. For this reason, the sensors are actually Fresnel lenses:
proximity_frenelling.jpg
OK, so now we have a much larger range. However, remember that we actually have two sensors, and more importantly, we don't want two really big sensing-area rectangles, but rather a scattering of multiple small areas. So what we do is split up the lens into multiple sections, each section of which is a fresnel lens.
To interface, this module all you have to do is to read the OUT pin signal with Aduino's digital pin using the digitalRead(DataPin) function frequently and if there is any signal keep the output high.
Pinout:
  • VCC supplies power for the module. You can directly connect it to the 5V pin on the Arduino.
  • DATA pin logical voltage changes from 0 or 5 Volt with the pH value.
  • GND is the Ground Pin and needs to be connected to the GND pin on the Arduino.
Connecting This device with Arduino is very easy. VCC pin goes to Arduino 5v pin GND pin goes to Arduino Ground Pin and the OUT pin goes to Arduino D2 pin.

Circuit Diagram:


Video Example:

Software:
Interfacing part Only

No comments:

Post a Comment