ESP32-C3 焊进 4 层 PCB 塞 4 颗传感器,Maker 自制空气质量仪太硬核!ESP32-C3 Soldered onto a 4-Layer PCB with 4 Sensors — This Maker-Built Air Quality Monitor Is Seriously Capable


AI free token/AI免费积分

本文来源:https://mp.weixin.qq.com/s/DCr1C-lI63G9QoYaKL1KtQ

如果您不愿意本站收录,请来信告知:13951431913@139.com 或在右方提交评论。

图片

一台 DIY 空气质量监测仪,能玩的不只是「测个 CO₂ 数值」——它把 ESP32-C3、4 颗 Sensirion/Bosch 传感器、一块自绘 4 层 PCB、激光切割玻璃顶盖、3D 打印外壳全揉进一个成品里,固件跑 ESPHome,直接接进 Home Assistant。作者 roepkefeller 把从电路、板厂打样、外壳建模到自校准算法全套开源,Star 数目前 53,硬件党拿来复刻或者魔改都很合适。

它一句话是什么

一台围绕 ESP32-C3-WROOM-02 打造的开源空气质量监测仪,主打「多传感器交叉补偿 + Home Assistant 原生集成」。

为什么值得看

市面上便宜的空气质量小盒子一大堆,但这个项目值得看的地方在于——它把「为什么这样设计」写得很清楚。

  • 为什么明明有 3 颗温度传感器、2 颗湿度传感器,还要全都焊上去?作者给出的答案是:做中位数融合 + 交叉补偿,因为 SGP41 的 MOX 加热元件内部工作在约 400 °C,会把整块板子烤热,必须靠算法补偿。
  • 电源部分不是随便一颗 LDO 完事:USB-C → ESD 保护 → 750 mA 自恢复保险丝 → 三条独立 3.3V 电源轨,SCD41 单独一条 LDO,SGP41/SHT40/BMP280 共用 TPS7A20 超低噪声 LDO(10 µVRMS),ESP32 用 buck 走高效路线。
  • PCB 是 4 层板(信号 / GND / 电源 / 信号),KiCad 源文件、JLCPCB 打样文件、SGP41 自绘封装全都在 repo 里。

一句话,它不是拿现成模块拼一拼,是从原理图到外壳一整套工程实践的公开样本。

最有意思的 3 个功能

1. 4 颗传感器交叉补偿,不是堆料是算法

  • SCD41:光声 NDIR 原理测 CO₂,接受 BMP280 的气压值做海拔补偿
  • SGP41:输出 VOC / NOx 指数(1–500),CO₂ 数据不可用时 LED 会 fallback 到 VOC 显示
  • SHT40:温湿度基准,中位数融合里权重双倍
  • BMP280:气压 + 为 SCD41 提供补偿输入

作者甚至给出了经验校正值:SHT40 补 −5.5 °C / +8 %RH,BMP280 补 −5.5 °C,SCD41 补 −1.5 °C / +4 %RH,还建议放一支基准温度计旁边稳定 30 分钟后自己调 YAML。

2. 固件走 ESPHome,Home Assistant 一插就见实体

不用自己写 C 代码,YAML 描述完就有一堆实体自动出现在 HA 里,Web UI 也直接内建。对不想折腾底层驱动的人非常友好。

3. 外壳是激光切玻璃顶盖 + 3D 打印底座

  • 玻璃:2 mm 透明玻璃,DXF 文件走 Formulor 下单
  • 底座:PLA 或 PETG,0.2 mm 层高
  • 用 M2.5 热熔螺母 + 铜柱固定,比直接拧塑料结实很多

Fusion 360 源文件、STL、STEP、DXF 都开源,想改造型直接改。

动手实践:安装 / 快速开始

这是硬件项目,「快速开始」不是 npm install,而是一套备料 + 焊接 + 刷固件流程。README 里明确写了以下步骤:

Step 1. 备板 & 备料

# 用 KiCad 打开工程 git clone https://github.com/roepkefeller/air-quality-sensor.git 

打开 hardware/ 里的 KiCad 工程,作者本人是发到 JLCPCB 打样 4 层板 + 手焊。BOM 里的核心料:ESP32-C3-WROOM-02、SCD41、SGP41、SHT40、BMP280、TLV62569A、TLV755P、TPS7A20、TPD2EUSB30。

Step 2. 手焊顺序(README 明确建议)

  1. 先焊 ESP32-C3-WROOM-02(最大件,底部散热焊盘需要热风或从背面加热)
  2. 再焊 TLV62569A、TLV755P、TPS7A20、TPD2EUSB30 等 SOT/WSON 小封装(用锡膏 + 热风)
  3. 焊 SGP41(注意 repo 里有自绘封装 air_quality_footprints.pretty/)
  4. 焊 SCD41、SHT40、BMP280(Sensirion LCC 封装,SCD41 光学开孔部分别烤过头)
  5. 最后焊 0402/0603 被动件和连接器

