BME680 Arduino: Temperature, Humidity, Pressure and IAQ Guide
BME680 Arduino guide: temperature, humidity, pressure and VOC gas resistance, IAQ index with BSEC2, heater profile, ESP32 and Pico code, BME280 vs CCS811.
In BME680 Arduino projects a single tiny chip gives you four measurements at once: temperature, relative humidity, air pressure and a gas resistance that reacts to volatile organic compounds (VOCs) in the air. Bosch's sensor adds a heated metal-oxide (MOX) gas sensor on top of the popular BME280. The gas resistance on its own isn't a ppm value; Bosch's BSEC2 library combines it with temperature and humidity and turns it into an IAQ (indoor air quality) index from 0 to 500, an equivalent CO2 and a breath VOC value.
In this guide you'll learn how the heater inside the BME680 works, what the gas resistance tells you and how to read the IAQ scale. First you'll read the raw values on an Arduino Uno with the Adafruit library, then compute the real IAQ index with BSEC2 on an ESP32 and save the calibration to non-volatile memory. You'll write a simple gas indicator in MicroPython for the Raspberry Pi Pico, and finally compare the BME680 with the BME280 and CCS811.
What is the BME680 and how does it work?
The BME680 packs four sensors into a 3 × 3 mm package. The temperature, humidity and pressure parts work the same way as in the BME280 and are corrected with calibration coefficients written at the factory. The fourth part is a metal-oxide layer on a tiny heater plate. When the plate is heated to a few hundred degrees, VOC molecules in the air react with oxygen on the layer's surface and the layer's electrical resistance drops. So the gas resistance is high in clean air and low in air with paint, alcohol, perfume or a crowded room. The sensor supports I2C and SPI; on I2C the SDO pin sets the address. For the basics of the bus, see the what is I2C article.
| Feature | BME680 |
|---|---|
| Measurements | Temperature, relative humidity, pressure, gas resistance (VOC) |
| Temperature | −40 to +85 °C, typical ±1 °C |
| Humidity | 0–100% RH, typical ±3% |
| Pressure | 300–1100 hPa, absolute ±0.6 hPa |
| Supply (chip) | 1.71–3.6 V; modules usually have a 3.3 V regulator |
| Current | 0.09–12 mA depending on mode (highest with heater on) |
| Interface | I2C (0x76 or 0x77) and SPI |
| Chip ID | 0x61 (same as BME688) |
Gas resistance and heater profile
Before every gas measurement the BME680 heats the heater to the target temperature you set and holds it there for a certain time; this is called the heater profile. Adafruit's examples and most projects use 320 °C for 150 ms. When the measurement ends the heater turns off, so the average current depends on how often you measure. Gas resistance isn't an absolute value: two different sensors in the same room can show 50 kΩ and 150 kΩ. What matters is the change; the further the resistance drops below the clean-air level, the dirtier the air. A new sensor should run continuously for 24–48 hours of burn-in on first use, then warm up for about 30 minutes after every power-on; during that time the resistance slowly rises and settles.
| Setting | Typical value | Effect |
|---|---|---|
| Target temperature | 320 °C (range 200–400 °C) | Higher temperatures are more sensitive to some gases |
| Heating time | 150 ms | Short speeds up the measurement, long improves stability |
| Measurement interval (BSEC LP) | 3 seconds | Fast response, more current and self-heating |
| Measurement interval (BSEC ULP) | 300 seconds | Battery friendly, slow response |
| Initial burn-in | 24–48 hours | Resistance settles permanently |
| Warm-up at every power-on | About 30 minutes | Don't trust IAQ values during this time |
Wiring: Arduino Uno, ESP32 and Raspberry Pi Pico
| BME680 module | Arduino Uno | ESP32 | Raspberry Pi Pico |
|---|---|---|---|
| VCC | 5V (module with regulator) or 3.3V | 3V3 | 3V3(OUT), pin 36 |
| GND | GND | GND | GND |
| SDA (SDI) | A4 | GPIO 21 | GP4 (I2C0 SDA) |
| SCL (SCK) | A5 | GPIO 22 | GP5 (I2C0 SCL) |
| SDO | GND: 0x76, VCC: 0x77 | Same | Same |
| CS | Unconnected (pulled to VCC on the module) or 3.3 V | Same | Same |
| Logic level | 5 V, level shifter recommended | 3.3 V | 3.3 V |
Step by step: raw BME680 readings with Arduino
- In the Arduino IDE, open Library Manager, search for Adafruit BME680 and install it with its dependencies (Adafruit Unified Sensor, Adafruit BusIO).
- Wire the module to the Uno as in the table; tying SDO to GND sets the address to 0x76.
- Upload the code below and open the Serial Monitor at 115200 baud.
- Hold an alcohol wipe or the cap of a perfume bottle in front of the sensor; watch the gas resistance drop clearly within a few seconds and slowly rise again when you take it away.
1// BME680: sıcaklık, nem, basınç ve gaz direnci (Arduino Uno, Adafruit BME680 kütüphanesi)
2// BME680: temperature, humidity, pressure and gas resistance (Arduino Uno, Adafruit BME680 library)
3#include <Wire.h>
4#include <Adafruit_Sensor.h>
5#include <Adafruit_BME680.h>
6
7#define DENIZ_SEVIYESI_HPA 1013.25 // bulunduğun yerin deniz seviyesi basıncı / local sea-level pressure
8
9Adafruit_BME680 bme; // I2C: SDA = A4, SCL = A5
10
11void setup() {
12 Serial.begin(115200);
13 while (!Serial) { }
14 // Mor modüller genelde 0x76, Adafruit kartı 0x77 / purple modules usually 0x76, Adafruit board 0x77
15 if (!bme.begin(0x76) && !bme.begin(0x77)) {
16 Serial.println(F("BME680 bulunamadi: kablo ve adresi kontrol et / not found: check wiring and address"));
17 while (true) delay(10);
18 }
19 bme.setTemperatureOversampling(BME680_OS_8X);
20 bme.setHumidityOversampling(BME680_OS_2X);
21 bme.setPressureOversampling(BME680_OS_4X);
22 bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
23 bme.setGasHeater(320, 150); // ısıtıcı 320 °C, 150 ms / heater 320 °C for 150 ms
24}
25
26void loop() {
27 if (!bme.performReading()) { // tek ölçüm başlat ve bekle / start one measurement and wait
28 Serial.println(F("Okuma hatasi / reading failed"));
29 delay(1000);
30 return;
31 }
32 Serial.print(F("Sicaklik / temperature: ")); Serial.print(bme.temperature, 1); Serial.println(F(" C"));
33 Serial.print(F("Nem / humidity: ")); Serial.print(bme.humidity, 1); Serial.println(F(" %"));
34 Serial.print(F("Basinc / pressure: ")); Serial.print(bme.pressure / 100.0, 1); Serial.println(F(" hPa"));
35 Serial.print(F("Gaz direnci / gas: ")); Serial.print(bme.gas_resistance / 1000.0, 1); Serial.println(F(" kOhm"));
36 Serial.print(F("Yukseklik / altitude: ")); Serial.print(bme.readAltitude(DENIZ_SEVIYESI_HPA), 0); Serial.println(F(" m"));
37 Serial.println();
38 delay(3000); // 3 s aralık kendi kendini ısıtmayı sınırlar / 3 s interval limits self-heating
39}The code tries address 0x76 first, then 0x77. The oversampling settings reduce noise: temperature is measured 8 times, humidity 2 times and pressure 4 times and averaged, and the IIR filter smooths sudden pressure jumps such as a door opening. performReading() starts one measurement, waits for the heater profile to finish and writes the results into the bme object's fields. Pressure arrives in pascals, so it's divided by 100. readAltitude() calculates altitude from the sea-level pressure; for an accurate result, take DENIZ_SEVIYESI_HPA from your local weather report. For the BME280 equivalent of these readings, see the BME280 sensor article.
IAQ air quality index with BSEC2
Raw gas resistance is also affected by humidity and temperature; as humidity rises the resistance drops and the air can look polluted. Bosch's free but closed-source BSEC2 library removes these effects, keeps calibrating itself by learning the cleanest and dirtiest values of recent days, and places the results on an IAQ scale from 0 to 500. The library comes as a precompiled binary and supports the ESP32 family, the ESP8266 and ARM Cortex-M processors. There is no binary for the Arduino Uno's 8-bit AVR, and 2 KB of RAM isn't enough anyway, so we use an ESP32 for IAQ. Bosch's IAQ scale is:
| IAQ | Air quality | What to do |
|---|---|---|
| 0–50 | Excellent | No action needed |
| 51–100 | Good | No action needed |
| 101–150 | Lightly polluted | Ventilation suggested |
| 151–200 | Moderately polluted | Increase ventilation with clean air |
| 201–250 | Heavily polluted | Optimise ventilation |
| 251–350 | Severely polluted | Find the source of contamination |
| 351 and above | Extremely polluted | Maximise ventilation and reduce time spent in the room |
| BSEC2 output | Unit | Meaning |
|---|---|---|
| IAQ | 0–500 | Air quality scaled to the sensor's own history |
| Static IAQ | 0–500 | Unscaled IAQ for stationary devices |
| CO2 equivalent (eCO2) | ppm | CO2 estimated from IAQ, not a real CO2 measurement |
| Breath VOC equivalent (bVOC) | ppm | Estimate based on the VOC mix in human breath |
| Accuracy | 0–3 | 0 run-in, 1 uncertain, 2 calibrating, 3 calibrated |
| Heat-compensated temperature and humidity | °C, % | Values with the self-heating effect removed |
ESP32 code: IAQ with BSEC2 and persistent calibration

