Arduino Uno + PIR Sensor

hc-sr501-labelled-althc-sr501

PIR Motion Sensor Module (HC-SR501)

จำนวน 1 ตัว

ตรวจจับความเคลื่อนไหว
Color: White + Green
Dimension: 3.2cm x 2.4cm x 1.8cm (approx)
Infrared sensor with control circuit board
The sensitivity and holding time can be adjusted
Working Voltage Range: DC 4.5V- 20V
Current drain:<60uA
Voltage Output: High/Low level signal:3.3V TTL output
Detection distance: 3–7M(can be adjusted)
Detection range: <140°
Delay time: 5-200S(can be adjusted, default 5s +-3%)
Blockade time: 2.5 S (default)
Trigger: L: Non-repeatable trigger H: Repeat Trigger (default)
Work temperature:-20-+80°C
Trigger Method: L unrepeatable trigger / H repeatable trigger

arduino-pir

 

int ledPin= 13;
int inputPin= 3;

void setup(){
pinMode(ledPin, OUTPUT);
pinMode(inputPin, INPUT);
}

void loop(){
int value= digitalRead(inputPin);

if (value == HIGH)
{
digitalWrite(ledPin, HIGH);
delay(1000) ;
}

else
{
digitalWrite(ledPin, LOW);
}
}

 

ที่มา:https://www.arduinoall.com/product/29/pir-hc-sr501-%E0%B9%80%E0%B8%8B%E0%B8%99%E0%B9%80%E0%B8%8B%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%95%E0%B8%A3%E0%B8%A7%E0%B8%88%E0%B8%88%E0%B8%B1%E0%B8%9A%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B9%80%E0%B8%84%E0%B8%A5%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%99%E0%B9%84%E0%B8%AB%E0%B8%A7-motion-sensor-module-hc-sr501