jvkran / forced-bme280 Goto Github PK
View Code? Open in Web Editor NEWA very small and efficient library for usage with the BME280.
Home Page: https://projects.jvkran.com
License: Apache License 2.0
A very small and efficient library for usage with the BME280.
Home Page: https://projects.jvkran.com
License: Apache License 2.0
I suggest you include the units of measure in your documentation: Celsius, relative humidity, pressure.
Example code has:
#include <forcedClimate.hpp>
Should be ?
#include <forcedClimate.h>
getTemperatureCelcius() should be getTemperatureCelsius()
#define FORCED_CLIMATE_WIRE //Uncomment this macro to use Wire.h instead of TinyWireM.h
was changed in the include, it is the current version from 9 March 2020
Unfortunately I have problems running it on a 32U4 based board like the Arduino Micro:
After uploading the sketch, the serial port /dev/ttyACM0 gets lost and hence no output on the serial monitor is possible.
Do you have any hints?
If getTemperatureCelcius() is never called by the user, any pressure or humidity measurement will potentially be wrong.
The reason is that pressure and humidity measurement rely on the current temperature, which is stored within the library.
In the example (Test.ino), if one removes this line 24 and 33, wrong results for pressure and humidty are obtained (check cooling or heating the sensor). In fact the getTemperatureCelcius() is not called neither in the constructor nor in the begin() function.
I suggest to replace line 113 of forcedClimate.cpp by "getTemperatureCelcius(true);" for the temperature to be measured at least during constructor and/or begin() function.
I further suggest to add "getTemperatureCelcius();" after line 73 of forcedClimate.cpp.
However, after these two changes the direct measurement call by getPressure(true) or getHumidity(true) would still not work unless a getTemperatureCelcius() call is added in these functions at appropriate lines.
An even simpler solution is to change the readme such that it says:
getTemperatureCelcius(const bool performMeasurement)
This function must be used to retrieve the temperature or before any other measurement.
how to change the default I2C address in ESP32-cam, e.g.
for something like that
// BME280
#define I2C_SDA 3 // for ESP32-CAM
#define I2C_SCL 16
TwoWire I2CBME = TwoWire (1);
Adafruit_BME280 bme;
Hi,
i'm using your the v3.0.0 library, and it's quiet simple to use. Thanks for your work.
Unfortunately it seems that the sleep mode isn't effective.
I'm using a BME280 with a ESP01S, when active, current is about 200mA, when deepsleeping is requested, all the circuitry current is about 1mA. This is a lot comparative to 30/40uA expected. I have suspected my ESP, change it, try anothe again... but nothing was improved, still between 0.95 - 1,2mA.
So i just removed the BME280 and the current dropped to 20uA in deepsleep.
Is it possible that the library failed to flip the BME280 in deepsleep mode ?
Thanks for you reply.
Take care.
Jochem, thank you for developing this lightweight library for the BME280. I had difficulty installing the library on a D1 Mini with the ESP8266 core on IDE version 1.8.12. It said it needed other libraries but gave an error message "no protocol" when I tried installing it that way. When installed without the other libraries, compilation failed with an error related to AVR interrupts. I then installed the complete set for version 2.0.0. Again, there was a "no protocol" error but version 2.0.0 installed and worked. I tried to update to 2.1.0 but again got the no protocol error however it did update the BME driver. It throws this error:
Arduino: 1.8.12 (Windows 10), Board: "LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"
C:\Users\KarlB\Documents\Arduino\libraries\TinyWireM\USI_TWI_Master.cpp:22:27: fatal error: avr/interrupt.h: No such file or directory
#include <avr/interrupt.h>
^
compilation terminated.
exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.
Conclusions: 2.0.0 works, 2.1.0 has a problem, and Arduino IDE 1.8.12 does not like the library.
getting temperatures (and humidity and pressure) in centigrades (to avoid the float lib) is only available when compiling with FORCED_CLIMATE_ATTINY. However, that doesn't work on all boards/conditions where avoiding the float lib may still save some memory. Could there be two different defines? One for the use of tiny vs normal wire, the other for getting the int version of the read functions?
other libraries offer a function to poll the status register to check if the measurement has started and terminated.
It would be good if a similar function would be provided. This might look like
bool ForcedClimate::isMeasuring() {
uint8_t status = 0;
bus.beginTransmission(address);
bus.write((uint8_t)registers::STATUS);
bus.endTransmission();
bus.requestFrom(address,(uint8_t)1);
while ( bus.available() ) {
status = bus.read(); // receive a byte
}
return(status & (1<<3)); //return true in case the measuring bit (3) is set
}
Hello, the latest version does not have double digit precsion any more. I took a look at the .h file and you should divide the return values by 100.0 instead of just 100 as doing so causes it to return a decimal value (or a float with .00 decimals).
Also, regarding the MCUs that do not have floats, perhaps you can use a macro to detect a attiny, if so do not use floats. If it doesnt detect a atttiny, then use floats. for example:
#if defined(ARDUINO_AVR_ATTINY)
do stuff...
return value/100
#else
do stuff
return value/100.0
#endif
This way it will not increase the code that gets copiled and you get to have the best of both worlds.
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.