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

}

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

PIR Motion Sensor (HC-SR501) Delay Control [S010]  (0) 2016.09.08
Posted by RDIoT
|