> For the complete documentation index, see [llms.txt](https://docs.sysout.co.kr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sysout.co.kr/base-language/arduino/arduino-control/digital-input/pir-sensor.md).

# PIR 센서

## 근적외선 인체 감지 센서(PIR 센서)

PIR(Passive Infrated Sensor)는 적외선을 통해 열을 발산하는 물체의 움직임을 감지하는 센서이다. 감지 각도 범위 내에서 적외선의 변화가 있을 시 High(1) 신호를, 없을 시 Low(0) 신호를 출력하는 센서이다.

<div align="left"><img src="/files/-Mf1oS77lxqKPZHrYe68" alt=""></div>

### 결선도

```
VCC to 5V
OUTPUT to DIGITAL-PIN-2
GND to GND
```

### 샘플 코드

```
void setup() {
  pinMode(2, INPUT);
  Serial.begin(9600);

  //PIR 센서는 30~60초의 구동 딜레이가 필요하다.
  for(int i=60; i > 0; i--){
    Serial.print(i);
    Serial.println("초 후 구동 시작");
    delay(1000);
  }
}

void loop() {
  int state = digitalRead(2);
  Serial.println(state);

  delay(100);
}
```

### 컴파일

`Ctrl+R` 또는 스케치 메뉴의 `확인/컴파일`을 눌러 컴파일을 진행한다.

### 업로드

`Ctrl+U` 또는 스케치 메뉴의 `업로드`를 눌러 업로드를 진행한다.

### 실행 결과

실행 시 감지 상태에 따라서 HIGH(1) 또는 LOW(0)이 출력된다.

### 주의사항

PIR 센서의 경우 센서의 예열 작업이 필요하기 때문에 첫 구동 시 최소 지연 시간으로 감도를 조절한 뒤 약 1분간의 대기가 필요하다. 이후 원하는 지연시간으로 설정하여 사용할 수 있으며, 그 이전에는 정상적으로 작동되지 않는다.

<div align="left"><img src="/files/-Mf1oY8QSg83dTgeDKcB" alt=""></div>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sysout.co.kr/base-language/arduino/arduino-control/digital-input/pir-sensor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
