finitespace / bme280 Goto Github PK
View Code? Open in Web Editor NEWProvides an Arduino library for reading and interpreting Bosch BME280 data over I2C, SPI or Sw SPI.
License: GNU General Public License v3.0
Provides an Arduino library for reading and interpreting Bosch BME280 data over I2C, SPI or Sw SPI.
License: GNU General Public License v3.0
jestani- MySQL database does not fill up the data from the sensor. I checked everything. Home chart.html has the same name without charts. :(.... any suggestions?
Jack
Attempting to compile BME280 I2C Test.ino and receiving error message.
Version 1.0.0 works fine but the IDE keeps nagging me to update to the latest 2.1.0 version. This is what happens with 2.1.0:
Arduino: 1.6.13 (Windows 10), Board: "WeMos D1 R2 & mini, 80 MHz, 115200, 4M (3M SPIFFS)"
Build options changed, rebuilding all
C:\Users\Karl\OneDrive\Arduino\libraries\BME280\src\BME280SpiSw.cpp:36:29: fatal error: Adafruit_BMP280.h: No such file or directory
#include <Adafruit_BMP280.h>
^
compilation terminated.
exit status 1
Error compiling for board WeMos D1 R2 & mini.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Arduino compiles all of the code in the src file** compiling our brzo and spi code. Arduino compiles files separately and #defines
do not transfer across files. Therefore, a #ifdef
cannot be used to surround the BME BRZO code. The result, all of the example builds fail if the BRZO code is not surrounded in a pre-processor macro. Likewise, this has caused issues in past I2C builds where #define <SPI.h>
was required to build.
Current implementation requires user intervention in library files by modifying BME280I2C_BRZO.cpp::line 35: #define USING_BRZO 1
.
**(TODO: check if src folder structure mitigates)
Hi,
I'm an avg user, so this could be something I'm doing. But here's what's happening.
If you have a chance, sure could use to know if this is something I did/didn't do, something wrong with my setup, etc. Other sketches work fine i.e Sparkfun, Adafruit, etc. Wanted to try yours considering the functions you created.
Thanks,
Steve
Arduino: 1.8.0 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"
C:\Users\Steve\Documents\Arduino\libraries\BME280\examples\BME280_Modes\BME280_Modes.ino: In function 'void printBME280Data(Stream*)':
BME280_Modes:96: error: no matching function for call to 'BME280I2C::ReadData(float&, float&, float&, uint8_t&, bool&)'
bme.ReadData(pres, temp, hum, pressureUnit, metric); // Parameters: (float& pressure, float& temp, float& humidity, bool hPa = true, bool celsius = false)
^
C:\Users\Steve\Documents\Arduino\libraries\BME280\examples\BME280_Modes\BME280_Modes.ino:96:53: note: candidate is:
In file included from C:\Users\Steve\Documents\Arduino\libraries\BME280\examples\BME280_Modes\BME280_Modes.ino:26:0:
C:\Users\Steve\Documents\Arduino\libraries\BME280\src/BME280I2C.h:53:16: note: virtual bool BME280I2C::ReadData(int32_t*)
virtual bool ReadData(int32_t data[8]);
^
C:\Users\Steve\Documents\Arduino\libraries\BME280\src/BME280I2C.h:53:16: note: candidate expects 1 argument, 5 provided
C:\Users\Steve\Documents\Arduino\libraries\BME280\examples\BME280_Modes\BME280_Modes.ino: In function 'void printBME280CalculatedData(Stream*)':
BME280_Modes:117: error: 'class BME280I2C' has no member named 'CalculateAltitude'
float altitude = bme.CalculateAltitude(metric);
^
exit status 1
no matching function for call to 'BME280I2C::ReadData(float&, float&, float&, uint8_t&, bool&)'
Hi all,
as I am new to arduino and BME280 world I am not sure if my question I should ask under "Issues" or somwhere else, but in case I am on right place my question would be how to retrieve absolute humidity using this BME280 ? In library "finitespace/BME280" is mention only relative humidity, right ?
Thanks!
cheers,
Milan
The used formula is very simple, but very inaccurate, usable for rough calculation. Much better results are provided by two variants of the calculation in http://drkfs.net/correctiontosealevel.htm. The Laplace’s formula is very versatile, while the Babinet’s formula is a good compromise of precision and simplicity.
The auxiliary value e/b can be derived e.g. in http://www.weather.gov/media/epz/wxcalc/vaporPressure.pdf.
as seen here: http://planetcalc.com/2167/#
we can calculate the absolute Humidity.
In version 2.2.1 the temperature unit is named "Celcius". In fact, it does not cause a malfunction, but aesthetically ... old Celsius would be better.
Hello,
I'm playing with BME280 and this lib to get my project working. But, I'm running into difficulties.
Also, I apologize, because I'm quite a beginner at Arduino and BME.
My project consist of a BME280 connected to an Arduino Pro Mini using SPI interface.
The basic setting are perfecly working. Now Iwould like to play with modes Setting. So I inspired myself of the I2C example :
BME280I2C::Settings settings(
BME280::OSR_X1,
BME280::OSR_X1,
BME280::OSR_X1,
BME280::Mode_Forced,
BME280::StandbyTime_1000ms,
BME280::Filter_Off,
BME280::SpiEnable_False,
BME280I2C::I2CAddr_0x76 // I2C address. I2C specific.
);
=> modified to this for SPI
#define DEVICE_PIN 9
BME280Spi::Settings settings(
BME280::OSR_X1,
BME280::OSR_X1,
BME280::OSR_X1,
BME280::Mode_Forced,
BME280::StandbyTime_1000ms,
BME280::Filter_Off,
BME280::SpiEnable_True,
DEVINCE_PIN // SPI Device PIN
);
This is not compiling arguing that 1 parameter is expected but 8 are provided.
Maybe you can help me understanding the way to declare settings with SPI ? An example would be great !
So then I tried another way to play with settings and I use this method :
// Change some settings before using.
settings.tempOSR = BME280::OSR_X4;
bme.setSettings(settings);
This is working OK. Even all OSR_X1 to X16 are working but not this even if it's documented:
// Change some settings before using.
settings.tempOSR = BME280::OSR_Off;
bme.setSettings(settings);
Compiling says : OSR_Off is not part of BME280
Yep, I would like to disable some measurement of the BME280 in order to save power, and I won't use all three measurement available on the BME.
Thanks for your help ! :)
return a bool from:
/Arduino/libraries/BME280/src/BME280.cpp: In member function 'bool BME280::InitializeFilter()':
/Arduino/libraries/BME280/src/BME280.cpp:85:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
/Arduino/libraries/BME280/src/BME280.cpp: In member function 'bool BME280::WriteSettings()':
/Arduino/libraries/BME280/src/BME280.cpp:122:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
compile the master branch
bool BME280::InitializeFilter()
bool BME280::WriteSettings()
0. Write Settings
-- OR --
return the return value from used I2C functions
Hi Tyler.
Thanks for putting this together. Works like a champ. I'm in my first weekend messing with the world of Arduino. So far, I've gotten: 2 nRF24L01+ to talk, the DHT-11 to return data, the BME280 to return data(thanks to your library and example sketch), and all on Pro Mini knockoffs. My question is this.
How (or where) do I change the units for the pressure here?
/* ==== Functions ==== /
void printBME280Data(Stream client){
float temp(NAN), hum(NAN), pres(NAN);
uint8_t pressureUnit(3); // unit: B000 = Pa, B001 = hPa, B010 = Hg, B011 = atm, B100 = bar, B101 = torr, B110 = N/m^2, B111 = psi
bme.ReadData(pres, temp, hum, metric, pressureUnit); // Parameters: (float& pressure, float& temp, float& humidity, bool hPa = true, bool celsius = false)
Specifically, I'm lost as to where to put "B010" in the code.
Also, not sure what the " uint8_t pressureUnit(3); " is doing.
I've spent most of the weekend reading arduino.cc learning resources, and scouring google for explanations.
FWIW, I'm experienced with wiring, basic electronics, and hardware, but a total noob with c++.
My only coding experience has been Apple BASIC in Jr. High, and dabbling in VB for M$ Office.
Any advice?
Thanks again for writing this library!
No. The used parameter name is misleading. Instead of bool metric would be better to use TempUnit units.
Using one SPI register read the trim can be read all at once eliminating three register reads. The raw register array can be packed into the existing DIG member variable.
Thanks a bunch for this awesome library!
Well, problem is as simple as that... I'm trying to gather data off of two of these. The code works for one, but I have no idea how to connect a second one up. :) Thanks!!!
Am trying to run the program in energia and am getting the following error.
BME_280_I2C_Test:78: error: 'NAN' was not declared in this scope
exit status 1
'NAN' was not declared in this scope.
Shouldn't this line in BME280_Modes.ino read 1 sample/second or is it really 1 minute? I am using this mode and seeing 1 sample/second.
//BME280I2C bme; // Weather Monitoring : forced mode, 1 sample/minute
Process:
C:\arduino-1.8.4\portable
NodeMCU 1.0 (ESP-12E Module)
from Board ManagerBrzo I2C
Version 1.31 from Library ManagerBME280
Version 2.2.0 from Library ManagerBME280_BRZO_I2C_Test
Arduino: 1.8.4 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
Archiving built core (caching) in: C:\Users\<user>\AppData\Local\Temp\arduino_cache_594038\core\core_esp8266_esp8266_nodemcuv2_CpuFrequency_80,UploadSpeed_115200,FlashSize_4M3M_8ee5fab911ac50cf47efcbc596507c23.a
sketch\BME_280_BRZO_I2C_Test.ino.cpp.o: In function `loop':
C:\arduino-1.8.4\portable\sketchbook\libraries\BME280\examples\BME_280_BRZO_I2C_Test/BME_280_BRZO_I2C_Test.ino:84: undefined reference to `BME280I2C_BRZO::BME280I2C_BRZO(BME280I2C_BRZO::Settings const&)'
sketch\BME_280_BRZO_I2C_Test.ino.cpp.o: In function `__static_initialization_and_destruction_0':
C:\arduino-1.8.4\portable\sketchbook\libraries\BME280\examples\BME_280_BRZO_I2C_Test/BME_280_BRZO_I2C_Test.ino:87: undefined reference to `BME280I2C_BRZO::BME280I2C_BRZO(BME280I2C_BRZO::Settings const&)'
sketch\BME_280_BRZO_I2C_Test.ino.cpp.o: In function `printBME280Data(Stream*)':
C:\arduino-1.8.4\portable\sketchbook\libraries\BME280\examples\BME_280_BRZO_I2C_Test/BME_280_BRZO_I2C_Test.ino:88: undefined reference to `BME280I2C_BRZO::begin()'
sketch\BME_280_BRZO_I2C_Test.ino.cpp.o: In function `setup':
C:\arduino-1.8.4\portable\sketchbook\libraries\BME280\examples\BME_280_BRZO_I2C_Test/BME_280_BRZO_I2C_Test.ino:51: undefined reference to `BME280I2C_BRZO::begin()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
Hi together,
is there any possibility to have 2 or more sensor in parallel connected, so to be able to masure on two different point humidity at the same time ? If yes, how to distinguish between sensors ? It seems that all are having address 0x76 per default.
reards,
Milan
I tested a few librarys, they all lack features of the chip. This is the best one but it lacks SPI support...
Sparkfuns has a low resolution output for some reason while adafruits library cant be set to use any oversampling etc.
U mentioned adding that in the other issue, that would be really great. Otherwise I have to stick to adafruits very basic library...
Also, to have a better overview of the options:
BME280 bme(1, 2, 5, 3, 7, 4);
// 1 = oversample pressure ×1
// 2 = oversample temperature ×2
// 5 = oversample humidity ×16
// 3 = forced readout (1+2=normal, 0=sleep)
// 7 = 20ms sleeptime
// 4 = filter x16
And a list of the options:
// 0 = no oversampling
// 1 = 1x
// 2 = 2x
// 3 = 4x
// 4 = 8x
// 5 = 16x
// 0 = Sleep mode
// 1 or 2 = Forced mode
// 3 = Normal mode
// 0 = 0,5ms
// 6 = 10ms
// 7 = 20ms
// 1 = 62,5ms
// 2 = 125ms
// 3 = 250ms
// 4 = 500ms
// 5 = 1000ms
// 0 = Filter off
// 1 = 2x
// 2 = 4x
// 3 = 8x
// 4 = 16x
Sketch:
#include <Wire.h>
#include <BME280.h>
#include <BME280I2C.h>
BME280I2C bme;
void setup() {
Serial.begin(115200);
pinMode(17, OUTPUT);
digitalWrite(17, 1);
delay(50);
Serial.println(F("Starting I2C"));
Wire.begin(2,4); // SDA = GPIO2, SCL = GPIO4
while (!bme.begin()) {
Serial.println(F("Could not find BMx280 sensor!"));
delay(500);
}
switch(bme.chipModel())
{
case BME280::ChipModel_BME280:
Serial.println(F("Found BME280 sensor, measuring temperature, humidity and pressure"));
break;
case BME280::ChipModel_BMP280:
Serial.println("Found BMP280 sensor, measuring temperature and pressure only");
break;
default:
Serial.println("ERROR: Found unknown sensor");
}
}
void loop() {
float temperature = 0;
float humidity = 0;
float pressure = 0;
bme.read(pressure, temperature, humidity, BME280::TempUnit_Celsius, BME280::PresUnit_Pa);
Serial.print(temperature);
Serial.print(" °C ");
Serial.print(pressure);
Serial.print(" Pa");
Serial.println("");
delay(500);
}
Output:
Starting I2C
Found BMP280 sensor, measuring temperature and pressure only
28.82 °C 81732.34 Pa
25.78 °C 100944.22 Pa
25.79 °C 100947.60 Pa
25.78 °C 100943.45 Pa
25.78 °C 100944.22 Pa
25.78 °C 100944.22 Pa
sketch/BME_280_BRZO_I2C_Test.ino.cpp.o: In function `loop':
/home/user/Arduino/libraries/BME280/examples/BME_280_BRZO_I2C_Test/BME_280_BRZO_I2C_Test.ino:94: undefined reference to `BME280I2C_BRZO::BME280I2C_BRZO(BME280I2C_BRZO::Settings const&)'
sketch/BME_280_BRZO_I2C_Test.ino.cpp.o: In function `__static_initialization_and_destruction_0':
/home/user/Arduino/libraries/BME280/examples/BME_280_BRZO_I2C_Test/BME_280_BRZO_I2C_Test.ino:97: undefined reference to `BME280I2C_BRZO::BME280I2C_BRZO(BME280I2C_BRZO::Settings const&)'
collect2: error: ld returned 1 exit status
Compile BME_280_BRZO_I2C_Test.ino
.
pres = bme.pres()
'class BME280I2C' has no member named 'pres'
Inside BME280.c, your pres
function is called press
Just so you know. Your README and KEYWORDS need updating, or the BME class.
Hi,
I note at the end of the file BME280I2C.h:
#if defined(ARDUINO_ARCH_ESP8266)
/* ==== On esp8266 it is possible to define I2C pins ==== */
bool begin(int SDA, int SCL);
#endif
I wanted like to use this facility to change the SDA/SCL pins used on my ESP8266. I have tried adding #defines at the top of my main.cpp (Am using PlatformIO) which compiled but didn't seem to make any difference in that the BME was still being read on GPIO 4/5.
I did work out how to do this in the end... In the .platformio/packages/framework-arduinoespressif8266/variants/ directory are header files for all the different board types. Once I had worked out which board I was using - it was called nodemcu - (I had actually chosen "Espressif ESP8266 ESP-12E" from the Project builder in PlatformIO) I could set the pins in the appropriate pins_arduino.h file.
I now have my BME280 being read on GPIO 12 & 14 :-)
Maybe this info will help someone else.
Thanks for a cool library.
Sorry for the newbie question. I've installed the lib per the README and I'm using ID 1.6.5 but I'm getting compilation error using the test example:
Arduino: 1.6.5 (Mac OS X), Board: "Arduino Uno"
Build options changed, rebuilding all
Using library BME280 in folder: /Applications/Arduino.app/Contents/Java/libraries/BME280 (legacy)
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Applications/Arduino.app/Contents/Java/libraries/BME280 /var/folders/cf/6c8fqtkj4b91nhzcrfhlzz5h0000gn/T/build8708549420658519769.tmp/BME280_Test.cpp -o /var/folders/cf/6c8fqtkj4b91nhzcrfhlzz5h0000gn/T/build8708549420658519769.tmp/BME280_Test.cpp.o
In file included from BME280_Test.ino:37:0:
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:48:3: error: 'uint8_t' does not name a type
uint8_t tempOversamplingRate, humidityOversamplingRate, pressureOversamplingRate; // B000 = Skipped, B001 = x1, B010 = x2, B011 = x4, B100 = x8, B101/other = x16
^
In file included from BME280_Test.ino:37:0:
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:49:3: error: 'uint8_t' does not name a type
uint8_t mode; // Sleep = B00, Normal = B01 and B10, Forced = B11
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:50:3: error: 'uint8_t' does not name a type
uint8_t standbyTime; // B000 = 0.5ms, B001 = 62.5ms, B010 = 125ms, B011 = 250ms, B100 = 250ms, B101 = 1000ms, B110 = 10ms, B111 = 20ms
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:51:3: error: 'uint8_t' does not name a type
uint8_t filter; // B000 = off, B001 = 2, B010 = 4, B011 = 8, B100/other = 16
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:52:3: error: 'uint8_t' does not name a type
uint8_t controlHumidity; // ctrl_hum register. (ctrl_hum[2:0] = Humidity oversampling rate.)
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:53:3: error: 'uint8_t' does not name a type
uint8_t controlMeasure; // ctrl_meas register. (ctrl_meas[7:5] = temperature oversampling rate, ctrl_meas[4:2] = pressure oversampling rate, ctrl_meas[1:0] = mode.)
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:54:3: error: 'uint8_t' does not name a type
uint8_t config; // config register. (config[7:5] = standby time, config[4:2] = filter, ctrl_meas[0] = spi enable.)
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:55:3: error: 'uint8_t' does not name a type
uint8_t bme_280_addr;
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:56:3: error: 'uint8_t' does not name a type
uint8_t dig[32];
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:60:22: error: 'uint8_t' has not been declared
void WriteRegister(uint8_t addr, uint8_t data);
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:60:36: error: 'uint8_t' has not been declared
void WriteRegister(uint8_t addr, uint8_t data);
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:66:17: error: 'int32_t' has not been declared
bool ReadData(int32_t data[8]);
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:69:30: error: 'int32_t' has not been declared
float CalculateTemperature(int32_t raw, int32_t& t_fine, bool celsius = true);
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:69:43: error: 'int32_t' has not been declared
float CalculateTemperature(int32_t raw, int32_t& t_fine, bool celsius = true);
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:72:27: error: 'int32_t' has not been declared
float CalculateHumidity(int32_t raw, int32_t t_fine);
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:72:40: error: 'int32_t' has not been declared
float CalculateHumidity(int32_t raw, int32_t t_fine);
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:75:27: error: 'int32_t' has not been declared
float CalculatePressure(int32_t raw, int32_t t_fine, uint8_t unit = 0x0); // unit: B000/other = Pa, B001 = hPa, B010 = inHg, B011 = atm, B100 = bar, B101 = torr, B110 = N/m^2, B111 = psi
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:75:40: error: 'int32_t' has not been declared
float CalculatePressure(int32_t raw, int32_t t_fine, uint8_t unit = 0x0); // unit: B000/other = Pa, B001 = hPa, B010 = inHg, B011 = atm, B100 = bar, B101 = torr, B110 = N/m^2, B111 = psi
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:75:56: error: 'uint8_t' has not been declared
float CalculatePressure(int32_t raw, int32_t t_fine, uint8_t unit = 0x0); // unit: B000/other = Pa, B001 = hPa, B010 = inHg, B011 = atm, B100 = bar, B101 = torr, B110 = N/m^2, B111 = psi
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:79:18: error: expected ')' before 'tosr'
BME280(uint8_t tosr = 0x1, uint8_t hosr = 0x1, uint8_t posr = 0x1, uint8_t mode = 0x3,
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:90:22: error: 'uint8_t' has not been declared
float ReadPressure(uint8_t unit = 0x0); // unit: B000 = Pa, B001 = hPa, B010 = Hg, B011 = atm, B100 = bar, B101 = torr, B110 = N/m^2, B111 = psi
^
/Applications/Arduino.app/Contents/Java/libraries/BME280/BME280.h:96:85: error: 'uint8_t' has not been declared
void ReadData(float& pressure, float& temp, float& humidity, bool metric = true, uint8_t p_unit = 0x0);
^
Error compiling.
rename sealevelAltitude to seaLevelPressure. It is a little bit misleading.
I have a BME that seems to report temperature and atmospheric data without issue, but humidity data does not get reported. Any thoughts? I'm using the BME_280_I2C_Test code.
Here's the Serial output:
Temp: 27.22⸮C Humidity: 0.00% RH Pressure: 29.86 atm Altitude: 18.16m Dew point: nan⸮C
How to change the standby time?
I need to take every 250ms one sample.
I use this library with Arduino nano, it works fine except humidity - it shows all time 0,00%. Is problem on my module?
Thanks.
I would appreciate a version for chips that do not have native i2c support
we should add a getStatus function where we select which bit is returned from the register.
Remove modes example sketch, create settings example sketch.
Hello,
First of all, thank you very much for this nice library, it makes working with this sensor a breeze.
I am trying to use current HEAD with platformio and I am facing compilation issues. First of all you are including header file which does not exist in both BME280Spi.cpp and
BME280SPiSw.cpp.
I think this is an accidental left over. After removing this I get the following error.
Compiling .pioenvs\huzzah\lib\BME280\BME280SpiSw.o
.piolibdeps\BME280\src\BME280SpiSw.cpp:155:101: error: default argument given for parameter 5 of 'BME280SpiSw::BME280SpiSw(uint8_t, uint8_t, uint8_t, uint8_t,
uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)' [-fpermissive]
This can be fixed by removing the defaults from the .cpp file, since they are already in the .h file.
After this cleanup it compiles without any issues.
Hello, can you please tell me why i cannot compile this code
...
#define ARDUINO_ARCH_ESP8266
#include <BME280I2C.h>
...
compile error:
: undefined reference to BME280I2C::begin()' : In function
setup()':
: undefined reference to `BME280I2C::begin()'
: ld returned 1 exit status
if i comment the line #define ARDUINO_ARCH_ESP8266
everything it's compile OK
any advise please
add in the oversampling enum a zero value for disabling this feature.
Hi!
Thanks for this awesome library!
I have a problem,
When I upload the example with Wire.pins (0,2) and then Wire.begin, It work great.
But when I upload my own code (send the data from BME280 to thingspeak) it crash immediately.
When I comment out bme.begin() it work and connect to the WiFi.
So it seems that bme.begin() cause the problem here.
Any ideas?
Thanks!
Can you please explain how I can use setSettings to change the mode of the BME280. I guess was
bme.setSettings("Mode_Sleep") but the IDE knows that this is not valid. How do you do it?
I'm trying to use the Wemos-D1-Mini-BME280-Weather-Station project . When compiling in Arduino IDE 1.8.5 I get the following errors:
Arduino:1.8.5 (Windows 10), Płytka:"WeMos D1 mini Pro, 80 MHz, 16M (15M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"
In file included from C:\Users\rober\Documents\Arduino\meteo\meteo.ino:14:0:
settings.h:21: error: no matching function for call to 'BME280::BME280()'
BME280 mySensor; // This can be tweaked, refer to https://github.com/finitespace/BME280 for details
sketch\settings.h:21:8: note: candidates are:
In file included from C:\Users\rober\Documents\Arduino\meteo\meteo.ino:7:0:
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:157:4: note: BME280::BME280(const BME280::Settings&)
BME280(
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:157:4: note: candidate expects 1 argument, 0 provided
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:43:7: note: constexpr BME280::BME280(const BME280&)
class BME280
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:43:7: note: candidate expects 1 argument, 0 provided
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:43:7: note: constexpr BME280::BME280(BME280&&)
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:43:7: note: candidate expects 1 argument, 0 provided
In file included from C:\Users\rober\Documents\Arduino\meteo\meteo.ino:14:0:
settings.h:21: error: cannot declare variable 'mySensor' to be of abstract type 'BME280'
BME280 mySensor; // This can be tweaked, refer to https://github.com/finitespace/BME280 for details
In file included from C:\Users\rober\Documents\Arduino\meteo\meteo.ino:7:0:
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:43:7: note: because the following virtual functions are pure within 'BME280':
class BME280
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:274:17: note: virtual bool BME280::WriteRegister(uint8_t, uint8_t)
virtual bool WriteRegister(
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:280:17: note: virtual bool BME280::ReadRegister(uint8_t, uint8_t*, uint8_t)
virtual bool ReadRegister(
C:\Users\rober\Documents\Arduino\meteo\meteo.ino: In function 'void loop()':
meteo:74: error: no matching function for call to 'BME280::ReadData(float&, float&, float&, bool, int)'
mySensor.ReadData(pressureBuffer[bufferposition], tempBuffer[bufferposition], humidityBuffer[bufferposition], true, 0);
C:\Users\rober\Documents\Arduino\meteo\meteo.ino:74:120: note: candidate is:
In file included from C:\Users\rober\Documents\Arduino\meteo\meteo.ino:7:0:
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:315:9: note: bool BME280::ReadData(int32_t*)
bool ReadData(
C:\Users\rober\Documents\Arduino\libraries\BME280_finitespace\src/BME280.h:315:9: note: candidate expects 1 argument, 5 provided
exit status 1
no matching function for call to 'BME280::BME280()'
I am very beginner, please help me solve the problem.
Excuse me, could I use this library on attinys?
I have a question:
After reading the BME280 datasheet I resume this:
Min MAX unité précision résolution
-40 +85 °C +/-0.5 0.01
0 100 %Hr +/-3% 0.008
30000 110000 Pa +/-100 0.18
So the pressure can move between this scale:
Pression atmospherique
30000.00 110000.00 => *100
3000000 11000000=> 3x Bytes (ou 1 long) => /100.0
=> xxxxxx.xx Pa
But this is a 8 significant digit.
A float variable can only goes for 7 significant digit. Would be better to use a long variable?
Whatever I read that it is preferable to use long variables instead of float ones (less use of processor cycles if no dedicated FTU)
And I am transferring it on NRF24L01 so in every cases I have to cut into Bytes.
So, Is there a way to get long instead of float when reading?
Do multiple sensors get their own calibration values?
Or do they all use the same set?
PS: Why cant I edit the title.... urgh... sorry.
Calculation of the heatindex I believe works correctly, but I guess the function is not efficiently written. I'd recommend
If necessary, convert the temperature to a opposite units and stop thinking which of coefficients tables to use. Perhaps it will reduce the code size and increase the speed.
Do not use the stack or other RAM memory for the coefficients. Write coefficients directly into formulas. It could save up to (2tables * 9coefficients * sizeof (float))= 72B of precious RAM.
Perhaps it is possible to find a calculation method that will not be limited to 26.7 °C.
The function returns float, but in Readme is erroneously written int.
I apologize for the delayed reaction - only a very short time has elapsed since pull request to merge...
When BME280
constructor is called settings is copied to a BME280::Settings
member variable and child settings information is discarded. Subsequently, a call to getSettings()
returns a const reference to member BME280::Settings
. This forces child classes to hold member variables of settings instead of using getSettings()
Solutions:
we can calculate the heatindex from the rel. humidity and the temperature.
https://en.wikipedia.org/wiki/Heat_index
The forced mode of the bme280 allows a one shot read of the bme280 values (temp, humidity, etc).
The forced mode is selected in the constructor. The constructor calls Initialize() and sets forced mode (if the user set it to 1).
If that is the case, then the first read will give the values and put the bme280 in sleep mode (that is the way forced mode works).
The problem is that forced mode needs to be setted again to be able to be used again. It is resetted every read. The only way to do this is to call "WriteRegister(CONFIG_ADDR, config);" again.
Today it is called only at the constructor, which calls Initialize();
That is why I suggest to move in both I2C and Spi .h header files the Initialize() to "public:", so after a call to read we can call Initialize() again to set again forced mode and continue with another read and so forth.
That is the easy way. It works. I tested it.
Another more complicated way would be to handle it internally, with a flag somewhere, for every read, if the bme280 constructor setted forced mode, set it again before each read.
Hi! First of all thanks for this library, it's a great job you did here!
I just wanted to ask, since in my experience the BME reads temperature a bit higher than some other sensors, if you compensate for that in the library?
I'm asking because at the moment I'm using a -2°C offset in the php file that fetches the data from my database but I noticed that when I changed to your library from the Sparkfun one I got a drop in the temperature readings - so it seems your library is closer to the "real" values and I might need to adjust my offset.
Thanks, Alex
See a humidity value
Sensor gets detected as BMP280 and it show 0.00% RH
I bought this sensor from ebay (https://www.ebay.de/itm/Blue-Digital-Barometric-Pressure-Sensor-Board-BME280-I2C-SPI-BMP280-3-3V-AIP/142636813700) and thought that I bought a BME280 sensor, but now im not sure. How can I see if this is a BME280 or a BMP280? On the board and in the product title it says both.
if we initialize the sensor we must take care of the sensor values. The user should not be bothered with handling the device in the right way, if the user wants a true measurement, they should get it. #59
We need to add at least one measurement (if forced mode is active). But in general we should use the table 6 'filter settings' to force a count of measurements before the user get control.
Hi!
Would it be possible to bump up the version string in library.properties
to 2.0.0 to match the latest release?
It seems that the version Platformio currently distributes is somehow broken as I get the following compile error:
BME280I2C.h:56:23: error: expected ')' before 'tosr'
By looking at the commits in this repository, it seems that the bug has already been fixed, but the updated version is not available from platformio. This might get resolved if the library version would be updated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.