Sensirion SCD30 CO2 sensor with ESP32
Supply 3.3-5 V
Bus I2C
I2C address
0x61
Measures co2, temperature, humidity
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| VDD | Power | 3V3 | Pin 1 |
| GND | Ground | GND | Pin 2 |
| SCL | I2C clock (SCL) | D22 | Pin 3 (TX/SCL). The sensor stretches the clock: use 50 kHz or less |
| SDA | I2C data (SDA) | D21 | Pin 4 (RX/SDA) |
| RDY | Interrupt | D35 | Pin 5. HIGH when a new reading is ready, optional |
| PWM | Output (the part drives it) | D25 | Pin 6. PWM CO2 output, optional |
| SEL | Not 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
- Sensirion SCD30 datasheet, Pin 1 VDD, 2 GND, 3 TX/SCL, 4 RX/SDA, 5 RDY, 6 PWM, 7 SEL; supply 3.3 to 5.5 V
- Sensirion SCD30 interface description, I2C address 0x61, max 100 kHz, clock stretching up to 150 ms
Try it in 3D in BoardPilot
Related parts
ADS1015 12-bit ADCADS1115 16-bit ADCADXL375 high-g accelerometer (±200 g)AHT10 temperature + humidityAHT20 + BMP280 combo moduleAHT20 temperature + humidity
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.