| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| en:examples:sensor:ir_passive [2015/12/17 09:55] – raivo.sell | en:examples:sensor:ir_passive [2020/07/20 09:00] (current) – external edit 127.0.0.1 |
|---|
| ~~PB~~ | <pagebreak> |
| ====== Passive infrared sensor (PIR) ====== | ====== Passive infrared sensor (PIR) ====== |
| |
| //Required knowledge: | //Necessary knowledge: |
| [HW] [[en:hardware:homelab:digi]], [HW] [[en:hardware:homelab:combo]], \\ | [HW] [[en:hardware:homelab:digi]], [HW] [[en:hardware:homelab:combo]], \\ |
| [AVR] [[en:avr:io]], | [AVR] [[en:avr:io]], |
| |
| [{{ :examples:sensor:pir:pir.jpg?200|PIR sensor}}] | [{{ :examples:sensor:pir:pir.jpg?200|PIR sensor}}] |
| Passive infrared sensor measures infrared (IR) radiation from objects in it's field of view. All objects emit some low level of radiation. The hotter something is the more radiation is emitted. Human eye is not capable to see IR radiation, but it's possible to use special cameras and sensors to detect it. | Passive infrared sensor measures infrared (IR) radiation from objects in it's field of view. All objects emit some low level radiation. The hotter something is the more radiation is emitted. Human eye is not capable to see IR radiation, but it's possible to use special cameras and sensors to detect it. |
| The sensor is called passive cause it doesn't emit light to get measurements. The sensor in PIR is actually split into two halves. The reason for that is to measure motion. The two halves of sensor are wired up in a way that they cancel each other out. If one half detects more or less IR radiation than the other, the output will swing high or low. | The sensor is called passive because it doesn't emit light to get measurements. The sensor in PIR is actually split into two parts. The reason for that is to measure motion. Two parts of sensor are wired up in a way that they cancel each other out. If one detects more or less IR radiation than the other, the output will swing high or low. |
| |
| PIR sensor is mostly used for detecting living being movement and thus is generally known as passive infrared detector (PID). The sensor is also sensitive enough to even detect IR radiation source movement while the object is already in it's field of view. | PIR sensor is mostly used for detecting living being movement and thus is generally known as passive infrared detector (PID). The sensor is also sensitive enough to even detect IR radiation source movement while the object is already in it's field of view. |
| * passive infrared sensor (PIR) | * passive infrared sensor (PIR) |
| * lens for directing radiation to the sensor | * lens for directing radiation to the sensor |
| * control circuitry | * control circuit |
| |
| [{{ :examples:sensor:pir_sensor.jpg?200|PID - motion detector}}] | [{{ :examples:sensor:pir_sensor.jpg?200|PID - motion detector}}] |
| ===== Practice ===== | ===== Practice ===== |
| |
| PID sensors output is usually simple digital one wire signal. If the sensor has detected something then it usually outputs high impulse which stays high for a given time period (on some sensors is adjustable). This gives the senor capability to switch a relay or be used as an input for microcontroller. These devices can in turn switch on a light or be used as a part of alarm system. | PID sensors output is usually simple digital signal. If the sensor has detected something then it usually outputs high impulse which stays high for a given time period (the time might be adjustable). This gives the sensor capability to switch a relay or be used as an input for microcontroller. These devices can turn on a light or be used as a part of alarm system. |
| |
| Using the detector with a microcontroller is not much different from reading a reagular pushbutton switch. PID can be connected to digital or analog input. Be sure to check the pinout of the detector before connecting it to microcontroller. It is especially important to not mix up power and ground pins cause failiure to do so usually ends up in breaking the detector. | Using the detector with a microcontroller is not much different from reading a regular push button switch. PID can be connected to digital or analog input. Be sure to check the pinout of the detector before connecting it to microcontroller. It is especially important to not mix up power and ground pins cause failure to do so usually ends up in breaking the detector. |
| |
| On Homelab III the detector has to be connected to Combo Module encoder input if the sensor only works at 5V or analog/digital input of choice if it also works on 3.3V. Be sure to check the sensor voltage rating before connecting. If the 5V encoder input is used then the external power source has to be connected on the Controller module. | On Robotic HomeLab III the detector has to be connected to Combo module encoder input if the sensor requires 5V power or analog/digital input of choice if voltage requirement is 3.3V. Be sure to check the sensor voltage rating before connecting. If the 5V encoder input is used then the external power source has to be connected on the Controller module. |
| ~~PB~~ | <pagebreak> |
| <code c> | <code c> |
| // Homelab PID sensor (detector) example program | // Robotic HomeLab PID sensor (detector) example program |
| #include <homelab/pin.h> | #include <homelab/pin.h> |
| |