Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.

BME280 & BME680 Environmental Sensors: Complete Tutorial for Arduino & ESP32

If you’ve ever tried building a weather station or environmental monitoring system, you’ve likely encountered Bosch’s environmental sensor lineup. After designing dozens of IoT devices using these sensors, I can confidently say the BME 280 and BME 680 have become the go-to choices for accurate temperature, humidity, and pressure measurements. This tutorial covers everything you need to know to get these sensors working in your projects.

Understanding Environmental Sensors from Bosch

Bosch Sensortec has established itself as the leader in compact environmental sensing. Their sensor family evolved from the BMP085 and BMP180 pressure-only sensors to the feature-packed BME series we have today. Both the BME 280 and BME 680 pack multiple sensing elements into remarkably small packages, making them perfect for space-constrained applications.

What sets these sensors apart from alternatives like the DHT11 or DHT22 is their integration, accuracy, and digital interface. Rather than dealing with analog signals or proprietary one-wire protocols, you get clean I2C or SPI communication with factory-calibrated sensors that deliver consistent results.

Adafruit BME280: The Essential Temperature Humidity Sensor

The Adafruit BME280 breakout board packages Bosch’s precision environmental sensor into a maker-friendly format. This 3-in-1 sensor measures temperature, barometric pressure, and relative humidity simultaneously—everything you need for a complete weather monitoring solution.

BME280 Technical Specifications

ParameterSpecification
Temperature Range-40°C to +85°C
Temperature Accuracy±1.0°C (0 to 65°C)
Humidity Range0% to 100% RH
Humidity Accuracy±3% RH
Pressure Range300 to 1100 hPa
Pressure Accuracy±1 hPa absolute
Altitude Accuracy±1 meter
Operating Voltage1.71V to 3.6V (chip), 3-5V (breakout)
Current Consumption<1mA during measurement, 5µA idle
CommunicationI2C (up to 3.4MHz), SPI (up to 10MHz)
I2C Addresses0x77 (default), 0x76 (SDO to GND)

Why Choose the BME280?

The BME 280 hits a sweet spot between capability and cost. For standard weather station applications, it provides everything you need without the complexity or expense of more advanced sensors. The pressure measurements are precise enough to calculate altitude with roughly 1-meter accuracy—useful for drones, GPS enhancement, and indoor navigation systems.

One thing worth noting: the BME280 exhibits some self-heating during operation, which can cause temperature readings to run 2-3°C higher than actual ambient temperature. For critical applications, either compensate in software or use forced mode sampling to minimize heat buildup.

Adafruit BME680: The 4-in-1 Air Quality Sensor

The Adafruit BME680 takes environmental sensing to the next level by adding a gas sensor to the temperature, humidity, and pressure measurements. This fourth sensing element detects Volatile Organic Compounds (VOCs), making the BME 680 capable of indoor air quality monitoring.

BME680 Technical Specifications

ParameterSpecification
Temperature Range-40°C to +85°C
Temperature Accuracy±0.5°C to ±1.0°C
Humidity Range0% to 100% RH
Humidity Accuracy±3% RH
Pressure Range300 to 1100 hPa
Pressure Accuracy±1 hPa absolute
Gas SensorMOX-based VOC detection
Gas Sensor OutputResistance value (Ohms)
Operating Voltage1.71V to 3.6V (chip), 3-5V (breakout)
Current Consumption0.15µA sleep, up to 12mA with gas sensor active
CommunicationI2C, SPI
I2C Addresses0x77 (default), 0x76 (SDO to GND)

Understanding the Gas Sensor

The BME 680’s Metal-Oxide (MOX) gas sensor deserves special explanation. When heated, the metal oxide layer changes resistance based on the concentration of VOCs in the surrounding air. This allows detection of gases like ethanol, alcohol, acetone, and carbon monoxide—common indoor pollutants from cleaning products, paints, adhesives, and office equipment.

However, the gas sensor has important limitations. It provides a single resistance value representing total VOC content—it cannot identify specific gases or distinguish between different compounds. The sensor requires a warm-up period of 5-20 minutes for stable readings, and the resistance values need interpretation through Bosch’s proprietary BSEC library to convert to an Indoor Air Quality (IAQ) index.

BME280 vs BME680: Choosing the Right Sensor

FeatureBME280BME680
Temperature
Humidity
Pressure
Gas/VOC Sensing
Power ConsumptionLowerHigher (with gas)
Warm-up TimeMinimal5-20 minutes for gas
PriceLowerHigher
ComplexitySimpleMore complex
Best ForWeather stationsAir quality monitoring

