Lego Mindstorms NXT PIR Sensor
Including €0.01 for ecotax
The PIR sensor for Lego Mindstorms NXT
PIR stands for "Passive Infrared". The PIR sensor for Lego Mindstorms NXT is then a passive infrared sensor. This is the technology used by motion detectors in an alarm system for a house. The principle is simple. All objects, people and animals emit more or less infrared radiation. The warmer the object is, the stronger the infrared emission.
The PIR sensor for NXT therefore detects changes in infrared radiation in its field. Thus, a person or an animal (warm blooded) that moves in the field of the PIR sensor will be detected. If the person or the animal remains stationary in the field of PIR, then the detection will fade gradually. The sensor detects movements.
This sensor is effective for people, animals or objects at temperatures between 30°C and 50°C.
Technical principle of detection using PIR sensor for Lego Mindstorms NXT
As presented in the figure below, the measuring range of the sensor is divided into two zones, a positive zone on the left and a negative zone on the right.
Measurement by the sensor is based on the relative changes of infrared radiation between these two areas. The following image shows the effect of a change of the infrared radiation emitted in each of the two areas on the overall measurement made by the sensor.
This type of architecture can not only detect when something warm moves in the sensor field but also in what direction this source moves.
The following image shows what happens when a person moves in the measurement field of PIR sensor for Lego Mindstorms NXT.
- 1 - The person is not yet in the field, the value is close to 0.
- 2 - The person enters the left field (positive field), thus increasing the measured value.
- 3 - The value measured by the PIR sensor decreases significantly because the person comes out of the left field and enters the right field.
- 4 - The value is 0 again as the person comes back from the field measurement.
Programming the PIR sensor for Lego Mindstorms NXT
Programming the PIR sensor for Lego Mindstorms NXT using NXT-G
The PIR sensor is programmable using NXT-G. The following image shows the configuration panel of the NXT-G block of the PIR sensor for Lego Mindstorms NXT:
As shown in the picture above, it is possible to define a dead zone, ie an area without measurement. It is possible to compare the measured value with a data range. By default, the NXT-G block checks if the value is outside the range -10/+10.
The following image shows the simple NXT-G code which triggers an alarm when motion is detected by the PIR sensor for NXT.
To download the NXT-G block of the PIR sensor for Lego Mindstorms NXT, go to: Code of the NXT-G block of the PIR sensor for Lego Mindstorms NXT.