ArduinoGeneral

Problems with the BMP280 Barometer Sensor on the Micro:bit

userHead seanvernall 2018-07-26 02:44:23 3934 Views2 Replies
Okay so I'm trying to run the Gravity: I2C BMP280 Barometer Sensor (SKU: SEN0226) from a BBC Micro:bit via the I2C connector on the Micro:bit Driver Expansion Board (SKU:DFR0548). I'm using the Javascript/Blocks on the Makecode IDE and have found the following library:

https://github.com/microbit-makecode-packages/BMP280

This library works well with other boards using the BMP280, but for some reason both temperature and pressure are returning a value of 0. Here is the code:
Code: Select all
let temp = 0
let pres = 0
input.onButtonPressed(Button.A, () => {
    pres = BMP280.pressure()
    temp = BMP280.temperature()
    OLED.showString("Pressure : " + pres)
    OLED.showString("Temperature : " + temp)
})
OLED.init(64, 128)
OLED.showString("ready...")

If I can get it working this will form part of a robotics project I'll be running for my year 8 computer science students in the autumn, so any help would be greatly appreciated.
2018-08-03 22:10:19 Nope I have checked the wiring and it is correct. I also wondered if it was a problem with voltage, so I have just connected it to another breakout board that can deliver 5v to pins 19 and 20. The sensor is still only returning a value of 0 for both temp and pressure. userHeadPic seanvernall
2018-08-01 16:16:49 Have you check the wiring is right first, the library is fit for both Microbit and BMP280 sensor, it should be good to use. userHeadPic robert.chen