预期看到:板子通电后有 3.3V 输出、I2C 总线上能扫到 4 个地址。

Step 3. 刷 ESPHome 固件

repo 里带 ESPHome YAML 配置,装好 ESPHome 后编译烧录即可(USB-C 通过 5V/1A 供电就能刷):

pip install esphome esphome run <配置文件>.yaml 

预期看到:Home Assistant 自动发现设备,出现 CO₂、VOC、NOx、温度、湿度、气压等实体,Web UI 也能直接访问。

踩坑提醒:

  • 这是手工焊接项目,SGP41 是自绘封装,0402 电阻电容 + WSON 小封装对新手不太友好,建议至少备热风台
  • 4 层板 JLCPCB 打样价格比 2 层贵一档,一次不建议只做 1 片
  • 温度校正值是作者在自己环境实测出来的,你复刻后要自己重调,否则读数会偏
  • I2C 总线跑在 50 kHz(README 明确说明),不要按默认 100 kHz 配置

可以怎么玩 / 怎么用

  • 家里房间空气监测
    :接进 Home Assistant,配自动化——CO₂ 过 1000 ppm 自动开新风或提醒开窗
  • 做工程练手
    :4 层板、多路电源、超低噪声 LDO、I2C 多传感器融合,这些是嵌入式硬件工程里典型场景,拿这个项目啃一遍收获比看教程实在
  • 改造成便携版
    :作者原设计是插 USB 供电的桌面款,你可以接锂电改成移动版
  • 换传感器阵列
    :I2C 总线预留了 QWIIC 接口,可以外挂扩展

适合谁

  • 想复刻一台能进 Home Assistant 的正经空气监测仪的智能家居党
  • 想学多传感器交叉补偿 + 4 层板 layout的嵌入式 / 硬件工程师
  • 想练SMD 手焊 + 热风返修的 Maker
  • ESPHome 老玩家,想要一台不用自己写驱动的高质量硬件参考设计

不适合:只想开箱即用不想动烙铁的普通用户——目前 repo 里没有卖成品,全靠自己攒。

读者互动

你家里现在测空气用的是什么方案?米家小盒子、Awair、还是自己攒的 ESP 板?

评论区聊聊:如果让你在这套设计上再加一颗传感器,你会加什么?PM2.5、甲醛、还是氡气检测? 感兴趣的人多,我下期安排一篇 ESPHome 多传感器融合的深度拆解。

觉得有用就点个关注吧,下一期预告:一个把 AI 塞进单片机、成本压到令人发指的骚项目,别错过。

长按 / 扫码关注,硬件、AI、Maker 项目一条龙推送。

GitHub 地址

https://github.com/roepkefeller/air-quality-sensor

 

Source: https://mp.weixin.qq.com/s/DCr1C-lI63G9QoYaKL1KtQ

If you do not wish this site to republish it, please contact us: 13951431913@139.com or leave a comment on the right.

图片

A DIY air quality monitor offers far more than 'reading a CO₂ number' — it merges an ESP32-C3, four Sensirion/Bosch sensors, a self-laid-out 4-layer PCB, a laser-cut glass top cover and a 3D-printed shell into a single finished product, with firmware running on ESPHome that plugs straight into Home Assistant. The author, roepkefeller, has open-sourced the whole set — circuit design, PCB fabrication files, shell modelling and the self-calibration algorithm. It currently has 53 stars, and it is a great reference whether you want to reproduce it or mod it.

What it is in one sentence

An open-source air quality monitor built around the ESP32-C3-WROOM-02, focused on 'multi-sensor cross-compensation plus native Home Assistant integration'.

Why it is worth a look

There are plenty of cheap air quality boxes on the market, but what makes this project worth studying is that it explains clearly why each design decision was made.

Why solder on 3 temperature sensors and 2 humidity sensors when you could get by with fewer? The author's answer is median fusion plus cross-compensation, because the MOX heating element inside the SGP41 operates at around 400 °C and heats up the entire board, which must be compensated for algorithmically.

The power section is not just any old LDO: USB-C → ESD protection → a 750 mA resettable fuse → three independent 3.3 V power rails. The SCD41 gets its own dedicated LDO, while the SGP41/SHT40/BMP280 share a TPS7A20 ultra-low-noise LDO (10 µVRMS); the ESP32 runs on a buck converter for efficiency.

The PCB is a 4-layer board (signal / GND / power / signal), and the KiCad source files, JLCPCB fabrication files and the custom SGP41 footprint are all in the repo.

In short, this is not a kit of off-the-shelf modules snapped together — it is a public sample of a complete engineering practice, from schematic to enclosure.

The 3 most interesting features

1. Four sensors cross-compensating — not spec inflation, but algorithm

SCD41: photoacoustic NDIR measurement of CO₂, taking the barometric pressure from the BMP280 for altitude compensation

SGP41: outputs VOC / NOx indices (1–500); when CO₂ data is unavailable the display falls back to VOC

