The PIR Sensors are used in several projects of automation with Arduino and other platforms and microcontrollers.
There are diverse types of projects using the PIR sensor and in this article you'll learn how to work with PIR Sensor and Arduino using the Flowcode 7 Software.
The PIR Sensors is the Passive Infrared sensor, in other words, it works based on the infrared of the body in movement. It is widely used to detect people in the movement and act an alarm, light up light and other applications.
In Figure 1 the PIR Sensor structure is presented.
Figure 1 - PIR Sensor Structure.
The PIR Sensor has two trimpots. One of the trimpots is for configuring the delay time in 5 sec to 200 sec.
The delay time is the time that the sensor will be actioned when detecting movement in its proximity. And the other trimpot is used to configure the detected distance in 3 meters at 7 meters.
In Figure 2 the connection circuit is presented and the PIR Sensors is connected in the digital pin 2 on the Arduino.
Figure 2 - Schematic Circuit of the PIR Sensor and Arduino.
As is possible see, when the sensor detects the movement, the LED of the Arduino (Digital PIN 13) will be actioned. The logical programming is presented on the Flowchart constructed in the Flowcode 7 Software.
FlowChart of the Flowcode 7
The flowchart is presented in Figure 3 and the programming logic is very simple.
Figure 2 - Flowchart of the Flowcode 7.
The flowchart has a block of the loop and it was called "void loop". The programming logic is constructed in the loop block. The PIR Sensor is connected in digital pin 2 (B2 -> sensorpir). And after the read of pin state, the logical condiction is performed and according to read the value, the digital pin will be actioned for up or down.
Thank you for your reading and the PCBWay for its support.
The Silícios Lab thanks UTSOURCE to offer the electronic components for the project.