SCD41 CO₂ Sensor with an ESP32 DevKit V1

A true photoacoustic NDIR CO₂ sensor (400-5000 ppm) with onboard temperature and humidity, read over I²C.

SCD41 CO₂ Sensor, A true photoacoustic NDIR CO₂ sensor (400-5000 ppm) with onboard temperature and humidity, read over I²C.
In short

The SCD41 breakout's VIN takes the ESP32 DevKit V1's 3V3, and its I2C goes to GPIO21 (SDA) and GPIO22 (SCL) at the fixed address 0x62. The sensor's measurement bursts are the part to plan for, because they share the 3V3 rail with the ESP32's own Wi-Fi bursts.

Wiring the SCD41 CO₂ Sensor to the ESP32 DevKit V1

Pin by pin.

SCD41 CO₂ SensorESP32 DevKit V1
VIN3V3
GNDGND
SCLGPIO22 (D22)
SDAGPIO21 (D21)

What to know on the ESP32 DevKit V1

  • A measurement pulls up to 205 mA at 3.3 V, and the ESP32 draws about 240 mA when transmitting 802.11b at full power. Sensirion asks for supply ripple under 30 mV, so decouple VIN well and keep the wires short.Sensirion SCD4x datasheet v1.5, p. 4; Espressif ESP32 Series Datasheet v5.3, p. 52
  • For a battery CO2 logger, single shot every 5 minutes averages 0.45 mA at 3.3 V, and the ESP32 can deep-sleep between readings.Sensirion SCD4x datasheet v1.5, p. 4
  • Place the sensor away from the DevKit: the ESP32's heat raises the temperature and lowers the humidity the SCD41 reports beside its CO2 reading.Espressif ESP32 Series Datasheet v5.3, p. 52
  • Leave the breakout's 3V3 pin unconnected: it is the regulator's output. Only VIN takes the ESP32's supply.Adafruit SCD-40 and SCD-41 guide, Pinouts

SCD41 CO₂ Sensor code for the ESP32 DevKit V1

Compiled for esp32:esp32:esp32 on 2026-10-30.

Libraries: sensirion/Sensirion I2C SCD4x
// SCD41 CO₂ Sensor on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/scd41-co2-sensor/esp32
#include <Wire.h>
#include <SensirionI2cScd4x.h>     // library 1.x: SensirionI2c, lower-case c

SensirionI2cScd4x scd4x;

void setup() {
  Serial.begin(9600);
  Wire.begin();
  scd4x.begin(Wire, SCD41_I2C_ADDR_62);
  scd4x.stopPeriodicMeasurement();     // clean state
  scd4x.startPeriodicMeasurement();    // ~5 s cadence
}

void loop() {
  uint16_t co2; float temp, hum;
  bool ready = false;
  scd4x.getDataReadyStatus(ready);
  if (ready && scd4x.readMeasurement(co2, temp, hum) == 0 && co2 != 0) {
    Serial.print("CO2: "); Serial.print(co2); Serial.print(" ppm  ");
    Serial.print(temp); Serial.print(" C  ");
    Serial.print(hum);  Serial.println(" %");
  }
  delay(1000);
}

SCD41 CO₂ Sensor on the ESP32 DevKit V1: questions

Can the ESP32's 3V3 pin power the SCD41?

Yes, with good decoupling. The sensor runs from 2.4 V to 5.5 V and peaks at 205 mA during a measurement (Sensirion datasheet, p. 4); keep leads short so those bursts and the ESP32's Wi-Fi bursts do not sag the rail.

How often does the SCD41 give a reading on the ESP32?

Every 5 seconds in periodic mode, as the page's sketch runs it, about every 30 seconds in low-power periodic mode, or on demand in single shot (Sensirion datasheet, pp. 8, 9, 14).

Keep going

For AI assistants

This guide as plain Markdown. /components/scd41-co2-sensor/esp32.md

What will you build with it?