- Search for bsec2 (Bosch Sensortec) in Library Manager and install it; its dependency BME68x Sensor library comes along.
- Choose the ESP32 Dev Module board from the Tools menu and connect the BME680 to GPIO 21 and 22.
- Upload the code; in the first outputs accuracy is 0 and IAQ sits around 50, which is normal.
- Leave the sensor running for a few hours, hold it once in fresh air or at an open window, and once in a closed container you've breathed into. When accuracy reaches 3, the code saves the calibration to NVS memory.
1// ESP32 + BME680 + Bosch BSEC2: IAQ, eCO2 ve bVOC; kalibrasyon durumu NVS'ye kaydedilir
2// ESP32 + BME680 + Bosch BSEC2: IAQ, eCO2 and bVOC; calibration state is saved to NVS
3#include <Wire.h>
4#include <Preferences.h>
5#include <bsec2.h>
6
7// BME680 için BSEC2 ayarı: 3,3 V besleme, 3 s örnekleme (LP), 4 günlük geçmiş
8// BSEC2 config for BME680: 3.3 V supply, 3 s sampling (LP), 4-day history
9const uint8_t bsecAyar[] = {
10#include "config/bme680/bme680_iaq_33v_3s_4d/bsec_iaq.txt"
11};
12
13#define SDA_PIN 21
14#define SCL_PIN 22
15const unsigned long KAYIT_ARALIGI = 6UL * 60UL * 60UL * 1000UL; // 6 saatte bir kaydet / save every 6 h
16
17Bsec2 sensor;
18Preferences hafiza;
19uint8_t durum[BSEC_MAX_STATE_BLOB_SIZE];
20volatile bool kalibreOldu = false; // doğruluk 3'e ulaştı mı / accuracy reached 3?
21unsigned long sonKayit = 0;
22
23// Bosch IAQ ölçeğine göre sınıf / class on the Bosch IAQ scale
24const char *iaqSinifi(float iaq) {
25 if (iaq <= 50) return "Mukemmel / excellent";
26 if (iaq <= 100) return "Iyi / good";
27 if (iaq <= 150) return "Hafif kirli / lightly polluted";
28 if (iaq <= 200) return "Orta kirli / moderately polluted";
29 if (iaq <= 250) return "Cok kirli / heavily polluted";
30 if (iaq <= 350) return "Agir kirli / severely polluted";
31 return "Asiri kirli / extremely polluted";
32}
33
34void hataKontrol() {
35 if (sensor.status < BSEC_OK || sensor.sensor.status < BME68X_OK) {
36 Serial.printf("BSEC hata / error: %d, BME68x: %d\n", (int)sensor.status, (int)sensor.sensor.status);
37 while (true) delay(1000);
38 }
39}
40
41// BSEC2 her yeni ölçümde bu fonksiyonu çağırır / BSEC2 calls this on every new result
42void yeniVeri(const bme68xData data, const bsecOutputs outputs, Bsec2 bsec) {
43 float iaq = 0, co2 = 0, voc = 0, sic = 0, nem = 0, bas = 0;
44 uint8_t dogruluk = 0;
45 for (uint8_t i = 0; i < outputs.nOutputs; i++) {
46 const bsecData &o = outputs.output[i];
47 switch (o.sensor_id) {
48 case BSEC_OUTPUT_IAQ: iaq = o.signal; dogruluk = o.accuracy; break;
49 case BSEC_OUTPUT_CO2_EQUIVALENT: co2 = o.signal; break;
50 case BSEC_OUTPUT_BREATH_VOC_EQUIVALENT: voc = o.signal; break;
51 case BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE: sic = o.signal; break;
52 case BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY: nem = o.signal; break;
53 case BSEC_OUTPUT_RAW_PRESSURE: bas = o.signal; break;
54 default: break;
55 }
56 }
57 Serial.printf("IAQ %.0f (dogruluk / accuracy %u) %s\n", iaq, dogruluk, iaqSinifi(iaq));
58 Serial.printf("eCO2 %.0f ppm, bVOC %.2f ppm, %.1f C, %.1f %%, %.1f hPa\n\n", co2, voc, sic, nem, bas / 100.0);
59 if (dogruluk == 3) kalibreOldu = true;
60}
61
62void setup() {
63 Serial.begin(115200);
64 Wire.begin(SDA_PIN, SCL_PIN);
65
66 bsecSensor liste[] = {
67 BSEC_OUTPUT_IAQ, BSEC_OUTPUT_CO2_EQUIVALENT, BSEC_OUTPUT_BREATH_VOC_EQUIVALENT,
68 BSEC_OUTPUT_RAW_PRESSURE, BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE,
69 BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY
70 };
71
72 // Mor modüller 0x76, Adafruit kartı 0x77 / purple modules 0x76, Adafruit board 0x77
73 if (!sensor.begin(BME68X_I2C_ADDR_LOW, Wire) && !sensor.begin(BME68X_I2C_ADDR_HIGH, Wire)) hataKontrol();
74 if (!sensor.setConfig(bsecAyar)) hataKontrol();
75 sensor.setTemperatureOffset(TEMP_OFFSET_LP); // kendi kendini ısıtma düzeltmesi / self-heating offset
76
77 // Önceki kalibrasyonu geri yükle / restore the previous calibration
78 hafiza.begin("bsec", false);
79 if (hafiza.getBytesLength("durum") == BSEC_MAX_STATE_BLOB_SIZE) {
80 hafiza.getBytes("durum", durum, BSEC_MAX_STATE_BLOB_SIZE);
81 if (sensor.setState(durum)) Serial.println("Kalibrasyon yuklendi / calibration restored");
82 }
83
84 if (!sensor.updateSubscription(liste, ARRAY_LEN(liste), BSEC_SAMPLE_RATE_LP)) hataKontrol();
85 sensor.attachCallback(yeniVeri);
86}
87
88void loop() {
89 if (!sensor.run()) hataKontrol(); // zamanı gelince ölçer ve hesaplar / measures and processes when due
90
91 // Kalibre olduysa 6 saatte bir durumu sakla / once calibrated, save state every 6 h
92 if (kalibreOldu && (sonKayit == 0 || millis() - sonKayit > KAYIT_ARALIGI)) {
93 if (sensor.getState(durum)) {
94 hafiza.putBytes("durum", durum, BSEC_MAX_STATE_BLOB_SIZE);
95 sonKayit = millis();
96 Serial.println("Kalibrasyon kaydedildi / calibration saved");
97 }
98 }
99}The bsecAyar array loads the BME680-specific configuration file shipped inside the library: 33v means the sensor is powered at 3.3 V, 3s is the measurement interval (LP mode), and 4d means the last 4 days are used for calibration. BSEC2's default configuration is meant for a 1.8 V supply; for 3.3 V modules Bosch asks you to load this configuration file. The run() function is called continuously in loop(); when a measurement is due it reads the sensor, processes the result and calls yeniVeri(). The calibration state is a 238-byte block. It is written to the NVS partition in flash with the ESP32's Preferences library and restored at every power-on, so the sensor doesn't lose days of learning after a power cut. To avoid wearing out the flash, it is saved only every 6 hours.
BME680 with Raspberry Pi Pico and MicroPython
There's no MicroPython version of BSEC2, but the bme680.py file adapted from the Adafruit driver is enough to read the raw values. After copying the file onto the Pico with Thonny, the code below reads the sensor over I2C0; temperature returns °C, humidity percent, pressure hPa and gas ohms. The code doesn't compute IAQ; instead it takes the average of the first 5 minutes as the clean-air baseline and shows the ratio of the gas resistance to that baseline as a simple percentage. When you air the room, the baseline is updated too.
1# Raspberry Pi Pico + BME680 (MicroPython): ham ölçümler ve basit gaz göstergesi
2# Raspberry Pi Pico + BME680 (MicroPython): raw readings and a simple gas indicator
3# bme680.py dosyasını (robert-hh BME680-Micropython) Thonny ile Pico'ya kopyala
4# Copy bme680.py (robert-hh BME680-Micropython) to the Pico with Thonny
5from machine import I2C, Pin
6import time
7from bme680 import BME680_I2C
8
9i2c = I2C(0, sda=Pin(4), scl=Pin(5), freq=100000) # GP4 = SDA, GP5 = SCL
10print("I2C:", [hex(a) for a in i2c.scan()]) # 0x76 ya da 0x77 görmelisin / expect 0x76 or 0x77
11bme = BME680_I2C(i2c, address=0x76) # Adafruit kartında 0x77 / 0x77 on Adafruit boards
12bme.sea_level_pressure = 1013.25
13
14ISINMA = 60 # ilk 60 ölçüm (yaklaşık 5 dk) ısınma / first 60 readings (about 5 min) warm-up
15sayac = 0
16toplam = 0
17taban = None # temiz hava gaz direnci / clean-air gas resistance
18
19while True:
20 t = bme.temperature
21 h = bme.humidity
22 p = bme.pressure # hPa
23 g = bme.gas # ohm
24 sayac += 1
25 if taban is None:
26 toplam += g
27 if sayac >= ISINMA:
28 taban = toplam / ISINMA
29 durum = "isinma / warm-up %d/%d" % (sayac, ISINMA)
30 else:
31 if g > taban:
32 taban = g # daha temiz hava görüldü / cleaner air seen
33 oran = 100 * g / taban
34 if oran >= 90:
35 durum = "temiz / clean"
36 elif oran >= 70:
37 durum = "normal"
38 elif oran >= 50:
39 durum = "havalandir / ventilate"
40 else:
41 durum = "kotu / poor"
42 durum = "%.0f %% %s" % (oran, durum)
43 print("%.1f C %.1f %% %.1f hPa %.1f kOhm %s" % (t, h, p, g / 1000, durum))
44 time.sleep(5)BME680 vs BME280 vs CCS811