SHT40: temperature and humidity reference, weighted double in the median fusion

BMP280: barometric pressure, and provides compensation input for the SCD41

The author even provides empirical correction values: −5.5 °C / +8 %RH for the SHT40, −5.5 °C for the BMP280, and −1.5 °C / +4 %RH for the SCD41. He also suggests placing a reference thermometer nearby and adjusting the YAML yourself after letting it stabilise for 30 minutes.

2. Firmware runs on ESPHome, and Home Assistant shows real entities the moment you plug it in

You do not write any C code yourself — describe the setup in YAML and a batch of entities automatically appear in HA, with the Web UI built in. Very friendly to anyone who does not want to wrestle with low-level drivers.

3. The enclosure is a laser-cut glass top plus a 3D-printed base

Glass: 2 mm clear glass, ordered via Formulor using the DXF file

Base: PLA or PETG, 0.2 mm layer height

Fixed with M2.5 heat-set inserts and brass standoffs, which is far sturdier than screwing straight into plastic

The Fusion 360 source files, STL, STEP and DXF are all open, so you can modify the form factor directly.

Hands-on: installation and quick start

This is a hardware project, so 'quick start' is not npm install but a preparation, soldering and firmware-flashing workflow. The README spells out the following steps:

Step 1. Prepare the board and materials

Open the KiCad project under hardware/. The author had the 4-layer board fabricated at JLCPCB and soldered it by hand. The core parts in the BOM are: ESP32-C3-WROOM-02, SCD41, SGP41, SHT40, BMP280, TLV62569A, TLV755P, TPS7A20 and TPD2EUSB30.

Step 2. Hand-soldering order (as recommended in the README)

Solder the ESP32-C3-WROOM-02 first (the largest part; the thermal pad underneath needs hot air or heating from the back)

Then solder the small SOT/WSON packages such as TLV62569A, TLV755P, TPS7A20 and TPD2EUSB30 (using solder paste and hot air)

Solder the SGP41 (note the custom footprint in air_quality_footprints.pretty/ in the repo)

Solder the SCD41, SHT40 and BMP280 (Sensirion LCC packages; do not overheat the optical opening on the SCD41)

Finally solder the 0402/0603 passives and connectors

What you should see: 3.3 V on the board after powering up, and 4 addresses detectable on the I2C bus.

Step 3. Flash the ESPHome firmware

The repo ships with an ESPHome YAML configuration — install ESPHome, compile and flash, and you are done (the 5 V / 1 A supply over USB-C is enough to flash):

What you should see: Home Assistant auto-discovers the device, with entities for CO₂, VOC, NOx, temperature, humidity, barometric pressure and more, and the Web UI is directly accessible.

Pitfall warnings:

This is a hand-soldering project. The SGP41 uses a custom footprint, and 0402 passives plus WSON packages are not beginner-friendly — have a hot air station ready at minimum.

A 4-layer JLCPCB board costs a tier more than a 2-layer one, so do not order just a single unit.

The temperature correction values were measured by the author in his own environment. When you reproduce the build you need to re-tune them yourself, otherwise the readings will be off.

The I2C bus runs at 50 kHz (as the README explicitly notes) — do not configure it at the default 100 kHz.

How you can use or extend it

: connect it to Home Assistant and set up automations — turn on fresh air or prompt opening a window when CO₂ exceeds 1000 ppm

: a 4-layer board, multiple power rails, an ultra-low-noise LDO and multi-sensor I2C fusion are all typical embedded hardware engineering scenarios — working through this project teaches you more than any tutorial

: the author's original design is a USB-powered desktop unit, but you can attach a lithium battery and turn it into a portable version

: a QWIIC connector is reserved on the I2C bus for add-on expansion

Who it suits

Smart-home enthusiasts who want to reproduce a proper air monitor that can integrate with Home Assistant

Embedded and hardware engineers who want to learn multi-sensor cross-compensation and 4-layer board layout

Makers who want to practise SMD hand-soldering and hot-air rework

ESPHome regulars who want a high-quality hardware reference design that does not require writing drivers themselves

Who it does not suit: ordinary users who just want something that works out of the box and never want to touch a soldering iron — the repo does not sell a finished unit, you have to build it yourself.

Reader interaction

What is your current air-quality setup at home? A Xiaomi box, an Awair, or an ESP board you built yourself?

Discuss in the comments: if you could add one more sensor to this design, what would you choose — PM2.5, formaldehyde, or radon detection? If there is enough interest, I will do an in-depth teardown of ESPHome multi-sensor fusion in the next issue.

If you found this useful, hit follow. Next issue preview: a cheeky project that stuffs AI into a microcontroller and drives the cost down to an absurd level — do not miss it.

Press and hold / scan the code to follow us. Hardware, AI and Maker projects delivered in one feed.

GitHub address

https://github.com/roepkefeller/air-quality-sensor

暂无评论,快来发表第一条评论吧!No comments yet. Be the first!

📮 需求咨询📮 Inquiry