Choose BME280 when: You need basic environmental monitoring for weather stations, HVAC control, or altitude tracking. The simpler sensor draws less power and costs less while delivering the same accuracy for temperature, humidity, and pressure.

Choose BME680 when: Indoor air quality matters for your application. Smart home systems, office environmental monitors, and health-focused devices benefit from VOC detection capabilities.

Wiring the BME280 and BME680 to Arduino

Both sensors share identical pinouts and wiring requirements, making it easy to swap between them if needed.

I2C Wiring (Recommended)

Sensor PinArduino UNOArduino MegaESP32
VIN5V5V3.3V
GNDGNDGNDGND
SCL/SCKA521GPIO 22
SDA/SDIA420GPIO 21

The Adafruit breakout boards include onboard voltage regulators and level shifters, so you can safely connect to 5V Arduino boards or 3.3V ESP32 boards without additional components.

SPI Wiring (Higher Speed)

Sensor PinArduino UNONotes
VIN5VPower supply
GNDGNDCommon ground
SCKD13SPI clock
SDO/MISOD12Data from sensor
SDI/MOSID11Data to sensor
CSD10Chip select

SPI offers faster data transfer (up to 10MHz vs 3.4MHz for I2C) and avoids I2C address conflicts when using multiple sensors. However, it requires more wiring and dedicated pins.

Changing the I2C Address

Both sensors default to I2C address 0x77. To use address 0x76 instead (useful when combining with other 0x77 devices), connect the SDO pin to GND. On Adafruit boards, you can simply solder the ADDR jumper on the back of the PCB.

Installing the Adafruit BME280 Library

Getting the software side working requires installing Adafruit’s libraries through the Arduino IDE.

Step 1: Open Arduino IDE and navigate to Sketch → Include Library → Manage Libraries.

Step 2: Search for “Adafruit BME280” and click Install.

Step 3: When prompted, also install the dependencies, particularly “Adafruit Unified Sensor.”

Step 4: For BME680 projects, search for and install “Adafruit BME680” instead.

Basic BME280 Arduino Code Example

cpp

#include <Wire.h>#include <Adafruit_Sensor.h>#include <Adafruit_BME280.h>#define SEALEVELPRESSURE_HPA (1013.25)Adafruit_BME280 bme;void setup() {  Serial.begin(115200);    if (!bme.begin(0x77)) {    Serial.println(“Could not find BME280 sensor!”);    while (1);  }    Serial.println(“BME280 sensor found!”);}void loop() {  Serial.print(“Temperature: “);  Serial.print(bme.readTemperature());  Serial.println(” °C”);    Serial.print(“Humidity: “);  Serial.print(bme.readHumidity());  Serial.println(” %”);    Serial.print(“Pressure: “);  Serial.print(bme.readPressure() / 100.0F);  Serial.println(” hPa”);    Serial.print(“Altitude: “);  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));  Serial.println(” m”);    Serial.println();  delay(2000);}

For more accurate altitude readings, replace SEALEVELPRESSURE_HPA with the current sea level pressure for your location, available from local weather services.

Basic BME680 Arduino Code Example

cpp

#include <Wire.h>#include <Adafruit_Sensor.h>#include <Adafruit_BME680.h>#define SEALEVELPRESSURE_HPA (1013.25)Adafruit_BME680 bme;void setup() {  Serial.begin(115200);    if (!bme.begin()) {    Serial.println(“Could not find BME680 sensor!”);    while (1);  }    // Configure gas sensor heater  bme.setTemperatureOversampling(BME680_OS_8X);  bme.setHumidityOversampling(BME680_OS_2X);  bme.setPressureOversampling(BME680_OS_4X);  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);  bme.setGasHeater(320, 150); // 320°C for 150ms    Serial.println(“BME680 sensor found!”);}void loop() {  if (!bme.performReading()) {    Serial.println(“Failed to read sensor!”);    return;  }    Serial.print(“Temperature: “);  Serial.print(bme.temperature);  Serial.println(” °C”);    Serial.print(“Humidity: “);  Serial.print(bme.humidity);  Serial.println(” %”);    Serial.print(“Pressure: “);  Serial.print(bme.pressure / 100.0);  Serial.println(” hPa”);    Serial.print(“Gas Resistance: “);  Serial.print(bme.gas_resistance);  Serial.println(” Ohms”);    Serial.print(“Altitude: “);  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));  Serial.println(” m”);    Serial.println();  delay(2000);}

