2019-02-14 10:21:14 +08:00
|
|
|
# PIR ユニット {docsify-ignore-all}
|
2018-10-31 17:02:56 +08:00
|
|
|
|
2018-12-25 15:24:34 +08:00
|
|
|
<img src="assets/img/product_pics/unit/M5GO_Unit_pir.png" width="30%" height="30%"><img src="assets/img/product_pics/unit/unit_pir_grove_b.png" width="30%" height="30%">
|
2018-12-21 16:14:45 +08:00
|
|
|
|
2018-12-25 15:24:34 +08:00
|
|
|
***
|
|
|
|
|
|
2019-03-21 19:22:50 +08:00
|
|
|
:memo:**[概要](#概要)** :octocat:**[サンプルコード](#サンプルコード)** :electric_plug:**[回路図](#回路図)** 🛒**[購入リンク](https://www.aliexpress.com/store/product/M5Stack-Official-Mini-PIR-Sensor-Human-Body-Infrared-PIR-Motion-Sensor-Detector-Module-GPIO-GROVE-Connector/3226069_32931794651.html)**
|
2018-11-29 12:38:44 +08:00
|
|
|
|
2018-11-01 18:58:31 +08:00
|
|
|
## 概要
|
2018-10-31 17:02:56 +08:00
|
|
|
|
2019-03-21 19:22:50 +08:00
|
|
|
**<mark>PIR</mark>**ユニットは人間の動き(モーション)を検出する事が可能な赤外線センサーユニットです。誰かが通りすぎたかどうかを検知します。赤外線の変化を検知すると一定時間(ディレイタイムの間)HIGHを出力します。検知し続けている間はHIGHのままですが、人が離れたらLOWを出力します。
|
|
|
|
|
|
|
|
|
|
**Grove port B**でM5Coreと通信します。
|
2018-10-31 17:02:56 +08:00
|
|
|
|
2018-11-01 18:58:31 +08:00
|
|
|
## 特徴
|
2018-10-31 17:02:56 +08:00
|
|
|
|
2018-11-02 16:22:57 +08:00
|
|
|
- 測定可能距離 150cm
|
2019-03-21 19:22:50 +08:00
|
|
|
- ディレイタイム: 2s
|
|
|
|
|
- 検知範囲: < 100°
|
|
|
|
|
- 待機電流: < 60uA
|
|
|
|
|
- 動作温度: -20 - 80 °C
|
|
|
|
|
- GROVEインターフェース、サポートプログラミング[UIFlow](http://flow.m5stack.com)、[Arduino](http://www.arduino.cc)
|
2018-11-02 16:22:57 +08:00
|
|
|
- LEGO 互換ホール
|
2018-10-31 17:02:56 +08:00
|
|
|
|
2019-03-21 19:22:50 +08:00
|
|
|
## 関連リンク
|
|
|
|
|
|
|
|
|
|
- **[公式ビデオ](https://www.youtube.com/channel/UCozgFVglWYQXbvTmGyS739w)**
|
|
|
|
|
|
|
|
|
|
- **[フォーラム](http://forum.m5stack.com/)**
|
|
|
|
|
|
2018-12-25 15:24:34 +08:00
|
|
|
## サンプルコード
|
2018-10-31 17:02:56 +08:00
|
|
|
|
2018-12-25 15:24:34 +08:00
|
|
|
### 1. Arduino IDE
|
2018-10-31 17:02:56 +08:00
|
|
|
|
2019-03-21 19:22:50 +08:00
|
|
|
*以下のソースコードは一部です。完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/PIR/Arduino)。*
|
2018-12-29 18:15:57 +08:00
|
|
|
|
|
|
|
|
```arduino
|
|
|
|
|
#include <M5Stack.h>
|
|
|
|
|
|
|
|
|
|
// initialization
|
|
|
|
|
M5.begin();
|
|
|
|
|
pinMode(36, INPUT);// set pir sensor pin as input
|
|
|
|
|
|
|
|
|
|
// read data
|
|
|
|
|
int value = digitalRead(36);// read the pin(0: not detectd 1: detected)
|
|
|
|
|
M5.update();
|
|
|
|
|
```
|
2018-11-02 16:22:57 +08:00
|
|
|
|
2018-12-25 15:24:34 +08:00
|
|
|
### 2. UIFlow
|
2018-11-02 16:22:57 +08:00
|
|
|
|
2019-03-21 19:22:50 +08:00
|
|
|
*以下のソースコードは一部です。完全なソースコードは[こちら](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/PIR/UIFlow)。*
|
2018-12-29 18:15:57 +08:00
|
|
|
|
2019-01-18 16:14:09 +08:00
|
|
|
<img src="assets/img/product_pics/unit/unit_example/PIR/example_unit_pir_03.png">
|
2018-12-29 18:15:57 +08:00
|
|
|
|
2018-12-25 15:24:34 +08:00
|
|
|
## 回路図
|
|
|
|
|
|
|
|
|
|
<img src="assets/img/product_pics/unit/pir_sch.JPG">
|
|
|
|
|
|
2018-12-27 16:13:35 +08:00
|
|
|
### ピンマップ
|
2018-12-25 15:24:34 +08:00
|
|
|
|
|
|
|
|
<table>
|
2018-12-29 18:15:57 +08:00
|
|
|
<tr><td>M5Core(GROVEインターフェースB)</td><td>GPIO36</td><td>GPIO26</td><td>5V</td><td>GND</td></tr>
|
|
|
|
|
<tr><td>人体赤外線誘導Unit</td><td>赤外線検知ピン</td><td> </td><td>5V</td><td>GND</td></tr>
|
2018-12-25 15:24:34 +08:00
|
|
|
</table>
|