PIR Wiring & Example Code

A PIR Sensor can tell when something nearby moves. PIR stands for "Passive InfraRed". The sensor detects the pattern of infrared energy in its surroundings. If the pattern changes, the sensor outputs a high signal. The Propeller microcontroller only needs to monitor this signal with an I/O pin to know if something is moving around nearby.

 

Wiring & Connections

 

Quick Code Example

Using the connections shown in the wiring diagram above, this example will display the status of the PIR Sensor in the Terminal. A value of "1" indicates the sensor has been triggered (or set high), and a "0" is the resting (or low) state.

It is typical for the sensor to be triggered when it is first powered up and getting an infrared reading from its environment. This may last up to 30 seconds.Quick-start BlocklyProp code for the PIR sensor.