Giter Club home page Giter Club logo

adafruit_bmp3xx's Introduction

Adafruit_BMP3XX Build Status

This is a library for the Adafruit BMP388 precision pressure sensor breakout:

Check out the links above for our tutorials and wiring diagrams. This chip uses I2C to communicate.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. MIT license, all text above must be included in any redistribution.

adafruit_bmp3xx's People

Contributors

caternuson avatar evaherrada avatar jps2000 avatar ladyada avatar mjs513 avatar powerbroker2 avatar rrakso avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_bmp3xx's Issues

Can not specify wire1 on DUE.

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE
    DUE
  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

    1.8.4
  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW
    no matching function for call to 'Adafruit_BMP3XX::begin_I2C(uint8_t, TwoWire&)'
    In the sketch: bmp.begin_I2C((uint8_t)0x77,Wire1)
    But in the header file it is defined ass:

begin_I2C(uint8_t addr = BMP3XX_DEFAULT_ADDRESS,
TwoWire *theWire = &Wire);

using multiple device with SPI connection problem

I just found bug on this code
if we using multiple BMP388 with SPI
i found the reading on first initialized device is error

after i check the pointer for SPI is on global variable
Adafruit_SPIDevice *spi_dev = NULL; ///< Global SPI interface pointer

so i move this variable on local class variable

and change this 2 function
//
/*!
@brief Reads 8 bit values over SPI
*/
/
/
static int8_t spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len,
void *intf_ptr) {
((Adafruit_SPIDevice)intf_ptr)*->write_then_read(&reg_addr, 1, reg_data, len, 0xFF);
return 0;
}

//
/*!
@brief Writes 8 bit values over SPI
*/
/
/
static int8_t spi_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len,
void *intf_ptr) {
((Adafruit_SPIDevice)intf_ptr)*->write((uint8_t *)reg_data, len, &reg_addr, 1);

return 0;
}

it solve the issue

Thanks

Limited reading performance due to strange delay(40)

  • Arduino board: PyQT
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13

I am trying to read the pressure sensor at ~200Hz with some other sensors and set it as:

if (!bmp.begin_I2C()) {
        while (1){
            Serial.println("BMP3 NOT Found!");
            delay(1000);
        }
    }
    bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
    bmp.setOutputDataRate(BMP3_ODR_200_HZ);

However, when I execute bmp.performReading(), the performance is no where near ~200Hz unless I comment this read out. Looking at this function in github here, there is a delay(40) for some reason. This delay would limit the reading to no more than 25Hz ... why?

Wrong pressure reported when using a BMP388 and BMP390 at the same time

When attempting to run the simpletest for an Adafruit BMP390 and Adafruit BMP388 at the same time, the pressure reported back on one device will always be wrong. This was tested on one I2C bus with a BMP390 at 0x77 and a BMP388 at 0x76.

The same issue occurs when attempting to run this across two different I2C buses as well. The bug appears to affect whichever sensor is started second, which becomes the erroneous pressure sensor. If either pressure sensor is run by itself, the correct pressure is always reported.

These were the Serial results are from a Teensy 4.1 compiled in Arduino 1.8.13, however it should replicate on any Arduino.

Example Output:
BMP388 Sensor #1 using &Wire  0x76 
Temperature = 26.56 *C
Pressure = 1012.74 hPa
Approx. Altitude = 3.88 m

BMP390 Sensor #2  using &Wire1 0x77
Temperature = 27.25 *C
Pressure = 958.15 hPa   <===========[WRONG PRESSURE REPORTED]
Approx. Altitude = 468.74 m
Example Output if starting of sensors order is reversed:
BMP388 Sensor #1 &Wire 0x76
Temperature = 25.97 *C
Pressure = 1109.57 hPa   <===========[WRONG PRESSURE REPORTED]
Approx. Altitude = -772.71 m

BMP390 Sensor #2 using &Wire1 0x77 
Temperature = 26.65 *C
Pressure = 1012.26 hPa
Approx. Altitude = 8.30 m

bmp3xx_simpletest example code to replicate the issue:

 /*   Written by Limor Fried & Kevin Townsend for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
modified to attempt collection from a BMP388 and BMP390 at the same time
 ***************************************************************************/

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BMP3XX.h"

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BMP3XX bmp;
Adafruit_BMP3XX bmp2;