| Feature | BME280 | BME680 | CCS811 |
|---|---|---|---|
| Temperature, humidity, pressure | Yes | Yes | No |
| Gas measurement | No | MOX gas resistance (VOC) | MOX, eCO2 and TVOC |
| Ready air quality value | - | IAQ, eCO2, bVOC with BSEC2 | eCO2 (ppm), TVOC (ppb) on chip |
| Air quality on Arduino Uno | - | Raw gas resistance only | Yes (Adafruit library) |
| Warm-up | Not needed | About 30 min at every power-on | 20 min, 48 hours on first use |
| Humidity and temperature compensation | - | Built in (BSEC2) | From an external sensor such as BME280 |
| I2C address | 0x76 / 0x77 | 0x76 / 0x77 | 0x5A / 0x5B |
If you only need temperature, humidity and pressure, the BME280 is the right choice: cheaper and more frugal. If you want a ready eCO2 and TVOC number on an Arduino Uno, the CCS811 does the job, but needs a second sensor next to it for temperature and humidity. If you want four measurements in one module plus Bosch's calibration algorithm, the BME680 with an ESP32 is the most balanced pair. Remember that eCO2 values are not a real CO2 measurement; they're an estimate made from VOCs. To monitor real CO2 in a classroom or meeting room you need an NDIR-type sensor. For a cheaper analog alternative with fiddly calibration, see the MQ135 article.
Project ideas
- Ventilation warning light: Turn an RGB LED yellow when IAQ passes 150 and red above 200; ideal for a study room or classroom.
- ESP32 indoor weather station: Show IAQ, temperature and humidity on an OLED display and send the values to a dashboard over Wi-Fi.
- Kitchen and bathroom fan: Switch an extractor fan on with a relay when the gas resistance drops quickly or humidity passes 70%.
- Battery sensor node: Take a reading every five minutes in BSEC2's ULP mode and put the ESP32 into deep sleep in between.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| BME680 not found | Wrong address or SDA/SCL swapped | Find the address with an I2C scanner, try 0x76 and 0x77 |
| Gas resistance is 0 or never changes | Heater not configured or invalid measurement | Add the setGasHeater(320, 150) line and warm the sensor for 30 min |
| IAQ always 50, accuracy 0 | BSEC2 still in its run-in phase | Wait a few hours and expose it once to clean and polluted air |
| Temperature 2–3 °C too high | Self-heating or board heat | Use BSEC2's heat-compensated output and move the sensor away from the board |
| bsec2 doesn't compile on the Uno | No BSEC2 binary for AVR | Use an ESP32 for IAQ and read raw values on the Uno |
| Calibration resets on every restart | State isn't being saved | Save it to NVS with getState and load it at boot with setState |
The BME680 lets you monitor both the climate and the air quality with a single I2C module; you can start with raw readings on the Uno and get to a real IAQ display with an ESP32 and BSEC2. In the BlueGrays app you'll find DHT11 and DHT22 temperature-humidity, MQ gas sensor alarm, OLED weather display and ESP32 temperature logger projects with step-by-step circuit diagrams and ready code; swap their sensor for a BME680 to build your own air quality station.
Frequently asked questions
What does the BME680 measure?
The BME680 measures temperature, relative humidity, air pressure and a gas resistance that reacts to volatile organic compounds (VOCs) in the air. The gas resistance alone doesn't give ppm; Bosch's BSEC2 library turns it into an IAQ index from 0 to 500, an equivalent CO2 and a breath VOC value. Approximate altitude can also be calculated from the pressure.
Does the BME680 measure CO2?
No, it doesn't measure real CO2. The eCO2 value from BSEC2 is an estimate based on the amount of VOCs and roughly follows CO2 in occupied rooms. For a real CO2 measurement you need an NDIR or photoacoustic sensor such as the MH-Z19 or SCD40.
How do you interpret the BME680 IAQ value?
On Bosch's scale, 0–50 is excellent, 51–100 good, 101–150 lightly polluted, 151–200 moderately polluted, 201–250 heavily polluted, 251–350 severely polluted and 351 or more extremely polluted air. Only trust the value once accuracy is 3. Because IAQ is scaled to the sensor's own history, following the change is more meaningful than the absolute number.
Does the BME680 work with an Arduino Uno?
Yes, with the Adafruit BME680 library you can read temperature, humidity, pressure and the raw gas resistance on the Uno. However, Bosch's BSEC2 library doesn't support the 8-bit AVR, so the IAQ index can't be calculated on the Uno. For IAQ you should use an ESP32, ESP8266 or an ARM-based board.
What is the difference between the BME680 and BME688?
The BME688 is the pin-compatible successor of the BME680 and makes the same temperature, humidity, pressure and gas measurements. The difference is that it can quickly scan the gas sensor at different temperatures and use AI to tell specific gas mixtures apart. If you only want IAQ, the BME680 is enough; BSEC2 supports both.
How long does the BME680 need to warm up?
A new sensor should run continuously for 24–48 hours on first use, then warm up for about 30 minutes after every power-on. During that time the gas resistance slowly rises and settles. If you use BSEC2, waiting for the accuracy value to reach 3 is the safest indicator.
Projects to build after reading this
See all projects
Temperature and Humidity with DHT11
How warm is your room, and is the air humid or dry? The DHT11 sensor measures temperature and humidity, and the Arduino writes the values on a two-line LCD screen, refreshing every couple of seconds.

