RAKWireless / RAK811_BreakBoard

RAKwireless,RAK811,BreakBoard,GPS tracker,Low power,Open source
5 stars 4 forks source link

add BME280 SPI/I2C sensor support #2

Open kalon33 opened 6 years ago

kalon33 commented 6 years ago

Please add BME280 temperature/humidity/pressure sensor support, using both SPI or I2C (or I2C only).

That would be very nice to support this very common sensor and add an example to use it as a demo of I2C sensor interfacing.

Ebiroll commented 6 years ago

I implemented BME280 support here, https://github.com/Ebiroll/RAK811_BreakBoard/tree/master/lib/obme280 Use like this i2c_bme280_begin(); temp=i2c_bme280_read_temp(); pressure=i2c_bme280_read_pressure(); rh=i2c_bme280_read_rh(); int itemp=temp; int irh=rh; printf("RH %2f Temp %2f , pressure %2f\r\n",rh,temp,pressure); printf("RH %d Temp %d \r\n",irh,itemp); It also uses forced mode that will save some power, Use i2c_bme280_force_readings( void ); to force new readings and put BME280 to sleep again.

kalon33 commented 6 years ago

@ebiroll Thanks a lot, I will take a closer look at it when at home. I saw in your commits that you tested a sleep mode... Is there a way to make it to sleep a given time, and then make another measurement, and send values? Currently performance is pretty bad on the battery side, so I'm really looking at such a mode to make the board usable for me.

----- Mail original -----

De: "Ebiroll" notifications@github.com À: "RAKWireless/RAK811_BreakBoard" RAK811_BreakBoard@noreply.github.com Cc: "Nicolas Derive" kalon33@ubuntu.com, "Author" author@noreply.github.com Envoyé: Mardi 13 Février 2018 01:35:52 Objet: Re: [RAKWireless/RAK811_BreakBoard] add BME280 SPI/I2C sensor support (#2)

I implemented BME280 support here, https://github.com/Ebiroll/RAK811_BreakBoard/tree/master/lib/obme280 Use like this i2c_bme280_begin(); temp=i2c_bme280_read_temp(); pressure=i2c_bme280_read_pressure(); rh=i2c_bme280_read_rh(); int itemp=temp; int irh=rh; printf("RH %2f Temp %2f , pressure %2f\r\n",rh,temp,pressure); printf("RH %d Temp %d \r\n",irh,itemp); It also uses forced mode that will save some power, Use i2c_bme280_force_readings( void ); to force new readings and put BME280 to sleep again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .

Ebiroll commented 6 years ago

Yes, sleepmode is still work in progress and the bme280 code needs more testing. We will see what we can do with sleepmode. Feedback is welcome. Here is another interesting board http://badgerboard.io but I am hoping that RAK will make a board that is optimized for battery operations.