diff --git a/README.md b/README.md index aebe2b6..bc97d94 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,17 @@ GPIO22 读人体红外(PIR)模块 OUT:每次检测到运动开始,屏幕 | 项目 | 说明 | |------|------| | 板子 | CYD ESP32-2432S028R | -| 模块 | 三脚人体红外感应(VCC / GND / OUT),如 HC-SR501 / HC-SR505 / AM312 等 | +| 模块 | 三脚小型人体红外(卖家常写 mini SR501,实际多为 **HC-SR505**) | +| 供电 | **3.3V**(本工程已实测可用) | | 输出 | **GPIO22** | +> 大圆头带电位器的是 HC-SR501,接线相同;大模块更稳妥用 5V。本仓库默认按小模块 + 3.3V 写。 + ### 接线 | 模块 | CYD | |------|-----| -| VCC | 优先 **5V**(HC-SR501 等大模块);仅明确标 3.3V 的小模块用 **3.3V** | +| VCC | **3.3V** | | GND | **GND** | | OUT / S / DO | **GPIO22** | @@ -24,13 +27,13 @@ GPIO22 读人体红外(PIR)模块 OUT:每次检测到运动开始,屏幕 - `MOTION` / `IDLE`:当前是否感应到人 - `hold` + 进度条:本次连续有人时长(约 0~5s 满格) -- `OUT HIGH/LOW` 与 `act=`:原始电平与有效电平 —— **挥手时 OUT 应变,不变就是供电/接线问题** +- `OUT HIGH/LOW` 与 `act=`:原始电平与有效电平 —— 挥手时 OUT 应变 HIGH 注意: -- 多数 PIR 上电后需 **约 30~60 秒** 预热才稳定 -- 确认 OUT 接到 **GPIO22**(不是 21 背光),共地 -- 模块有灵敏度/延时电位器时,灵敏度先拧到最大 +- 上电后约 **30~60 秒** 预热,此前可能无反应或乱跳 +- OUT 接 **GPIO22**(勿接 21 背光),必须共地 +- 小模块一般无灵敏度旋钮;检测距离大约 3m 量级 ## 操作 diff --git a/firmware/README.md b/firmware/README.md index 2b90767..133c4c0 100644 --- a/firmware/README.md +++ b/firmware/README.md @@ -3,7 +3,7 @@ 目录:[`cyd/`](cyd/) 板子:**CYD ESP32-2432S028R**(ILI9341) -功能:人体红外 PIR(GPIO22)计数 + SoftSPI 触控 + LVGL(同 tftest / btntest) +功能:小型人体红外 SR505/mini SR501(GPIO22、3.3V)计数 + SoftSPI 触控 + LVGL ## 刷写 diff --git a/firmware/cyd/VERSION.txt b/firmware/cyd/VERSION.txt index 2076979..1d02c4c 100644 --- a/firmware/cyd/VERSION.txt +++ b/firmware/cyd/VERSION.txt @@ -1,8 +1,8 @@ name: CYD Human IR / PIR (cyd) -git: a7854de +git: 6226f0d date: 2026-10-23 board: ESP32-2432S028R (ILI9341) -features: SoftSPI touch, LVGL, PIR OUT on GPIO22 motion count+1 +features: SoftSPI touch, LVGL, SR505/mini PIR OUT GPIO22 @3.3V motion count+1 flash_size: 4MB offsets: 0x1000 bootloader.bin @@ -12,5 +12,5 @@ offsets: sha256: bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8 boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0 - firmware.bin CA8FBB88050BC2284EFDDBF3ECC711A6539D4F3829994017812A30C0E2E6B057 + firmware.bin A870E56D4391E361A9FF6F73AA522D6ED2826937AE2565B50A9F5AA9D36D37CA partitions.bin 148B959CBFF1C38AA8E1D5C0BA9D612C54997B945E56A63F41223EEF650653A1 diff --git a/firmware/cyd/firmware.bin b/firmware/cyd/firmware.bin index 7a625e1..d47cf60 100644 Binary files a/firmware/cyd/firmware.bin and b/firmware/cyd/firmware.bin differ diff --git a/firmware/cyd/meta.json b/firmware/cyd/meta.json index b0db7e1..c150a34 100644 --- a/firmware/cyd/meta.json +++ b/firmware/cyd/meta.json @@ -1,7 +1,7 @@ { "boardId": "esp32-2432s028", "name": "CYD Human IR", - "summary": "PIR human infrared module on GPIO22: each motion start increments count", - "description": "SoftSPI touch + LVGL. VCC/GND/OUT->GPIO22. Auto polarity. Motion edge +1, hold bar, touch Reset clears.", - "tags": ["pir", "human-infrared", "gpio22", "touch", "lvgl", "counter"] + "summary": "Small PIR (SR505/mini SR501) on GPIO22 @ 3.3V: motion-start count +1", + "description": "SoftSPI touch + LVGL. VCC 3.3V / GND / OUT->GPIO22. Float INPUT, idle LOW active HIGH. Motion edge +1, hold bar, Reset clears.", + "tags": ["pir", "sr505", "human-infrared", "gpio22", "3.3v", "touch", "lvgl", "counter"] } diff --git a/firmware/export_from_build.ps1 b/firmware/export_from_build.ps1 index 69bad5f..5604550 100644 --- a/firmware/export_from_build.ps1 +++ b/firmware/export_from_build.ps1 @@ -41,7 +41,7 @@ $lines = @( "git: $git", "date: $date", "board: ESP32-2432S028R (ILI9341)", - "features: SoftSPI touch, LVGL, PIR OUT on GPIO22 motion count+1", + "features: SoftSPI touch, LVGL, SR505/mini PIR OUT GPIO22 @3.3V motion count+1", "flash_size: 4MB", "offsets:", " 0x1000 bootloader.bin", diff --git a/include/pins.h b/include/pins.h index a052674..d1e6cf9 100644 --- a/include/pins.h +++ b/include/pins.h @@ -10,7 +10,7 @@ #define CYD_TOUCH_CLK 25 #define CYD_TOUCH_CS 33 -// 人体红外感应模块 OUT → GPIO22(VCC→3.3V 或 5V 视模块,GND→GND) +// 小型人体红外(SR505 / mini SR501)OUT → GPIO22;VCC→3.3V,GND→GND #define PIR_PIN 22 #define SCREEN_WIDTH 240 diff --git a/src/pir.cpp b/src/pir.cpp index 2f8c4ec..2b27fa5 100644 --- a/src/pir.cpp +++ b/src/pir.cpp @@ -71,7 +71,7 @@ void pir_init() { g_idle_level == HIGH ? "HIGH" : "LOW", g_active_level == HIGH ? "HIGH" : "LOW", high_n); Serial.println( - "PIR tip: many modules need 5V VCC; warm-up ~30s; watch OUT on screen"); + "PIR tip: SR505/mini@3.3V OK; warm-up ~30s; OUT HIGH on motion"); } bool pir_poll_detect() {