'2) Sensor/PIR_Motion'에 해당되는 글 2건

  1. 2016.09.08 Mini Infrared PIR Motion Sensor (HC-SR505) [S055]
  2. 2016.09.08 PIR Motion Sensor (HC-SR501) Delay Control [S010]

Mini Infrared PIR Motion Sensor (HC-SR505) [S055]



https://www.youtube.com/watch?v=v9lOgEYHBlk


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



* Specs

Operating temperature range: -20℃~+70℃

Working voltage: DC 5V~9V

Working current: 5mA

Static current: <50uA

Output high voltage: 4V

Out type: High/low level

Retention time of high level output: 20 secs

Detective range: 2~3m (Normal)

Detective angle: <140°

Triggering method: repeated triggering

PCB Dimension: 27mm x12mm


* Contents

- Connect

-  ----- GND

out ----- D2

+ ----- 5V


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>

 

LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

int pin = 2;

int count = 0;

int led = 13;

 

void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");

 

  pinMode(pin,INPUT);

  pinMode(led,OUTPUT);

 

  delay(1000);

 

  lcd.clear();

}

 

void loop()

{

 

  lcd.setCursor(0,0);

  lcd.print("S055:mini PIR");

 

  int val = digitalRead(pin);

 

  lcd.setCursor(0,1);

  lcd.print("val=" + (String)val + "  ");

 

 

  lcd.setCursor(0,2);

  lcd.print("count=" + (String)count + " sec  ");

  

  if(val == 1)

  {

    digitalWrite(led, HIGH);

    count++;

  }

  else

  {

    digitalWrite(led, LOW);

    count = 0;  

  }

  delay(1000);

}

Posted by RD IoT RDIoT

댓글을 달아 주세요

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

}

Posted by RD IoT RDIoT

댓글을 달아 주세요