Sensirion SCD30 CO2 sensor with ESP32

Supply 3.3-5 V Bus I2C I2C address 0x61 Measures co2, temperature, humidity
VDDGNDSCLSDARDYPWMSEL

Pins and ESP32 wiring

PinRoleESP32 pinNotes
VDDPower3V3Pin 1
GNDGroundGNDPin 2
SCLI2C clock (SCL)D22Pin 3 (TX/SCL). The sensor stretches the clock: use 50 kHz or less
SDAI2C data (SDA)D21Pin 4 (RX/SDA)
RDYInterruptD35Pin 5. HIGH when a new reading is ready, optional
PWMOutput (the part drives it)D25Pin 6. PWM CO2 output, optional
SELNot wired to the ESP32—Pin 7. Leave open or LOW for I2C; HIGH selects Modbus

Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.

Starter code (Arduino)

#include <Wire.h>

void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);  // SDA = GPIO 21, SCL = GPIO 22
  Wire.beginTransmission(0x61);
  bool found = Wire.endTransmission() == 0;
  Serial.println(found ? "Sensirion SCD30 CO2 sensor found at 0x61" : "Not found: check power, GND and SDA/SCL");
}

void loop() {}

Sources

Try it in 3D in BoardPilot

BoardPilot Part data (JSON)

Related parts

Part data: CC BY 4.0, free to reuse with credit to BoardPilot.