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.
Drafted with AI assistance, fact-checked and approved by RackedPrice.
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-scd4xSend 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
co2with the unitppmand device classcarbon_dioxide.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.
- Try it in a bedroom with the door shut overnight.
Want every detail? Read the full 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.
What you'll need
- SCD40 CO2 sensor (Qwiic)Check price at SparkFun
- Qwiic Cable KitCheck price at SparkFun
SparkFun doesn't share prices with us, so check the price on its page.
More make and tinker how-tos
Set up your first Raspberry Pi
A tiny computer for learning, projects and small home servers.
30 minutesPlug sensors into a Pi (no soldering)
SparkFun's Qwiic cables click in one way only. No soldering, no wiring mistakes.
20 minutesMake a room temperature sensor
See a room's temperature and humidity in Home Assistant, from a sensor you put together.
1 hour