Files
humanInfraredModuletest/README.md
DESKTOP-PUHFO60\dsx2016 6226f0dbc2 Fix PIR input: float GPIO (no pull-down) and log raw level changes.
Internal pull-down could hold OUT low; default idle=LOW/active=HIGH and prefer 5V VCC.

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

59 lines
1.4 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 | 优先 **5V**(HC-SR501 等大模块);仅明确标 3.3V 的小模块用 **3.3V** |
| GND | **GND** |
| OUT / S / DO | **GPIO22** |
引脚用浮空 `INPUT`(无内部上/下拉)。默认空闲 LOW、有人 HIGH;开机若采样明显偏 HIGH 则自动反相。
屏上:
- `MOTION` / `IDLE`:当前是否感应到人
- `hold` + 进度条:本次连续有人时长(约 0~5s 满格)
- `OUT HIGH/LOW` 与 `act=`:原始电平与有效电平 —— **挥手时 OUT 应变,不变就是供电/接线问题**
注意:
- 多数 PIR 上电后需 **约 30~60 秒** 预热才稳定
- 确认 OUT 接到 **GPIO22**(不是 21 背光),共地
- 模块有灵敏度/延时电位器时,灵敏度先拧到最大
## 操作
- 在感应范围内走动/挥手:计数 +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
```