Sensor HAT v3 "Universal": open-source indoor air-quality board for Raspberry Pi or Seeed XIAO
WHY I BUILT THIS
Good indoor air makes a real difference: high CO2 makes you tired and unfocused, and many people only notice when they already have a headache. Most cheap air-quality sensors do not measure CO2 at all. They estimate an "eCO2" value from VOC readings, which can be far off. And many DIY sensor builds heat themselves up, so temperature and humidity are wrong by several degrees.
I wanted one small, open board that measures the room climate properly and works with what people already have at home: a Raspberry Pi, or a tiny ESP32 module running ESPHome for Home Assistant. All of my design files, firmware and documentation are open source, so anyone can build, check and improve it.
WHAT IT MEASURES
- True CO2 with the photoacoustic Sensirion SCD41 (on its own 3.3 V regulator)
- Temperature and humidity with a Sensirion SHT40 on a milled, thermally isolated island
- VOC and NOx index with the Sensirion SGP41
- Ambient light in lux with the Vishay VEML7700
- Sound level with a TDK ICS-43434 I2S MEMS microphone (level only, no audio is sent)
On top of that there is an RGB status LED (for example as a CO2 traffic light), a button and a 4 kHz buzzer. Ports for add-ons:
- Sensirion SEN6x/SEN5x particulate matter sensor (JST GH; own 3.3 V regulator for the SEN6x, 5 V option for the SEN5x)
- mmWave presence radar on a UART port, 3.3 V or 5 V by solder jumper (the HLK-LD2420 fits directly at 3.3 V)
- 1-Wire, for example a DS18B20 temperature probe
- Qwiic / STEMMA QT for more I2C sensors
ONE BOARD, TWO MODES
The board runs in one of two modes, never both at once:
1. As a HAT on a Raspberry Pi 2, 3, 4 or 5, with a HAT+ ID EEPROM. A Python test script checks the on-board I2C sensors, the LED, the button, the buzzer and 1-Wire.
2. Standalone with a plug-in Seeed Studio XIAO ESP32-S3, -C3 or -C6. It is powered over the XIAO's USB-C, runs ESPHome and shows up directly in Home Assistant.

HOW THE HARDWARE WORKS
Power path. The board takes 5 V either from the Pi or from the XIAO's USB-C. Two TI LM66100 ideal diodes join the two sources, so no current flows from the Pi into the USB port or the other way round. A BAV70 dual diode switches the regulators on while the Pi's 3.3 V or the XIAO's 3.3 V is on. When a Pi turns its 3.3 V off, the board switches off too.
Separate supplies. Three AP2112K regulators make 3.3 V: one for the sensors and the 3.3 V ports (Qwiic, 1-Wire, radar), one only for the SCD41 (as Sensirion recommends) and one for the particulate sensor port, so the fan current pulses of the particulate sensor stay off the sensor supply. The RGB LED, the buzzer and the 5 V options for the radar and particulate ports get their own switched 5 V rail behind a 0.5 A resettable fuse. Its P-MOSFET switch turns on softly (about 1.4 ms), which keeps the inrush current off the XIAO's USB supply.
Protecting the host. Every XIAO signal line has a 100 Ohm series resistor. The radar header (TX, RX and the OUT pin) and the 1-Wire header have an SRV05-4 ESD protection array. The WS2812B LED gets its data through a 74LV1T125 level shifter, because it runs on 5 V.

THE PCB
The board measures 65 x 56 mm and has 4 layers:
- Top: all SMD parts, the XIAO sockets and the small headers, signals, ground fill
- Inner layer 1: a solid ground plane
- Inner layer 2: signals plus a 3.3 V fill
- Bottom: signals and ground fill. Only the 40-pin Pi socket sits on the bottom.
The solid ground plane (left out only at the sensor island, the mounting holes and the microphone hole) keeps the sensor signals clean and
helps with interference. All vias are 0.6/0.3 mm. All SMD parts are on the top side, so the board needs only one reflow pass.

The most important detail is the thermal island for the SHT40. Temperature sensors on small boards often read several degrees too high because the regulators and the host heat up the copper. Here the SHT40 sits on an island cut free by two milled L-shaped slots, in the bottom-right corner, away from the regulators and from the hot parts of a Pi. There are no copper planes on the island, and only four thin traces cross the narrow neck. That way, much less heat reaches the sensor through the board. In Pi mode the Pi still warms the air under the HAT, so an offset has to be calibrated there. Measuring how well the island works is part of the prototype tests.



