Giter Site home page Giter Site logo

Attribute Error about bme280 HOT 3 OPEN

H60gh avatar H60gh commented on July 19, 2024
Attribute Error

from bme280.

Comments (3)

kbrownlees avatar kbrownlees commented on July 19, 2024

There should of been a warning like

smbus is not available, you will not be able to use i2c

If so you need to follow the instructions in the README, mainly:

For I2C access you must have the 'smbus' package available - for debian based systems install python-smbus. If you wish to compile it, the package required is smbus-cffi (https://pypi.python.org/pypi/smbus-cffi/)

from bme280.

H60gh avatar H60gh commented on July 19, 2024

Thank you kbrownlees
I am using Raspberry pi 3 board with Rasbian and I have smbus 1.1 running on it and as I checked, I have the newest i2c library versions on it too. But still having the problems.
My python version is 3.4.2 and I have bme280 version 0.3 installed library too.

Also, when I run "pip install smbus-cffi", I recerive an error which it says " ... No distribution at all found for smbus-cffi ... "

Should I make more changes in Raspberry pi configuration?

from bme280.

Exscotticus avatar Exscotticus commented on July 19, 2024

I have two smbus-like libs installed, so not sure which one was needed...

pi@raspberrypi:~ $ pip3 search smbus
Adafruit-PureIO (0.2.1)  - Pure python (i.e. no native extensions) access to Linux
                           IO including I2C and SPI.  Drop in replacement for smbus
                           and spidev modules.
smbus-cffi (0.5.1)       - This Python module allows SMBus access through the I2C
                           /dev interface on Linux hosts. The host kernel must have
                           I2C support, I2C device interface support, and a bus
                           adapter driver.
  INSTALLED: 0.5.1 (latest)
pyblinkm (0.1.0)         - Drive a BlinkM with Python via I2C using python-smbus on
                           Raspberry Pi.
pysmbus (0.1)            - Pure Python implementation of the I2C SMBus protocol.
smbus2 (0.2.0)           - smbus2 is a drop-in replacement for smbus-cffi/smbus-
                           python in pure Python
  INSTALLED: 0.2.0 (latest)

And this seems to be the minimum Python needed to get a result...

pi@raspberrypi:~/$ python3
Python 3.5.3
Type "help", "copyright", "credits" or "license" for more information.
>>> from bme280 import bme280
>>> bme280.bme280_i2c.set_default_i2c_address(0x76)
>>> bme280.bme280_i2c.set_default_bus(1)
>>> bme280.setup()
>>> bme280.read_all()
Data(humidity=55.73471521799349, pressure=948.001722783354, temperature=11.319838337250985)

Hope this helps.

from bme280.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.