0

BME280 on the Raspberry Pi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

BME280 on the Raspberry Pi

by gm8arv on Fri Aug 21, 2015 12:00 pm

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

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

Re: BME280 on the Raspberry Pi

by adafruit_support_rick on Sat Aug 22, 2015 2:29 pm

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.

adafruit_support_rick
 
Posts: 34079
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: BME280 on the Raspberry Pi

by gm8arv on Sun Aug 23, 2015 3:20 am

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

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

Re: BME280 on the Raspberry Pi

by gm8arv on Tue Aug 25, 2015 12:23 pm

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!

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

Re: BME280 on the Raspberry Pi

by adafruit_support_rick on Tue Aug 25, 2015 3:23 pm

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

adafruit_support_rick
 
Posts: 34079
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: BME280 on the Raspberry Pi

by gm8arv on Thu Aug 27, 2015 9:07 am

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.

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

Re: BME280 on the Raspberry Pi

by adafruit_support_rick on Thu Aug 27, 2015 10:39 am

Please share your library when you get it going!

adafruit_support_rick
 
Posts: 34079
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: BME280 on the Raspberry Pi

by gm8arv on Thu Aug 27, 2015 11:45 am

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!

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

Re: BME280 on the Raspberry Pi

by gm8arv on Thu Aug 27, 2015 9:23 pm

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

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

Re: BME280 on the Raspberry Pi

by adafruit_support_rick on Fri Aug 28, 2015 9:41 am

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

adafruit_support_rick
 
Posts: 34079
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: BME280 on the Raspberry Pi

by gm8arv on Fri Aug 28, 2015 9:55 am

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 78 times

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

Re: BME280 on the Raspberry Pi

by adafruit_support_rick on Fri Aug 28, 2015 11:03 am

Got it! Thanks

adafruit_support_rick
 
Posts: 34079
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: BME280 on the Raspberry Pi

by ktownsend on Fri Aug 28, 2015 8:24 pm

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.

ktownsend
 
Posts: 1302
Joined: Thu Nov 05, 2009 2:18 am

Re: BME280 on the Raspberry Pi

by gm8arv on Fri Aug 28, 2015 11:42 pm

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.

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

Re: BME280 on the Raspberry Pi

by rexmarinus on Mon Oct 05, 2015 1:56 pm

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!

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

Please be positive and constructive with your questions and comments.