The whole KiCad 10 project is generated from Python scripts. One file lists every part and every net, and both the schematic and the board are generated from it, so they cannot drift apart. The board is routed with Freerouting, and the sensor island is routed by hand.
Before publishing, I checked it like this:
- KiCad ERC: 0 errors. KiCad DRC with schematic parity: 0 errors, 0 unconnected items.
- In three AI-assisted review passes I checked the pin-outs of all parts against the datasheets, the footprints and part rotations against the LCSC footprints, the power paths of both modes and the XIAO boot pins. There has been no review by a professional electronics engineer yet, which is one more reason why real prototypes are needed.
- The ESPHome configs for the XIAO S3, C3 and C6 validate, and the S3 and C3 firmware compile.

Full schematic as PDF: https://github.com/Eniemooo/Sensor-HAT/blob/main/docs/Sensor-HAT-Schaltplan.pdf
SOFTWARE
ESPHome (XIAO mode): ready-made configs for the XIAO ESP32-S3, -C3 and -C6. Home Assistant gets:
- CO2, temperature, humidity
- VOC index, NOx index
- illuminance
- sound level and peak in approximate, unweighted dB (from the microphone's datasheet sensitivity, to be calibrated)
- the button
- a DS18B20 on the 1-Wire port
- optionally an LD2410 radar (ready-made package); the LD2420 and the Sensirion particulate sensors work with ESPHome's own components
The status LED works as a CO2 traffic light: green below 1000 ppm, orange below 2000 ppm, red above.
Raspberry Pi mode: a config.txt snippet, the HAT+ EEPROM settings and a Python test script for the I2C sensors, the LED, the button, the buzzer and 1-Wire. The microphone is checked with arecord.
WHAT HAPPENS NEXT
The design is finished, but it has never been built. The next steps are:
1. Build the first prototypes.
2. Measure:
- CO2 against fresh outdoor air (about 420 ppm) and a reference meter
- how well the sensor island works: SHT40 against a reference thermometer, in Pi mode and in XIAO mode
- sound level against a sound level meter
- current draw in both modes
3. Fix anything I find as v3.1 and publish all results.
4. Then a one-time, at-cost community group order, so that more people can get a board cheaply.
People in German maker forums have already reserved boards for the prototype run, and they will test them too.
All files are open: KiCad project, Gerber, BOM, CPL, ESPHome configs and the Pi test script.
Repository: https://github.com/Eniemooo/Sensor-HAT
WHO I AM:

I'm Emanuel, a hobby electronics maker from Germany. In my spare time I build home-automation hardware and publish it as open source. The Sensor HAT started as a Raspberry Pi-only design (versions 1 and 2, never built) and grew into the "Universal" version, so that people with an ESP32 and Home Assistant can use it too. I work on it alone, and I document everything on GitHub so that others can build on it.
PROJECT DESCRIPTION:
Board data:
- 65 x 56 mm, 4 layers (top / solid GND / signals + 3.3 V / bottom), 1.6 mm, ENIG
- vias 0.6/0.3 mm; two milled L-slots (1.2 mm wide) around the sensor island
- all SMD parts on the top side: 89 SMD placements (33 part types) plus 4 through-hole headers on top (J2, J3 and the XIAO sockets J7/J8). The 40-pin Pi socket J1 on the bottom is not assembled; I solder it myself.
Assembly notes:
- single reflow, peak max. 245 °C (SCD41, SGP41 and the microphone)
- the LGA/DFN sensors (SCD41, SGP41, SHT40, ICS-43434) need X-ray inspection
- do not wash the board, and do not cover the SGP41/SHT40 with tape
- keep the microphone's acoustic hole (bottom port) free of flux
The repository contains the KiCad project, Gerber, BOM and CPL files, ESPHome YAML configs and a Raspberry Pi test script.
Licences: CERN-OHL-S-2.0 (hardware), MIT (software), CC-BY-SA-4.0 or CERN-OHL-S-2.0 (documentation). Some symbols and footprints come from the LCSC/EasyEDA library, which has no licence of its own (see NOTICE.md in the repository).
WORDS TO PCBWAY:
Thank you for the feedback on my first application! I have added the block diagram, layer views, a close-up of the sensor island and more details about the design.
I would like to ask for support for the first prototype run at PCBWay: PCB fabrication and assembly of 5 to 10 boards. Some of them go to testers from the community who have already reserved boards.
In return I will:
- publish a build log with photos and measurement results (CO2 against a reference, the thermal behaviour of the sensor island, sound level, current draw) here on PCBWay, on GitHub and in the Home Assistant community forum
- mention and link PCBWay in the README and in all forum threads about the board
- put the PCBWay logo on the bottom silkscreen: there is already a free 32 x 8 mm area for it
The project is non-commercial: an at-cost community group order is planned afterwards, and I do not intend to sell the design. Thank you for considering it!
Apply for sponsorship >>- Comments(1)
- Likes(1)