PIR Motion Sensor (HC-SR501) Delay Control [S010]



- Delay Control : https://www.youtube.com/watch?v=wF7I4zXJE9Y



- H(Repeat Trigger) : https://www.youtube.com/watch?v=IUh-8-ZBjNA


*GitHub : https://github.com/rdiot/rdiot-s010.git


* Specs

Voltage: 5V – 20V

Power Consumption: 65mA

TTL output: 3.3V, 0V

Delay time: Adjustable (.3->5min)

Lock time: 0.2 sec

Trigger methods: L – disable repeat trigger, H enable repeat trigger

Sensing range: less than 120 degree, within 7 meters

Temperature: – 15 ~ +70

Dimension: 32*24 mm, distance between screw 28mm, M2, Lens dimension in diameter: 23mm


* Contents

- DataSheet : https://www.mpja.com/download/31227sc.pdf


- Key Code

int pirPin = A0; //PIR

int ledPin = 13; //LED 

int val;

int val2; // Counter & DelayTime

 

void setup() {

  Serial.begin(9600);

  pinMode(pirPin, INPUT); 

  pinMode(ledPin, OUTPUT);

}

 

void loop() {    

  val = digitalRead(pirPin); //read state of the PIR

  Serial.print("PIR Value=" + (String)val);

  Serial.print(",Delay Count=" + (String)val2);

  Serial.println(",Delay Time=" + (String)(val2*0.1) + "sec");

 

if (val == LOW) {

  digitalWrite(ledPin, LOW);  

  val2 = 0;

}

else {

  digitalWrite(ledPin, HIGH);

  val2++;

}

delay(100);

}

'2) Sensor > PIR_Motion' 카테고리의 다른 글

Mini Infrared PIR Motion Sensor (HC-SR505) [S055]  (0) 2016.09.08
Posted by RDIoT
|