void setup() {
  Wire.setSCL(19);
  Wire.setSDA(18);
  Wire.begin();
    
  Wire1.setSCL(16);
  Wire1.setSDA(17);
  Wire1.begin();
    
  Serial.begin(115200);
  while (!Serial);
  Serial.println("Adafruit BMP388 / BMP390 test");

  if (!bmp.begin_I2C(0x76, &Wire)) {   // hardware I2C mode, can pass in address & alt Wire
    Serial.println("Could not find a valid BMP3 sensor, check wiring!");
    while (1);
  }
  if (!bmp2.begin_I2C(0x77, &Wire1)) {   // hardware I2C mode, can pass in address & alt Wire
    Serial.println("Could not find a valid BMP3 sensor, check wiring!");
    while (1);
  }
  
  // Set up oversampling and filter initialization
  bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
  bmp.setPressureOversampling(BMP3_OVERSAMPLING_4X);
  bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
  bmp.setOutputDataRate(BMP3_ODR_50_HZ);

  // Set up oversampling and filter initialization
  bmp2.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);
  bmp2.setPressureOversampling(BMP3_OVERSAMPLING_4X);
  bmp2.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
  bmp2.setOutputDataRate(BMP3_ODR_50_HZ);
}

void loop() {
  if (! bmp.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
  }
  Serial.println("BMP388 Sensor #1 using &Wire 0x76");
  Serial.print("Temperature = ");
  Serial.print(bmp.temperature);
  Serial.println(" *C");

  Serial.print("Pressure = ");
  Serial.print(bmp.pressure / 100.0);
  Serial.println(" hPa");

  Serial.print("Approx. Altitude = ");
  Serial.print(bmp.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");

  Serial.println();

  if (! bmp2.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
  }
  Serial.println("BMP390 Sensor #2 using &Wire1 0x77 ");
  Serial.print("Temperature = ");
  Serial.print(bmp2.temperature);
  Serial.println(" *C");

  Serial.print("Pressure = ");
  Serial.print(bmp2.pressure / 100.0);
  Serial.println(" hPa");

  Serial.print("Approx. Altitude = ");
  Serial.print(bmp2.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");
  Serial.println();
  
  delay(2000);
}

Pressure offset of around 7-8 mbar

I have been using a BMP388 sensor to track the outdoor pressure. While doing that I have noticed that the sensor data is around 7-8 mbar lower compared to my local wheater station (see below).
As this offset is rather constant and cannot be explained by minor difference in altitudes or temperature I think that either the default temperature compensation of this library needs some tweaking or I am not using the settings properly. Of course I am open to other ideas/reasons that might explain the offset. Here are my settings:

  bmp.setTemperatureOversampling(BMP3_OVERSAMPLING_8X);  
  bmp.setPressureOversampling(BMP3_OVERSAMPLING_8X);
  bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_DISABLE);
  bmp.setOutputDataRate(BMP3_ODR_12_5_HZ);

Apparently I am not only observing this: https://forum.arduino.cc/t/bmp388-pressure-sensor-is-giving-wrong-values/680641
In this forum thread a user also reported a delta of 7 mbar.

measured_data_stretched
wheater_station

Not an issue but a question

Hi,

I'm trying to use this lib with an BMP384. During the _init() function I got an error when the lib try to validate_trimming_param I've tried to debug and the issue is in this line if (stored_crc != crc) { the sotred_crc is nerver egal to crc. I've tried to understand how to calculate crc etc but I didn't find any useful informaiton in the datasheet, however calibration data registers between BMP384 and BMP388 and addresses are the same.

Operation mode

@ladyada
Normal mode improves significantly performance in particular at higher IIR filter settings
This mode is recommended in the data sheet chapter 3.3.3 for using IIR filters.

--> Suggest change line 166 in the .cpp to
the_sensor.settings.op_mode = BMP3_NORMAL_MODE;

See https://forums.adafruit.com/viewtopic.php?f=19&t=154178

also other examples use that mode (dfrobot)

Thank you

Limited reading performance due to strange `delay(40)` in code

  • Arduino board: PyQT
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13

Thanks for all you do, you really do make great hardware/software!

I am trying to read the pressure sensor at ~200Hz with some other sensors and set it as:

if (!bmp.begin_I2C()) {
        while (1){
            Serial.println("BMP3 NOT Found!");
            delay(1000);
        }
    }
    bmp.setIIRFilterCoeff(BMP3_IIR_FILTER_COEFF_3);
    bmp.setOutputDataRate(BMP3_ODR_200_HZ);

However, when I execute bmp.performReading(), the performance is no where near ~200Hz unless I comment this performRead out. Looking at this function in github here, there is a delay(40) for some reason. This delay would limit the reading to no more than 25Hz ... why? The sensor is capable of faster performance, not sure why you are hamstringing it like this ... maybe there is a more efficient way to do this?

Thanks again!

Wrong readings on arduino-esp32 2.0.1 RC1

After updating ESP32 libraries (https://github.com/espressif/arduino-esp32) to 2.0.1 RC1 version I've noticed that readings from BMP388 are wrong.

Before the update (on 2.0.0 version) the readings are:
22.40 *C
1003.20 hPa

And after update the readings are:
23.93 *C
795.16 hPa

I haven't found what is causing that issue, but I'll try to investigate it further. However, I found one thing that may cause it:
temperature and pressure variables are double, but functions that return them have float type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.