Trying To Get BMP280 To Work

Disclaimer: I'm an extreme noob.

I've been trying to get my BMP280 to measure temperature and pressure, and display it on the Serial Monitor. I've been using the example code from the BMP280 library, but just added a 'while(!Serial);' in the void.setup()

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>

//#define BMP_SCK  (7)
//#define BMP_MISO (5)
//#define BMP_MOSI (3)
//#define BMP_CS   (2)

Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println(F("BMP280 test"));
  status=bmp.begin();

  if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    while(1);
  }

  /* Default settings from datasheet. */
  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
}

void loop() {
    Serial.print(F("Temperature = "));
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");

    Serial.print(F("Pressure = "));
    Serial.print(bmp.readPressure());
    Serial.println(" Pa");

    Serial.print(F("Approx altitude = "));
    Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */
    Serial.println(" m");

    Serial.println();
    delay(1000);
}

When I run this code, the Serial Monitor displays the error message ("Could not find a valid BMP280 sensor, check wiring!")

I did the circuit using Adafruit's guide. Specifically, the VIN is connected to VCC (I've also tried connecting it to RAW), the GND is connected to GND, the SCK is connected to 3 and SDI is connected to 2. I tried both the I2C and SPI protocol (changing the code to match) but it didn't work.

I've tried changing the USB cable, the Pro Micro and the computer. I haven't tried changing the BMP280 itself because I don't have another one.

When I ran the I2C scanner, initially, it said the device was at 0x77 so I changed the i2c location in the BMP280 library. It still didn't work, so I tried other troubleshooting things like the changes listed above. Now, when I run the I2C scanner, it says that no I2C devices were found.

I'd be extremely grateful for any advice because I've been trying to get this to work for a while now and from what I understand this is supposed to be relatively straightforward.

Post a photo showing how things are connected together.
Try to get everything in focus so that the pin labels are visible.


Sorry, I couldn't really find an angle where everything was clear from. The black wire is for ground, the red wire is for VIN, the green wire is for SCK and the yellow wire is for SDI. The red wire goes into VCC and the yellow wire goes into digital 2.

It doesn't look like any of the the connections to your BMP280 or your Pro Micro are soldered. You had better take care of that detail before you try to go any further.

Don

How is the Arduino itself powered?

Using the Vin connection sounds like a recipe for disaster. If you use that to power your Arduino as well the voltage may simply be too high for the module's regulator, and if you use USB there's no voltage on Vin to begin with (as you can see with your multimeter as well).

Some solder will go a long way to make connections work as well.

The Arduino is powered by USB, sorry I didn't include it in the photo.

How do I power the BMP280 then if not with the VIN pin? My arduino's VCC outputs 5V and the only other power pin is the 3Vo, which I read somewhere can't be used with 5V output.

I'll try soldering once I get the equipment.

Use the 5V / Vcc pin for powering the sensor.

Before it's all soldered you're pretty much dead in the water. No use continuing until you have your soldering iron.