The gas resistance value requires interpretation—higher resistance generally indicates cleaner air, while lower resistance suggests higher VOC concentrations.

Practical Applications for Environmental Sensors

Home Weather Stations

Both sensors excel at weather monitoring. Combine with an ESP32 for WiFi connectivity and you can build a complete weather station that logs data to cloud services or displays on a web dashboard. The pressure readings enable weather prediction based on barometric trends.

Indoor Air Quality Monitoring

The BME 680 shines in IAQ applications. Deploy sensors throughout a home or office to monitor ventilation effectiveness, detect when rooms need airing out, or trigger HVAC systems when air quality drops.

Smart HVAC Control

Use temperature and humidity readings to intelligently control heating, cooling, and humidification systems. The fast response time and low power consumption make these sensors ideal for battery-powered wireless sensor nodes.

Altitude and Navigation

The precise pressure measurements enable altitude tracking for drones, hiking applications, and indoor navigation (floor detection in multi-story buildings). GPS systems can use barometric data to improve vertical positioning accuracy.

Wearable Devices

Both sensors’ tiny footprints and low power consumption suit wearable applications. Fitness trackers can count stairs climbed, smartwatches can display local conditions, and health monitors can track environmental factors affecting wellbeing.

Troubleshooting Common Problems

Sensor Not Detected

If your code returns “Could not find sensor,” check these common issues:

  1. Wiring connections — Verify SDA and SCL are connected to the correct pins
  2. I2C address — Try both 0x77 and 0x76 in your code
  3. Power supply — Ensure adequate voltage and current
  4. Pull-up resistors — Adafruit boards include these, but generic modules may not

Inaccurate Temperature Readings

The BME280 and BME680 both exhibit self-heating. For better accuracy:

  1. Use forced mode instead of continuous sampling
  2. Reduce oversampling settings
  3. Apply a software offset based on comparison with a reference thermometer
  4. Mount the sensor away from heat-generating components

Unstable Gas Readings (BME680)

Gas sensor readings require stabilization time:

  1. Allow 5-20 minutes warm-up before trusting readings
  2. Use the reading after warm-up as your baseline
  3. Monitor relative changes rather than absolute values
  4. Consider implementing Bosch’s BSEC library for IAQ calculations

I2C Communication Failures

If you experience intermittent communication:

  1. Keep I2C wires short (under 30cm for reliable operation)
  2. Add external pull-up resistors if using long cables
  3. Reduce I2C clock speed in software
  4. Shield cables from electrical noise sources

Resources and Downloads

Official Documentation

Software Libraries

Community Resources

Frequently Asked Questions

Can I use BME280 and BME680 on the same I2C bus?

Yes, as long as they have different I2C addresses. Set one sensor to 0x77 (default) and the other to 0x76 (by connecting SDO to GND). This allows simultaneous operation on the same I2C bus with no conflicts.

How accurate is the altitude measurement?

Under optimal conditions with correct sea level pressure calibration, both sensors achieve approximately ±1 meter altitude accuracy. However, atmospheric pressure changes throughout the day, so altitude readings will drift without periodic recalibration. For relative altitude changes (like counting floors), accuracy improves significantly.

Does the BME680 replace dedicated air quality sensors like the CCS811?

The BME680 provides VOC detection but outputs raw resistance values rather than calibrated CO2 equivalent or TVOC readings that dedicated sensors provide. For serious air quality monitoring, the BME680 works best with Bosch’s BSEC library, which calculates an Indoor Air Quality (IAQ) index from 0-500. Dedicated sensors may still be preferable for regulatory compliance or specific gas detection.

Why do my temperature readings seem too high?

Both sensors experience self-heating during operation, causing readings 2-3°C above actual ambient temperature. To minimize this effect, use forced mode sampling (taking readings on demand rather than continuously), reduce oversampling settings, and ensure adequate airflow around the sensor. Some users apply a fixed offset correction based on comparison with a calibrated reference thermometer.

Can these sensors work outdoors?

The sensors themselves can operate in the full -40°C to +85°C range, but the breakout boards and exposed components need protection from moisture. For outdoor deployment, house the sensor in a weatherproof enclosure with adequate ventilation for accurate readings. The BME680’s gas sensor is particularly sensitive to moisture and should be protected from direct water exposure.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.

  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.

Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.