BME280 on the Raspberry Pi

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

BME280 on the Raspberry Pi

Post by gm8arv »

I have the BMP085 working fine on one Raspberry Pi. I have just bought a couple of your BME280 modules and would like to use one on another Raspberry Pi, but of course your BMP085 code doesn't quite work (I expected this). It gives the wrong readings. Could you please advise what and how to update in that code for the BME280?

https://learn.adafruit.com/adafruit-bme ... t/overview

Thanks,
David

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BME280 on the Raspberry Pi

Post by adafruit_support_rick »

We don't have a library or tutorial for that yet. You can refer to the Arduino library for details of how to talk to the sensor.

User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

Re: BME280 on the Raspberry Pi

Post by gm8arv »

Thanks, Rick. I can certainly see some of the functions required and register definitions in the Arduino library, but transferring that into the Raspberry Pi Python environment is rather beyond me at the moment. I hope someone can make that transfer.

David

User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

Re: BME280 on the Raspberry Pi

Post by gm8arv »

adafruit_support_rick wrote:We don't have a library or tutorial for that yet. You can refer to the Arduino library for details of how to talk to the sensor.
Thanks, Rick. I've been able to get some numbers of out the device, but I' sure they aren't correct:

raw = 532888
T1 = 27503
T2 = -1177
T3 = 12800

Making the temp = -0.048 deg C, I think. Do the above numbers look anything like what is seen with the Arduino? Can anyone compare results? There seems to be a difference in the code between Arduino and Raspberry PI in that one uses routines looking like little-endian and the other like big-endian, at least according to the function names!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BME280 on the Raspberry Pi

Post by adafruit_support_rick »

I really don't know. I'll see if anybody else has some ideas

User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

Re: BME280 on the Raspberry Pi

Post by gm8arv »

Probably resolved. The older chip has MSB first in the calibration registers, the newer has LSB first. I failed to spot that at first glance. No wonder the numbers were wrong. I now have correct values for temperature and pressure, this afternoon's task is to program humidity, where the calibration values are somewhat messily stored.

I also discovered when making a test program for the maths that Delphi's shift right is a logical shift, and not an arithmetic shift, thus failing to propagate the sign bit on negative integers. It's easy enough to make a SAR function, though.

Thanks for the help and encouragement, and for providing this new product.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BME280 on the Raspberry Pi

Post by adafruit_support_rick »

Please share your library when you get it going!

User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

Re: BME280 on the Raspberry Pi

Post by gm8arv »

Here's what I have so far. It needs some work to turn it into a library, but it serves my purpose. I've used floating point arithmetic rather than integers and shifts as I expect there's little time difference on the Raspberry Pi I'm using. As the temperature is used in both the pressure and humidity calculations, I have coded so that all three are calculated together, and then (for my purposes) saved as text files where they can be read as desired by an SNMP add-on.

If published, I would appreciate a reference: David J Taylor, Edinburgh. www.satsignal.eu

The code is, of course, based on Adafruit's BMP085.py, although all the copyright wasn't grabbed by the "Copy all to clipboard" I used in PuTTY to get the text from the Raspberry Pi to the Windows PC. Limited number of lines. I hope that hasn't clobbered the format too much!

User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

Re: BME280 on the Raspberry Pi

Post by gm8arv »

I sent an attachment - I hope it came through but I don't see where to find it.....

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BME280 on the Raspberry Pi

Post by adafruit_support_rick »

To attach a zip file, use the 'Choose File' button, select the file on your computer, and then click the 'Add The File' button

User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

Re: BME280 on the Raspberry Pi

Post by gm8arv »

Well, Rick, that's just what I did, albeit source file rather than zipped. I'm having another go with a Zip file of the current variant now.

Could it be that if I get asked for the resistor value any attachment gets dropped and needs to be re-attached? That's the only thing I can think of.... Ah, perhaps I selected the file, but did not "ADD THE FILE".

David
Attachments
BME280.zip
(2.74 KiB) Downloaded 153 times

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BME280 on the Raspberry Pi

Post by adafruit_support_rick »

Got it! Thanks

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: BME280 on the Raspberry Pi

Post by ktownsend »

Hi David! Thanks for poking at this for the BME280. I've published some BME280 files on github here, adding you to the credits in the readme and in the main class: https://github.com/adafruit/Adafruit_Python_BME280 ... hopefully it will be useful to other customers that way, and they're more likely to stumble across it.

User avatar
gm8arv
 
Posts: 15
Joined: Wed Mar 04, 2015 3:19 am

Re: BME280 on the Raspberry Pi

Post by gm8arv »

Thanks for that!

I've provided a write-up of plotting the data remotely with SNMP and MRTG here:

http://www.satsignal.eu/raspberry-pi/mo ... tml#BME280

so I hope that will also be useful.

User avatar
rexmarinus
 
Posts: 6
Joined: Mon Oct 05, 2015 1:47 pm

Re: BME280 on the Raspberry Pi

Post by rexmarinus »

Hello
I have 2-3 extra rasberry pis and recently aquired an adafruit BME280 sensor.
Are there any instructions to follow in order to make them work together?
I am not a linux guy and completely newbie.
I just want to make a weather station myself.
I have no idea how to wire the sensor to the raspberry pi. (Which pins I have to connect to each other)
I have no idea which OS i have to install to the rpi
and I have no idea how to install whatever is needed to make the rpi read and display the sensors readings.

Any help would greatly appreciated.

Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”