theweissguy
Posts: 11
Joined: Sun May 08, 2016 4:55 pm

BME280 module

Sun Jul 10, 2016 12:46 am

I'm trying to run a BME280 (IC2) on a PI3. The IC2 connection checks out so hardware looks ok. Attempting to run the Arduino eample:

#!/usr/bin/python
from Adafruit_BME280 import *
sensor = BME280(mode=BME280_OSAMPLE_8)
degrees = sensor.read_temperature()
pascals = sensor.read_pressure()
hectopascals = pascals / 100
humidity = sensor.read_humidity()
print 'Timestamp = {0:0.3f}'.format(sensor.t_fine)
print 'Temp = {0:0.3f} deg C'.format(degrees)
print 'Pressure = {0:0.2f} hPa'.format(hectopascals)
print 'Humidity = {0:0.2f} %'.format(humidity)

generates an import error "No module named Adafruit_BME280". I've followed the Arduino instructions for the GPIO and BME280 downloads/install but the results don't seem to make sense. Has anyone run this program successfully? If so how do I install the correct modules/libraries?
___________________
theweissguy

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: BME280 module

Sun Jul 10, 2016 11:28 am

generates an import error "No module named Adafruit_BME280".
Your script cannot find the Adafruit python module.
Did you download the module from https://github.com/adafruit/Adafruit_Python_BME280?
If so, can the script find it.

The easiest would be to copy the module to the same directory as your script

theweissguy
Posts: 11
Joined: Sun May 08, 2016 4:55 pm

Re: BME280 module

Sun Jul 10, 2016 4:16 pm

Did the download, installed the unzipped files. Ran the program in the installed directory/sub-directories. Same error. Do you actually have this working? If so what is your directory structure and content that contains the working Adafruit_BME280_Example.py?
___________________
theweissguy

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: BME280 module

Sun Jul 10, 2016 4:28 pm

theweissguy wrote:Did the download, installed the unzipped files. Ran the program in the installed directory/sub-directories. Same error. Do you actually have this working? If so what is your directory structure and content that contains the working Adafruit_BME280_Example.py?
No, I don't have it working (don't have a BME280), but I have a fairly good idea how Python looks for modules (understatment alert ;) )
What files are in the directory fro where you run your script (is it actually the Adafruit example script you try to run)?

BTW: you mention the Arduino instructions, but I hope you realise you're trying to use Python code that is meant to run on a computer (Pi) that has the BME280 directly connected. No Arduino in sight there.
Have you followed the instructions from https://github.com/adafruit/Adafruit_Python_BME280?

theweissguy
Posts: 11
Joined: Sun May 08, 2016 4:55 pm

Re: BME280 module

Sun Jul 10, 2016 5:50 pm

Yes I've followed their instructions, ambiguous though they are - e.g., " run the following command from this folder:
python Adafruit_BME280_Example.py". The folder is never specified hence I've tried many possibilities and none work.
___________________
theweissguy

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: BME280 module

Sun Jul 10, 2016 6:19 pm

theweissguy wrote:Yes I've followed their instructions, ambiguous though they are - e.g., " run the following command from this folder:
python Adafruit_BME280_Example.py". The folder is never specified hence I've tried many possibilities and none work.
cd to the directory where the py files are stored and execute the command.

theweissguy
Posts: 11
Joined: Sun May 08, 2016 4:55 pm

Re: BME280 module

Sun Jul 10, 2016 9:15 pm

Doesn't work -

Anyone else?
___________________
theweissguy

User avatar
Douglas6
Posts: 4860
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: BME280 module

Sun Jul 10, 2016 9:43 pm

Gee, I can't wait to get kindly responses like that, for taking my time to help a stranger.

Oh, wait. Yes I can.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: BME280 module

Sun Jul 10, 2016 10:04 pm

theweissguy wrote:Doesn't work -

Anyone else?
I intended to help you solve the problem but apparently my input is not appreciated.
Good luck and goodbye.

theweissguy
Posts: 11
Joined: Sun May 08, 2016 4:55 pm

Re: BME280 module

Mon Jul 11, 2016 6:51 pm

Sorry you feel this way - thanks for trying but you didn't solve my problem. Best that I can tell from internet searching is a rather laborious process of running an Arduino simulation on the PI and converting the BME280test.ino to run on the PI (https://robidouille.wordpress.com/2013/ ... pberry-pi/). Trying it later.
___________________
theweissguy

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: BME280 module

Mon Jul 11, 2016 7:12 pm

theweissguy wrote:Best that I can tell from internet searching is a rather laborious process of running an Arduino simulation on the PI and converting the BME280test.ino to run on the PI
:lol: :lol: :lol:
you should spend your time learning how to search internet
it would be much better spent than this sort of topics.

PS: my BME280 is working like a charm.

theweissguy
Posts: 11
Joined: Sun May 08, 2016 4:55 pm

Re: BME280 module

Mon Jul 11, 2016 9:18 pm

"PS: my BME280 is working like a charm."
Care to share details?
___________________
theweissguy

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: BME280 module

Tue Jul 12, 2016 9:26 pm

theweissguy wrote:"PS: my BME280 is working like a charm."
Care to share details?
Even the crappy forum search finds lots of stuff about BME280s

search.php?keywords=BME280
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Troubleshooting”