I am experimenting with using a BMP280 I2C sensor on a Heltec Cubecell (HTCC AB-01) board, for the time being without LoRa, so simply measuring temperature and humidity.
None of the libraries I tried, like those from Adafruit and Seeed, work and generate all kinds of error messages. The BMP280 example from the Third Part Sensor Examples supplied by Heltec also does not work. This does not seems to be a serious example because CO2, lux and TVOC are also used, nonsense for a BMP280 that can only measure temperature and humidity.
Hence my question: does anyone have a working BMP280 sketch for this board?
That’s not very meaningful.
Adafruit’s code for example is valid in the context it was meant to be used on, likely it would need some tuning to your board (and de-Arduinoification if you are not using an Arduino approach). Bosch themselves also publish a solution at https://github.com/BoschSensortec/BME280_driver which is more generic C - you need to provide function pointers to SPI or I2C routines of the sort the desire.
Essentially, you need to work through the error messages, understand what they mean, and correct their causes in terms of project setup, chip specific I/O detail, etc one at a time.
Thank you for your response. You’re asking me to reinvent the wheel but I think we have a forum for that.
Obviously I have already done the necessary tests and adjustments so as not to tire you with pointless questions. Unfortunately without success, it was not without a reason that I asked for a working sketch.
But here are the most relevant results (BMP280 I2C sensor, default address 0x76)
Lib: Adafruit_BMP280.h / sketch: bmp280_sensortest
compiles without error but no sensor found
Lib: Adafruit_BMP280.h / sketch: bmp280test
compiles without error but no sensor found
Lib Seeed_BMP280.h / sketch: bmp280_example
compiles without error but no serial output
Lib: BMx280I2C.h / sketch: BMx280_I2C
does not compile, error “wire_ = nullptr;”
Surely someone will use this sensor with the HTCC AB01 board?
But here are the most relevant results (BMP280 I2C sensor I2C address 0x76)
Each of those are situations which can be investigated and resolved.
Eg, with the things that run, one of the first tests you should do is to see if there’s any electrical activity on the I2C bus. With those that don’t compile, you need to take time to understand what the compiler’s complaint is.
Just jumping from codebase to codebase isn’t effective on a level of more than random chance
Thanks for your advice cslorabox.
Anyone having a solution?
I would start by checking the part number of the sensor and compare to the sketch.
The BMP280 is a Pressure and Temperature Sensor
The BME280 is a Pressure, Temperature and Humidity Sensor.
In your original post you mention Humidity but the BMP280 does not measure that.
You may have the wrong sketch for the sensor.
And I’d also Google for an I2C scanner sketch / code / C to check that there is in fact a device on the I2C bus and what address it is at.
Heltec provide two I2C scanners in their examples. There is a basic i2c_scan which lists the device addresses on the I2C bus. There is also a multi sensor auto recognise example which gives more information about the devices found.
I have a Heltec AB-01 with an Adafruit BME280 sensor module. I based my code on one of the Heltec low power examples, and use the Seeed BME280 sensor library.
Either before testing with a I2C scanner or after if you can’t a sensor check there are pull-up resistors on the I2C lines?
Since a few sketches did not find a sensor at 0x76 its likely there is some other problem.
The HTCC AB-01 has resistors R23 and R25 for this but looking at the schematic they look unpopulated. You may find there are no resistors on the sensor board as well.
Thank you all for all the information. With your help I can now continue (as soon as I have the time) and I will post the results here.
@TonySmith You’re right Tony I was wrong in the posting above. It is a BMP280 so it measures temperature and air pressure but not humidity.
The sensor is now working. As AndyG wrote the Heltec multisensor auto recognize sketch works, also in my setup. The scanner found the I2C address of the BMP280 namely 0x76.
Seeed’s BMP280 library didn’t work, I could compile but the serial monitor didn’t give any output. Unfortunately not even error messages.
It turned out that the Seeed library only uses the address 0x77, it cannot automatically switch to 0x76. After I set the default address to 0x76 in the library it worked as it should.
I am happy and hope that others will benefit from this information. Thank you all for your help!
This seems normal for I2C devices. I2C address space is limited and not assigned by a central co-ordinator so conflicts will occur.
The physical device has a few address options and the actual board will often have a default jumper. The Libraries use the default for the particular breakout board and alternatives can be set by using the alternate address in the begin() function call.
Address list https://i2cdevices.org/addresses
Seeed https://wiki.seeedstudio.com/Grove-Barometer_Sensor-BMP280/ (shows the jumpers)
Thank you for your message. I know that I2C sensors work on different addresses but was surprised that the library did not provide an error when the address is incorrect. That’s why it took me a while to figure out what was wrong.
We’re probably getting off the TTN topic, but the begin() call should return FALSE and your code (or the example you used) should check that.
Always worth running the I2C scanner code first I think - just to check addresses
Yes do not bme from use sht3x or sht4x from sensirion