How to wire a BME280 to an Arduino Uno
To wire a BME280 to an Arduino Uno, connect VIN to 3.3V, GND to GND, SCL to pin A5 and SDA to pin A4. The common breakout has no regulator, so power it from 3.3 V, not 5 V; its pull-ups then go to 3.3 V, which the board reads as high. The sketch below uses the Adafruit BME280 (Adafruit_BME280.h) library. It prints the temperature, the humidity and the pressure.
- 5 V logic
- Library: Adafruit_BME280.h
- 4 wires
BME280 to Arduino Uno wiring table
Every wire in the circuit above, with the part’s pin names and the board’s own labels. The wire colors are the ones the circuit uses; on a real bench any colors work.
| BME280 pin | Arduino Uno pin | Wire color | Why |
|---|---|---|---|
| VIN | 3.3V | red | The BME280 chip is a 3.3 V part; many breakouts have no regulator. |
| GND | GND | blue | Common ground. |
| SCL | pin A5 | cyan | I2C clock. |
| SDA | pin A4 | violet | I2C data. |
Power and logic levels for BME280 and Arduino Uno
Logic level
The Arduino Uno’s pins are 5 V logic. A 5 V part can drive them directly; a part whose signal pins are limited to 3.3 V needs a level shifter.
This pair
On an Uno the I2C bus is A4 (SDA) and A5 (SCL). The SDA and SCL pins beside AREF are the same two wires, so either pair works. The common purple BME280 breakout has no regulator, so it runs from the Arduino Uno’s 3.3V pin, not 5V.
Pins to leave alone
Pins 0 and 1 are the USB serial port on a real Uno, so anything wired there fights the upload and the serial monitor. Pin 13 carries the onboard LED.
The working code for the Arduino Uno
Library: Adafruit BME280 (Adafruit_BME280.h). This is the sketch the circuit above runs.
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
Adafruit_BME280 bme; // on I2C: SDA pin A4, SCL pin A5
void setup() {
Serial.begin(9600);
if (!bme.begin(0x76)) {
Serial.println("No BME280 at 0x76");
for (;;) {}
}
Serial.println("BME280 found");
}
void loop() {
Serial.print("Temperature: ");
Serial.print(bme.readTemperature(), 1);
Serial.print(" C Humidity: ");
Serial.print(bme.readHumidity(), 1);
Serial.print(" % Pressure: ");
Serial.print(bme.readPressure() / 100.0F, 1);
Serial.println(" hPa");
delay(1000);
}
What you should see
Open the serial monitor at 9600 baud. The sketch prints BME280 found and then a line with the temperature in degrees C, the humidity in percent and the pressure in hectopascals.
The BME280 is the BMP280 plus a humidity sensor; the two look alike, and a BMP280 sold as a BME280 reads no humidity.
The serial monitor prints this, recorded from the circuit above left at its defaults:
BME280 found
Temperature: 22.0 C Humidity: 50.0 % Pressure: 1013.3 hPaCommon mistakes wiring a BME280 to an Arduino Uno
The wrong address
Adafruit’s board answers at 0x77, the cheap purple ones at 0x76, and bme.begin() with no argument tries 0x77. If it fails, try the other address before suspecting the wiring.
Using a BMP280 library
A BMP280 has no humidity and a different chip ID (0x58 against 0x60). Adafruit_BMP280 refuses a BME280 and the reverse, so match the library to the chip printed on the module.
Powering a bare breakout from 5V
A module with no regulator sends 5V straight to a chip rated for 3.6 V. Use the Arduino Uno’s 3.3V pin, as in the circuit above.
Build your own BME280 project
Open this circuit in the editor, change the wiring or the code, and keep your version in a free account.