ADAFRUİT BMP280 SENSOR

Post here first, or if you can't find a relevant section!
Post Reply
engineer
Posts: 9
Joined: Tue Sep 07, 2021 4:15 pm

ADAFRUİT BMP280 SENSOR

Post by engineer »

hello i am programming stm32f1 using ide. I ran the mpu6050 sensor with no problems but the adafruit bmp280 sensor shows no value. I am using the bmp280test code inside the arduino. sck is connected to pin B7 and sdi is connected to pin B6 this is the code i use. The code compiles without errors. When I open the serial port, I can't see any text or value. where is the problem i can't find it please help

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

#define BMP_SCK (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS (10)

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);
Serial.println(F("BMP280 test"));

//if (!bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID)) {
if (!bmp.begin()) {
Serial.println(F("Could not find a valid BMP280 sensor, check wiring or "
"try a different address!"));
while (1) delay(10);
}

/* 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(2000);
}
by mrburnette » Tue Sep 07, 2021 7:02 pm
I will say first that I have not used the most recent Adafruit BMP library; however, I have used a bluepill with an earlier version of BMP without problems.

Maybe this will help:
https://thesolaruniverse.wordpress.com/ ... r-station/

-or-

https://hobbyprojects.home.blog/2019/06 ... %B5%D1%80/

Turn on Google Translate after accepting cookies.
Note: Some BME280 modules already have I2C pull-up resistors included (so should be checked first).

FYI: YouTube also hosts numerous BluePill projects.

Note: I2C Address 0x77 or 0x76
Go to full post
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: ADAFRUİT BMP280 SENSOR

Post by mrburnette »

I will say first that I have not used the most recent Adafruit BMP library; however, I have used a bluepill with an earlier version of BMP without problems.

Maybe this will help:
https://thesolaruniverse.wordpress.com/ ... r-station/

-or-

https://hobbyprojects.home.blog/2019/06 ... %B5%D1%80/

Turn on Google Translate after accepting cookies.
Note: Some BME280 modules already have I2C pull-up resistors included (so should be checked first).

FYI: YouTube also hosts numerous BluePill projects.

Note: I2C Address 0x77 or 0x76
engineer
Posts: 9
Joined: Tue Sep 07, 2021 4:15 pm

Re: ADAFRUİT BMP280 SENSOR

Post by engineer »

I tried the code in the link you gave, it didn't work again this time arduino -- libraries-- bme280 I changed the 0x76 to 0x77 in the C code and it worked thenk youuu
Post Reply

Return to “General discussion”