Connect a PlantMate DHT30 sensor and a small I²C OLED to an ESP32-DevKitC V4. Both devices share the same two signal wires. The sketch shows air temperature in Celsius and relative humidity as a percentage.
What you’ll need
- One PlantMate DHT30 PCB, 10 cm flat-flex cable, FPC adapter, and four-pin header from the PlantMate DHT30 Sensor Kit (5-Pack).
- An ESP32-DevKitC V4 with a classic ESP32 module and a USB data cable.
- A 3.3 V-compatible, four-pin 128 × 32 SSD1306 I²C OLED, a breadboard, and jumper wires. PlantMate 0.91-inch OLED
1. Wire the sensor and OLED
Disconnect USB power while wiring. Seat the flat cable fully in the sensor and adapter, with the contacts facing the connector contacts. Solder any loose headers before connecting the modules. Match the signal names in the table and trace the sensor pins through the adapter. The pin numbers shown are on the DHT30 PCB connector.
| ESP32-DevKitC V4 | DHT30 via the adapter | SSD1306 OLED |
|---|---|---|
| 3V3 | 3.3 V (pin 3) | VCC |
| GND | GND (pin 2) | GND |
| IO21 / GPIO21 | SDA (pin 1) | SDA |
| IO22 / GPIO22 | SCL (pin 4) | SCL |

Power both modules from 3.3 V. The sensor uses I²C address 0x38, and the sketch expects the OLED at 0x3C. If your OLED has pull-up resistors from SDA and SCL to 3.3 V, that pair serves the shared bus. If your setup has no pull-ups, add one 4.7 kΩ resistor from SDA to 3V3 and another from SCL to 3V3. ESP32-DevKitC V4 pinout

2. Install the Arduino libraries
- In Arduino IDE, install esp32 by Espressif Systems in Boards Manager. If the package is missing, follow the Espressif Arduino core installation instructions to add the package URL. Select ESP32 Dev Module and your board’s serial port.
- In Library Manager, install AlashAHT and Adafruit SSD1306. Install the suggested Adafruit GFX Library and Adafruit BusIO dependencies.
3. Upload the sketch
Download the ESP32 Arduino sketch (.ino)
Open the downloaded sketch in Arduino IDE, or copy the code below into a new sketch. Upload it to the ESP32. Open Serial Monitor at 115200 baud to see the readings or check wiring messages. The sketch refreshes the readings about every eight seconds.
Example OLED display
T 23.4 C
RH 45.6%

#include <Arduino.h>
#include <Wire.h>
#include <AlashAHT.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
constexpr int SDA_PIN = 21;
constexpr int SCL_PIN = 22;
constexpr uint32_t I2C_HZ = 100000;
constexpr uint8_t OLED_ADDRESS = 0x3C;
constexpr unsigned long UPDATE_INTERVAL_MS = 8000;
AlashAHT sensor;
Adafruit_SSD1306 oled(128, 32, &Wire, -1, I2C_HZ, I2C_HZ);
bool oledReady = false;
bool sensorReady = false;
void setup() {
Serial.begin(115200);
Wire.begin(SDA_PIN, SCL_PIN, I2C_HZ);
delay(100);
Wire.beginTransmission(OLED_ADDRESS);
oledReady = Wire.endTransmission() == 0 &&
oled.begin(SSD1306_SWITCHCAPVCC, OLED_ADDRESS, false, false);
if (oledReady) {
oled.setTextSize(2);
oled.setTextColor(SSD1306_WHITE);
oled.setTextWrap(false);
} else {
Serial.println(F("OLED did not start. Check the wiring and address."));
}
sensor.setLanguage(AlashAHT::LANG_EN);
}
void loop() {
if (!sensorReady) {
sensorReady = sensor.begin(Wire, false);
}
if (sensorReady && sensor.update()) {
const float temperature = sensor.temperature();
const float humidity = sensor.humidity();
Serial.print(temperature, 1);
Serial.print(F(" C, "));
Serial.print(humidity, 1);
Serial.println(F(" %RH"));
if (oledReady) {
oled.clearDisplay();
oled.setCursor(0, 0);
oled.print(F("T "));
oled.print(temperature, 1);
oled.println(F(" C"));
oled.print(F("RH "));
oled.print(humidity, 1);
oled.println('%');
oled.display();
}
} else {
sensorReady = false;
Serial.println(sensor.errorText());
if (oledReady) {
oled.clearDisplay();
oled.setCursor(0, 0);
oled.println(F("AHT30"));
oled.println(F("Check wire"));
oled.display();
}
}
delay(UPDATE_INTERVAL_MS);
}
4. Fit the sensor behind the vent
Once you see readings, mount the PCB with the AHT30 sensing area facing the vent. Route the flat cable to the adapter and leave room around the sensing area for air to circulate. Keep the sensor away from heat generated by the ESP32 and other power components where practical.
The CAD $0.99 DHT30 enclosure design download includes an editable STEP file and a printable STL for the vent and mounting section. Use the STEP to adapt the vent and sensor position to your own case.

If the display stays blank
Check the OLED’s power and signal labels, then check Serial Monitor. If your display uses 0x3D, change OLED_ADDRESS in the sketch and upload it again. If the screen shows AHT30 / Check wire, check that the flat cable is seated and the sensor receives 3.3 V, ground, SDA, and SCL through the adapter.

