Report
2 weeks, 2 days ago.

BMP280 Library for SPI

Hi there,

I have a problem connecting Adafruit BMP280 pressure sensor to Nucleo F401RE via SPI. I did that successfully using Arduino ADK because I found a library for that.

Is there any similar library on mbed or an example code for that?

Thanks

Comment on this question

2 Answers

2 weeks, 1 day ago.

I found one, but never tried. Have you tried the search function?

https://developer.mbed.org/search/?q=BMP280

Thank you very much, I tried this one before and found I2C library not SPI.. The one I need id SPI

posted by mhd eid 10 Mar 2017

Oh, sorry. I missed that part of your question.

posted by Mark Peter Vargha 10 Mar 2017
1 week, 5 days ago.

Hi,

I created an SPI version library and example code here.

https://developer.mbed.org/users/MACRUM/code/BME280_SPI_Hello/

Thank you so much, I highly appreciate your reply.. I used it with BMP280 and BME280 but I got the same result which is constant values:

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

51.20 degC, 500.04 hPa, 0.00 %

I tried to apply variable pressure and temperature but the values still constant.. And for sure the sensors are working properly because I tested them on Arduino..

Did you try this library before?

Regards

posted by mhd eid 13 Mar 2017

Quote:

Did you try this library before?

Yes, I used this library with Switch Science BME280 breakout. https://international.switch-science.com/catalog/2236/

mbed LPC1768 pinSSCI BME280 breakout pin
1 (GND)5 (GND)
40 (VOUT)6, 7 (Vcore, Vio)
p5 (mosi)3 (SDI)
p6 (miso)1 (SDO)
p7 (sclk)2 (SCK)
p84 (CSB)
posted by Toyomasa Watarai 14 Mar 2017

Hi, I just quick checked it with Nucleo F401RE and it worked fine.

NUCLEO F401RE pinSSCI BME280 breakout pin
GND5 (GND)
3V36, 7 (Vcore, Vio)
D4 (mosi)3 (SDI)
D5 (miso)1 (SDO)
D3 (sclk)2 (SCK)
D74 (CSB)

BME280_SPI sensor(D4, D5, D3, D7); // mosi, miso, sclk, cs
24.71 degC, 1001.36 hPa, 41.59 %
24.70 degC, 1001.36 hPa, 41.57 %
24.68 degC, 1001.37 hPa, 41.56 %
24.65 degC, 1001.37 hPa, 41.53 %
24.64 degC, 1001.34 hPa, 41.54 %
24.63 degC, 1001.29 hPa, 41.56 %
24.62 degC, 1001.26 hPa, 41.59 %
24.60 degC, 1001.33 hPa, 41.60 %
24.60 degC, 1001.30 hPa, 41.60 %
24.57 degC, 1001.35 hPa, 41.61 %
24.56 degC, 1001.36 hPa, 41.63 %
posted by Toyomasa Watarai 14 Mar 2017

I now noticed that you are using BMP280, not BME280. My BME280 library may not work with BMP280.

posted by Toyomasa Watarai 14 Mar 2017

To post an answer, please log in.