Files
inmp441test/README.md
DESKTOP-PUHFO60\dsx2016 8b2a2cbc0b Fix INMP441 silent meter: stereo I2S slots and DC removal.
ESP32 left/right naming often mismatches L/R=GND, and DC bias made dB look stuck.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-27 21:00:29 +08:00

88 lines
2.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 INMP441 声贝检测
ESP32 Cheap Yellow Display + INMP441(I2S)+ LVGL 声级仪表盘(近似 dB SPL)。
默认 **2.8" ESP32-2432S028R**;可选 **3.5" ESP32-3248S035C**(`cyd_35r`)。
引脚约定见同目录 [CYD_PROJECT_GUIDE.md](../CYD_PROJECT_GUIDE.md);UI 壳参考 [sgp30test](../sgp30test)。
## 硬件
| 项目 | 2.8" · 2432S028R | 3.5" C · 3248S035C |
|------|------------------|---------------------|
| 屏驱 | ILI9341 | ST7796 |
| 触控 | XPT2046 SoftSPI | GT911 Wire1(SDA33/SCL32/INT21/RST25) |
| 背光 TFT_BL | **GPIO21** | **GPIO27** |
| INMP441 WS | **GPIO22**(CN1/P3) | **GPIO22** |
| INMP441 SCK | **GPIO27**(CN1) | **GPIO21**(CN1;勿占 27=BL) |
| INMP441 SD | **GPIO35**(P3,仅输入) | **GPIO35** |
| 供电 | USB 5V;麦克风 **3.3V** | 同左 |
接线:
| INMP441 | CYD |
|---------|-----|
| VDD | 3.3V(CN1) |
| GND | GND |
| L/R | GND(左声道,勿悬空) |
| WS | IO22 |
| SCK | IO27(2.8)/ IO21(3.5) |
| SD | IO35(P3) |
> 不要接 5V;不要占用背光脚。I2S 需要三根信号线,仅 IO22+IO27 不够。
## 功能
- 大圆弧显示近似 **dB SPL**(基于 INMP441 −26 dBFS @ 94 dB 的换算,非标定声级计)
- 分级:QUIET / SOFT / NORMAL / LOUD / VERY LOUD / DANGER
- PEAK 峰值保持(缓慢回落)、MIN/MAX、电平条、底部趋势图
- EMA 平滑;串口打印 `dB / rms / peak`
- 短按切换背光(4 档);长按 ≥0.7s 重置 min/max
- 常亮运行(无自动熄屏)
## 构建与烧录
依赖 [PlatformIO](https://platformio.org/)。
```bash
pio run -e cyd_28r -t upload # 2.8"
pio run -e cyd_35r -t upload # 3.5C
pio device monitor -b 115200
```
### 预编译固件
| 板型 | 目录 |
|------|------|
| 2.8" | [`firmware/cyd_28r/`](firmware/cyd_28r/) |
| 3.5" | [`firmware/cyd_35r/`](firmware/cyd_35r/) |
```powershell
cd firmware\cyd_28r # 或 cyd_35r
.\flash.ps1
```
重新打包:
```powershell
.\firmware\export_from_build.ps1
.\firmware\export_from_build.ps1 -Env cyd_35r
```
## 项目结构
```
platformio.ini
include/pins.h lv_conf.h touch.h
src/main.cpp touch.cpp
scripts/exclude_lvgl_asm.py
firmware/
README.md
```
## 变更记录
| 日期 | 说明 |
|------|------|
| 2026-10-27 | 修复无声贝变化:I2S 改立体声读槽(ESP32 L/R 与麦脚常反相)+ 去直流后再算 RMS |
| 2026-10-27 | 初版:INMP441 I2S 声贝仪表盘(WS22/SCK27/SD35),LVGL 圆弧 + peak/min/max + 趋势图 |