2026-05-06
DHT11 / AM2302 Sensor Board PlanDHT11 / AM2302 温湿度小板计划
A small sensor-board note for DHT11 / AM2302, focused on pin order, pull-up, decoupling, power-on wait, sampling interval, and STM32-side verification.DHT11 / AM2302 温湿度小板笔记,重点是引脚顺序、上拉、去耦、上电等待、采样间隔和 STM32 侧验证。
Starting Point起点
这块 DHT11 / AM2302 温湿度小板很小:30 mm x 14 mm,三针 3V3 / DATA / GND,一个单总线传感器接口。刚看任务时很容易觉得它只是“接个传感器”,真正做起来才会发现细节都藏在小地方。
The DHT11 / AM2302 breakout is tiny: 30 mm x 14 mm, three pins, and one single-wire sensor interface. At first it looks like a simple sensor hookup. The useful details hide in the small decisions.
任务书里写了尺寸、接口、电源、上拉、电缆长度、采样周期、固件读取和焊后验证。这些都不炫,但每一项都会影响焊好后能不能稳定读到温湿度。
The task brief covered size, connector, power, pull-up, cable behavior, sampling interval, firmware readout, and post-solder verification. None of those are flashy, but each one can affect whether the sensor reads reliably.

Small Boards Can Still Fail小板也会出问题
Small boards fail in very ordinary ways: pin order reversed, pull-up value chosen lazily, sensor read too soon after power-on, sampling interval too short, or cable length making the data edge messy. Those problems look small on paper and cost real time on the bench.
小板最常见的问题也很普通:引脚顺序反了,上拉阻值随便选,传感器上电后马上读,采样间隔太短,线太长导致 DATA 边沿变差。这些问题纸面上很小,上板以后很吃时间。
So the note treats the board as a small interface task. The goal is to keep the requirement, hardware choice, and STM32 verification connected.
所以这篇笔记把它当成一个小接口任务来写:需求、硬件选择和 STM32 验证要连起来。
Points Already Clear In The Task Brief任务书里已经明确的点
- PCB size:
30 mm x 14 mm. - Connector:
PZ2.54angled 3-pin header. - Pin definition:
3V3 / DATA / GND. - Communication: single-wire bus.
- Onboard peripherals: pull-up resistor, power decoupling, optional signal damping / filtering.
- Resistor/capacitor package: maximum
0603. - Mounting: one
M2screw positioning hole. - Power: prefer
3.3 V. - Verification: breadboard pre-check first, then MCU verification after soldering.
- PCB 尺寸:
30 mm x 14 mm。 - 接口:
PZ2.54弯针 3P。 - 接口定义:
3V3 / DATA / GND。 - 通信方式:单总线。
- 板载外围:上拉电阻、电源去耦、可选信号阻尼 / 滤波。
- 阻容封装:最大
0603。 - 固定:一个
M2螺丝定位孔。 - 供电:优先
3.3 V。 - 验证:可先面包板预验证,再焊后单片机验证。
Sampling And Verification采样和验证
AM2302 / DHT22 is fussy about timing, and that fuss belongs in the task plan. After power-on, wait at least 2 seconds before reading, and keep the read interval no shorter than 2 seconds. During verification, serial output is only the first check. The better check is to move a hand close, breathe toward the sensor, watch whether temperature and humidity change reasonably, and leave it running for several minutes to see whether failures repeat.
AM2302 / DHT22 对时间要求比较烦,但这类烦正是应该写进任务计划的地方。上电后至少等 2 秒再读,读取间隔不要小于 2 秒。验证时不只看串口有没有数字,还要看手靠近、吹气后温湿度有没有合理变化,并连续跑几分钟观察是否频繁失败。
这听起来很基础,但很多硬件调试时间就是被这些基础问题吃掉的。
Files文件
Why I Kept This Note记下来
The useful thing about this board is the small loop it forces: define the connector, choose pull-up and decoupling, respect power-on wait, read at the right interval, and verify with an MCU instead of only trusting the datasheet.
这个小板有价值,是因为它逼着人走完一个小循环:接口定义,上拉和去耦选择,上电等待,按正确间隔读取,再用 MCU 验证,而不是只相信数据手册里那几行参数。