Arduino-Human Infrared sensor (PIR) module hc-sr501

Source: Internet
Author: User

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); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.