ESP32 DHT22 Temperature and Humidity (with LCD Display)
This project measures ambient temperature and humidity using a DHT22 sensor and displays the data in real time on a 16x2 I2C LCD. Data is read from the sensor using the one-wire protocol via the Adafruit DHT library. This project serves as the foundation for IoT weather stations, smart home automation, or environmental monitoring systems in greenhouses. Communication with the DHT22 is established via the ESP32's GPIO 4 pin.

ESP32 MQ-2 Gas/Smoke Detector Alarm
In this project, combustible gas (LPG, methane, propane) and smoke detection is performed using an MQ-2 gas sensor module, and a siren-like alarm is played through a passive buzzer upon detection. The sensor's digital threshold output (DO) is connected to GPIO 4 on the ESP32; when gas or smoke exceeds the threshold, DO goes LOW and the alarm is triggered. Sensitivity is adjusted via the module's potentiometer. The passive buzzer is driven using tone() to produce a two-frequency siren effect.

Using a Gas Sensor
A little guard that notices a gas leak in the kitchen before you do. The gas sensor keeps sniffing the air; while everything is fine the green LED stays on, and when the gas in the air passes a…

Dot Matrix Clock, Calendar and Weather Station (MAX7219, DS1307)
A scrolling-text board for your desk or wall that shows the time, the date and the room's weather in turn.

ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)
In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. Unlike the I2C LCD version, it uses an SSD1306 OLED (128×64) display, with large text and vector icons for a richer look. Seven weather icons (sunny, rainy, snowy and more) are drawn on the fly, with no bitmap files.

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.

ESP32 I2C LCD Display (16x2)
In this project we connect a 16x2 character LCD to the ESP32 over I2C and display text. With I2C, just 2 data pins (SDA and SCL) control the screen, instead of the 6+ pins a classic parallel connection wastes. The code prints a fixed message on the first line and a counter that goes up every second on the second. At startup an I2C scanner also prints the display's address to the Serial Monitor (usually 0x27 or 0x3F).
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 750+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

