Files
humanInfraredModuletest/README.md
DESKTOP-PUHFO60\dsx2016 bab93d0e36 Add human IR (PIR) module test on GPIO22 with SoftSPI touch and LVGL.
Motion-start count, hold bar, auto polarity, and flashable firmware/cyd package.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 14:46:56 +08:00

55 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 人体红外感应模块(CYD)
GPIO22 读人体红外(PIR)模块 OUT:每次检测到运动开始,屏幕计数 +1。
## 硬件
| 项目 | 说明 |
|------|------|
| 板子 | CYD ESP32-2432S028R |
| 模块 | 三脚人体红外感应(VCC / GND / OUT),如 HC-SR501 / HC-SR505 / AM312 等 |
| 输出 | **GPIO22** |
### 接线
| 模块 | CYD |
|------|-----|
| VCC | **3.3V**(部分模块标 5V 时用 **5V**,以模块说明为准) |
| GND | **GND** |
| OUT / S / DO | **GPIO22** |
开机自动采空闲电平,反相视为有人(兼容「有人变高」或「有人变低」)。
屏上:
- `MOTION` / `IDLE`:当前是否感应到人
- `hold` + 进度条:本次连续有人时长(约 0~5s 满格)
- `OUT HIGH/LOW` 与 `act=`:原始电平与有效电平
上电校准的几秒内请勿在感应区活动,否则空闲电平会采错。
## 操作
- 在感应范围内走动/挥手:计数 +1(模块保持时间内只计一次开始边沿)
- 触控 **Reset**:清零
## 构建 / 烧录
```bash
pio run -e cyd -t upload
```
预编译包:
```powershell
cd firmware\cyd
.\flash.ps1
# 或 .\flash.ps1 -Port COMx
```
导出固件:
```powershell
.\firmware\export_from_build.ps1
```