RackedPrice

Disclosure: We earn a commission from some links on this page. Details

Get an alert when a room gets stuffy

Rising CO2 means stale air. A CO2 sensor tells you when to open a window.

Make and tinker1 hourEasy

Drafted with AI assistance, fact-checked and approved by RackedPrice.

  1. Plug an SCD40 CO2 sensor into your Pi with a Qwiic cable.

    Install its library into the same sensors folder as the temperature sensor uses. Its hookup guide, linked from the sensor's page, has an example to check it reads.

    ~/sensors/bin/pip install sparkfun-qwiic-scd4x
  2. Send its readings to Home Assistant, the same way as the temperature sensor.

    Use the script from our room temperature sensor how-to. Swap the sensor lines for the SCD40's from its example, and send co2 with the unit ppm and device class carbon_dioxide.

  3. In Home Assistant, make an automation that alerts you when CO2 goes over a level you pick.

    Settings > Automations & scenes > Create automation. Trigger: Numeric state, your CO2 sensor, above the level you pick. Action: Notifications, send a notification to your phone's Home Assistant app.

  4. Try it in a bedroom with the door shut overnight.
Tip: SparkFun's docs say it's most accurate between 400 and 2,000 ppm, where a normal room sits.

Want every detail? Read the full guide

Build guide

Build the whole project

Temperature, humidity and real CO2 readings in Home Assistant from plug-in SparkFun sensors on a Raspberry Pi, plus an optional status screen and power monitoring.

Build Home Assistant room sensors with a Raspberry Pi (no soldering): every step and a priced parts list

Shopping (optional)

What you'll need

SparkFun doesn't share prices with us, so check the price on its page.

More make and tinker how-tos