Awes0meE / 66CCFF LabXJTLU Undergraduate西交利物浦大学本科生
Back to notes返回笔记

2026-05-06

DHT11 / AM2302 Sensor Board PlanDHT11 / AM2302 温湿度小板计划

A small-board note for a DHT11 / AM2302 sensor task, focusing on interface definition, pull-up and decoupling choices, sampling timing, and STM32 verification.DHT11 / AM2302 温湿度传感器小板任务笔记,重点是接口定义、上拉与去耦、采样时序和 STM32 验证。

SensorPCBDHT11AM2302
Related Project相关项目Juanyun Thermal Management Hardware and Firmware Archive卷云科技热管理硬件与固件开发档案

Starting Point起点

The temperature-and-humidity breakout-board line is very small, so small that at first it felt unnecessary to write a separate note. It does not have multiple PCBs like the external unit board, and it does not have shiny keywords like FOC. Later I realized that a small task can show whether the work was really made complete.

温湿度小板这条线很小,小到一开始会觉得没必要单独写。毕竟它不像外机控制板那样有多块 PCB,也不像 FOC 那样关键词很亮。后来想想,小任务反而能看出有没有把事情做完整。

一个 DHT11 / AM2302 小板,如果只说“接一个传感器”,确实没什么可写。但如果从任务书、尺寸、接口、电源、上拉、电缆长度、采样周期、固件读取、失败处理一路想下来,它就变成了一个小而完整的硬件任务。

DHT11 / AM2302 breakout plan cover / DHT11/AM2302 小板计划封面
DHT11 / AM2302 breakout plan coverDHT11/AM2302 小板计划封面

Small Boards Can Still Fail小板也会出问题

It is worth writing down, but not worth overselling. What this board shows is task decomposition, not technical complexity. Many embedded issues start from this kind of "small interface": reversed pin order, unclear pull-up choice, reading immediately after power-on, sampling too frequently, or long wires making edges poor.

值得写,但不能硬吹。它能说明的是任务拆解,不是技术复杂度。嵌入式里很多问题就是从这种“小接口”开始出错的:引脚顺序反了、上拉没想清楚、传感器上电后马上读、采样间隔太短、线太长导致边沿变差。

Points Already Clear In The Task Brief任务书里已经明确的点

  • PCB size: 30 mm x 14 mm.
  • Connector: PZ2.54 angled 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 M2 screw 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, but this kind of 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, do not only check whether the serial port prints numbers; move a hand close, breathe toward the sensor, watch whether temperature and humidity change reasonably, and run it for several minutes to see whether failures repeat. It sounds basic, but many hardware debugging hours are eaten by exactly these basic details.

AM2302 / DHT22 对时间要求比较烦,但这类烦正是应该写进任务计划的地方。上电后至少等 2 秒再读,读取间隔不要小于 2 秒。验证时不只看串口有没有数字,还要看手靠近、吹气后温湿度有没有合理变化,并连续跑几分钟观察是否频繁失败。

这听起来很基础,但很多硬件调试时间就是被这些基础问题吃掉的。

Files文件

Why I Kept This Note记下来

Small tasks also deserve careful notes. This board is not flashy, but it pushes one concrete requirement through a small hardware, firmware, and testing loop: size, connector, pull-up, decoupling, power-on wait, and sampling interval. None of those should be waved away with "it should be fine."

小任务也要认真写。这个板子不炫,但它把一个具体需求推进到硬件、固件和测试的小闭环里:尺寸、接口、上拉、去耦、上电等待、采样间隔,一个都不能靠“应该没事”带过去。