Giter Site home page Giter Site logo

jvkran / forced-bme280 Goto Github PK

View Code? Open in Web Editor NEW
12.0 5.0 2.0 55 KB

A very small and efficient library for usage with the BME280.

Home Page: https://projects.jvkran.com

License: Apache License 2.0

C++ 100.00%
bme280 bme bmp bmp280 arduino esp minimal small efficient library

forced-bme280's People

Contributors

jvkran avatar per1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

forced-bme280's Issues

Measurements are potentially wrong if getTemperatureCelcius() is never called

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.

Polling option for status register

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 
    }

Documentation suggestion

I suggest you include the units of measure in your documentation: Celsius, relative humidity, pressure.

change the default I2C address in ESP32

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;

README typo

Example code has:
#include <forcedClimate.hpp>
Should be ?
#include <forcedClimate.h>

integer version

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?

Double Digit precision is lost

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.

Forced-BME280 on 32U4 boards

#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?

BME sleepmode failed ?

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.

Arduino IDE 8.12 problem

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.

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.