100%
room-pcb room-pcb view
Description

Imported from GitHub: Jerzeek/room-pcb · commit 418d232

Description

Room Sensor

README

Room Sensor

License: CERN OHL-S v2

Room Sensor

An open-source, mains-powered room sensor PCB based on the ESP32-C6. Measures CO2, temperature, humidity, illuminance, and presence, with a WS2812B LED status indicator. Supports both ESPHome (Wi-Fi / Home Assistant) and Zigbee firmware out of the box.


WARNING — MAINS AC VOLTAGE

This board connects directly to mains AC (100–240 V). Incorrect wiring or handling can cause electric shock, fire, or death. This project is intended for experienced makers who are comfortable working with mains-voltage electronics. Always work with the power disconnected. Comply with all local electrical codes. The authors accept no liability for any damage or injury.


Features

  • Direct mains AC input via onboard HLK-5M05 AC-DC converter (no external power brick needed)
  • CO2, temperature, and humidity via CozIR sensor (NDIR CO2, UART)
  • Ambient light via BH1750 (I2C, lux)
  • Secondary temperature + humidity via AHT20 (I2C)
  • Presence/occupancy detection via LD2410 mmWave radar (UART)
  • Visual CO2 status indicator: 2× WS2812B addressable LEDs
  • Polyfuse (F1) overcurrent protection
  • Reset/factory-reset button (BOOT pin)
  • ESP32-C6 SuperMini module — supports both Wi-Fi 6 and native Zigbee
  • Two equal-priority firmware options: ESPHome and Zigbee (Arduino)

Sensors

SensorPartInterfaceMeasures
CO2 (NDIR)CozIRUART (9600 baud)CO2 (ppm), temperature, humidity
Ambient lightBH1750FVI-TRI2C (0x23)Illuminance (lux)
Temperature + humidityAHT20I2CTemperature (°C), humidity (%RH)
Presence / occupancyLD2410UART (256000 baud)Presence, moving/stationary targets
Status LEDsWS2812B-2020 × 2GPIO (RMT)CO2 level indicator

Hardware

Main components

RefPartDescription
U5ESP32-C6 SuperMiniMain MCU — Wi-Fi 6 + Zigbee
PS1HLK-5M05AC-DC converter, 100–240 V AC → 5 V DC
U1CozIRNDIR CO2 / temp / humidity sensor
U2BH1750FVI-TRAmbient light sensor
U3AHT20Temperature + humidity sensor
J45-pin header (1.27 mm)LD2410 radar connection
D1, D2WS2812B-2020Addressable RGB LEDs
F1PolyfuseOvercurrent protection

Versions

VersionNotes
v4.1Current release — improved silkscreen
v4Production-ready layout
v3.1Earlier revision (3D model reference)
v3Initial working prototype

Building / Ordering

All files needed to order and assemble the PCB are in pcb/production/:

FilePurpose
room-pcb.zipGerber + drill files — upload directly to your PCB fab (JLCPCB, PCBWay, etc.)
bom.csvBill of materials for component sourcing
positions.csvPick-and-place / component placement file
designators.csvDesignator reference
netlist.ipcIPC-D-356 netlist for electrical testing

KiCad source files are in pcb/.

Firmware

ESPHome (Wi-Fi / Home Assistant)

Configuration is in code/esphome/room_sensor.yaml. A custom ESPHome component for the CozIR sensor is included under code/esphome/components/cozir/.

  1. Copy room_sensor.yaml and the components/ directory to your ESPHome config folder.
  2. Create a secrets.yaml with your wifi_ssid and wifi_password.
  3. Flash via esphome run room_sensor.yaml.

The LED indicates CO2 level:

ColorCO2
Green< 800 ppm (good)
Yellow800–1200 ppm (moderate)
Red> 1200 ppm (poor)

Calibration buttons are exposed to Home Assistant:

  • Calibrate Fresh Air (400 ppm) — use outdoors in clean air
  • Calibrate Nitrogen (0 ppm) — use with pure N2

Zigbee (Arduino / esp32-arduino)

Sketch is in code/combined_working_zigbee/combined_working_zigbee.ino. Requires the Arduino ESP32 core (≥ 3.x) with Zigbee support.

Before flashing:

  • In Arduino IDE → Tools → Zigbee Mode → select Zigbee ED (End Device)
  • Select a partition scheme that includes Zigbee (e.g., Zigbee 4MB with spiffs)

The sketch exposes four Zigbee endpoints:

EndpointClusterData
10CO2 (CarbonDioxide)CO2 ppm
11Temp + HumidityTemperature °C, humidity %RH
13IlluminanceLux
14OccupancyPresence (boolean)

Hold the BOOT button for 3 seconds to perform a Zigbee factory reset.

Repository layout

room-pcb/
├── pcb/                  KiCad project files
│   └── production/       Gerbers, BOM, placement — ready to order
├── code/
│   ├── esphome/          ESPHome YAML + custom CozIR component
│   └── combined_working_zigbee/  Arduino Zigbee sketch
├── 3Dmodels/             STEP model of the enclosure / board
├── CHANGELOG.md
├── CONTRIBUTING.md
└── LICENSE

License

Hardware (PCB and schematics) is licensed under the CERN Open Hardware Licence Version 2 — Strongly Reciprocal (CERN OHL-S v2). See LICENSE for the full text.

Firmware is licensed under the same CERN OHL-S v2 unless a file header states otherwise.

Comments
Sign in to comment

No comments yet. Be the first to ask about this board.