Human infrared module is very simple, is the normal three-pin (vcc,gnd,data), the data is high, low level, that is, there are only two results: High level for the active body is detected, low level for no active human detection.
It is important to note that there are several places on the module that can be set:
First, the trigger mode:
L Non-repeatable, H repeatable. Jumper selectable, the default is H.
A. Non-repeatable trigger mode: The output will automatically change from high to low after the delay time is over when the output high is sensed.
B. Repeatable Trigger mode: That is, the induction output high level, in the delay time period, if there is a human body in its sensing range of activity, its output will remain high, until the person left after the delay will be high level to low level (the Sensor module detects every activity of the human body will automatically postpone a delay time period, And the time of the last activity is the starting point of the delay time).
Second, adjustable block time and detection distance adjustment:
1, blocking time: The induction module after each induction output (high level to low level), you can immediately set a blocking time, in this time period the sensor does not receive any induction signal. This function can be used for interval detection products (sensing output time and blocking time), and this function can effectively suppress all kinds of interference during load switching. (Default block time 2.5S)
2, adjust the detection distance
Three, photosensitive control:
The module is reserved with a position, can set the photosensitive control, daytime or when the light is strong do not sense. Light-sensitive control is optional and photoresistors is not installed at the factory.
In addition, the sensor installation needs to be noted:
Infrared Pyroelectric human body sensor can only be installed indoors, infrared pyroelectric sensor should be 2.0 to 2.2 meters from the ground, infrared pyroelectric sensor should not be straight to the window, do not install in the area of strong airflow activity.
Pyroelectric infrared sensors are most insensitive to radial movement reactions and are most sensitive to cross-cutting direction (i.e., the direction perpendicular to the radius).
The wiring diagram is as follows:
The code is as follows:
"No requirements for library files, pins,"
int sensor= 2;//data pin interface for any I/O port can void Setup () {serial.begin (9600);
Pinmode (Sensor, INPUT);
} void Loop () {int sensorstate = Digitalread (Sensor);
Serial.println (sensorstate);
Delay (100); }