BME280 sensor not working with Arduino Nano

Hello. I've just bought a BME280 sensor. The sensor works fine with Arduino Uno, but when I try using it on the Nano, it does not work.

I know that the sensor works, because it works on Uno. I have burned the bootloader to the Nano card, and the code is uploading and running on card. I've also tried other codes, and all of them works on my Nano card.

The wiring I've used on the Nano and Uno is identical, and I've used this diagram as a help:

Vcc --> 3V3
GND --> GND
SDI --> digital pin 11 (MOSI)
SCK --> digital pin 13 (SPI-clock)
CSB --> digital pin 10 (Chip select)
SDO --> digital pin 12 (MISO)

This is the code I'm running (Adafruit example code for BME280):

#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

//Adafruit_BME280 bme; // I2C
Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI

unsigned long delayTime;

void setup() {
  Serial.begin(9600);
  Serial.println(F("BME280 test"));

  bool status;
  
  // default settings
  // (you can also pass in a Wire library object like &Wire2)
  status = bme.begin();  
  if (!status) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
  
  Serial.println("-- Default Test --");
  delayTime = 1000;

  Serial.println();
}


void loop() { 
  printValues();
  delay(delayTime);
}


void printValues() {
  Serial.print("Temperature = ");
  Serial.print(bme.readTemperature());
  Serial.println(" *C");
  
  // Convert temperature to Fahrenheit
  /*Serial.print("Temperature = ");
  Serial.print(1.8 * bme.readTemperature() + 32);
  Serial.println(" *F");*/
  
  Serial.print("Pressure = ");
  Serial.print(bme.readPressure() / 100.0F);
  Serial.println(" hPa");
  
  Serial.print("Approx. Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");
  
  Serial.print("Humidity = ");
  Serial.print(bme.readHumidity());
  Serial.println(" %");
  
  Serial.println();
}

When I run the program it prints "Could not find a valid BME280 sensor, check wiring!"
Therefore, I have tried to wire the sensor differently, for example connecting SCK and SDI to analog pin 4 and 5. None of the wiring I've tried works. I have also checked that there is power going through the different cables.

This is frustrating. Does anyone have any clue and tips for what I should do?

Do you have the headers all soldered in?

It sounds like a hardware problem. They both have the same micro and the code is interchangeable. Re solder all your joints and be sure they are clean and shiny.

gilshultz:
It sounds like a hardware problem. They both have the same micro and the code is interchangeable. Re solder all your joints and be sure they are clean and shiny.

Ah, I see. I thought maybe that would be the answer, though I did check the currenct going trough. But I will of course try to re-solder the joints anyway.

Have you got the correct I2C address in your code, for the module

I think I used this to find mine, if I remember correctly

https://playground.arduino.cc/Main/I2cScanner/

Also, try this. This works well

http://cactus.io/hookups/sensors/barometric/bme280/hookup-arduino-to-bme280-barometric-pressure-sensor

I'm sure there's a sketch to scan to see if you have a bme280 or a bmp280 but I can't currently find it

Hello,
I've just started with Arduino Nano Every and loaded and tested a project previously working on a Uno R3.
I'm using a BME280 I2C with Adafruit library 2.1 and cannot read the data from the BME280.
I've installed an older version of the same library and seen that I can read data when using older versions, 1.1.0 and older.
I can't read data with 2.x.x versions.
(On the same I2C bus I've connected a Rtc DS3231 and a Hex display and they're working fine)

#include <PID_v1.h>
#include <EEPROM.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_BME280.h>
#include "RTClib.h" //RTCLIB BY ADAFRUIT LIBRARY

Please, post the picture (both sides) of your BME280 Module.

Here is the link of the module I've purchased, hope you can view it

(I've to use older library version only on Nano EVERY, was working fine with last library version on UNO R3)

The nano every uses a different processor to the UNO or the Nano.

Is this a thread hi jack ? Are we saying nano or nano every ?

hammy:
Is this a thread hi jack ?

Seems so indeed... Hence lots of confusion!

The new Adafruit BME280 library requires the Adafruit unified sensor library as well, the BME_280 library alone won't work. Include both libraries and see if that helps.