Board and part

Arduino Nano BME280 Simulator: Wiring, Code and a Live Circuit

This is a BME280 temperature, humidity and pressure sensor wired to an Arduino Nano over I2C, read live with the Adafruit BME280 library once a second.

  • 5 V logic
  • Library: Adafruit_BME280.h
  • I2C address 0x76
  • SDA A4, SCL A5
Arduino Nano · BME280live0.000 s 0.00x
Click to open it in the editor
The circuit itself, running on the simulator with the sketch below. Press what can be pressed; click anything else to open it in the editor.
Connections

Wiring the BME280 to the Arduino Nano

Four wires: 3.3 V, GND, SDA to pin A4 and SCL to pin A5. In the editor, drag the sensor’s temperature, humidity and pressure sliders and the next reading follows.

Every connection in the circuit above, with the board’s own pin names.

BME280 pinArduino Nano pinWhy
VIN3.3VThe BME280 chip is a 3.3 V part; many breakouts have no regulator.
GNDGNDCommon ground.
SCLpin A5I2C clock.
SDApin A4I2C data.

Power

The Nano has the Uno’s chip, so I2C is A4 (SDA) and A5 (SCL), on the analog side of the board next to A6 and A7. The common purple BME280 breakout has no regulator, so it runs from the Arduino Nano’s 3.3V pin, not 5V.

Pins to leave alone on the Arduino Nano

A6 and A7 are analog only: pinMode(A6, OUTPUT) does nothing and digitalRead(A7) is not there to call. D0 and D1 are the USB serial port.

On a real bench

The Nano plugs into the breadboard itself, straddling the center channel, so the BME280 goes in a few columns along and every connection is a short jumper. The silkscreen labels its pins D2 to D13 and A0 to A7; in code D2 is simply 2. A Nano clone with a CH340 USB chip needs that driver on a real computer.

The sketch

The code, and what it does.

The sketch the circuit above runs. Open it in the editor, change a line and press Run: it compiles in your browser.

BME280 on Arduino Nano I2C
#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);
}

bme.begin(0x76) reads the chip’s ID and its factory calibration. It returns false when nothing answers at that address. Adafruit’s own board is at 0x77 and begin() with no argument tries that one; most purple modules are at 0x76.

readTemperature() is degrees Celsius, readHumidity() is percent relative humidity and readPressure() is pascals, so dividing by 100 gives hectopascals. All three come from one chip, which is the difference from a BMP280: it adds the humidity.

Serial.begin(9600) opens the serial monitor. Serial is the USB port, as on the Uno; a clone with a CH340 chip needs that driver on a real computer, which the simulator does not.

Pitfalls

Common mistakes with the BME280 on the Arduino Nano

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 Nano’s 3.3V pin, as in the circuit above.

FAQ

Questions and answers

Can I simulate a BME280 with an Arduino Nano?

Yes. The circuit at the top of this page is an Arduino Nano with a BME280, running in your browser on a simulated ATmega328P. The temperature, humidity and pressure sliders set what the simulated chip measures, and the library applies the real calibration math to it. Press Run it in the editor to change the wiring or the code; it is free and needs no account.

Where does the BME280 connect on the Arduino Nano?

The Nano has the Uno’s chip, so I2C is A4 (SDA) and A5 (SCL), on the analog side of the board next to A6 and A7.

What is the difference between the BME280 and the BMP280?

The BME280 adds a humidity sensor. The two use different libraries and report different chip IDs.

Why does it read a little warm?

On a real board the chip’s own heat and the board around it warm the sensor, so the temperature reads a degree or two high. The simulated chip reports exactly what its slider says.

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.