Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Traceback (most recent call last): Adafruit BME 280 Sensor

I have succesfully installed Adafruit_Gpio package and when i try to run the example file of the bme sensor provided by adafruit, i get the following error:

  Traceback (most recent call last):
  File "/home/rpi3/Adafruit_Python_BME280/example.py", line 3, in <module>
    sensor = BME280(mode=BME280_OSAMPLE_8)
  File "/home/rpi3/Adafruit_Python_BME280/Adafruit_BME280.py", line 88, in __init__
    self._device = i2c.get_i2c_device(address, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_GPIO-1.0.3-py3.5.egg/Adafruit_GPIO/I2C.py", line 64, in get_i2c_device
    return Device(address, busnum, i2c_interface, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_GPIO-1.0.3-py3.5.egg/Adafruit_GPIO/I2C.py", line 97, in __init__
    self._bus = Adafruit_PureIO.smbus.SMBus(busnum)
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_PureIO/smbus.py", line 97, in __init__
    self.open(bus)
  File "/usr/local/lib/python3.5/dist-packages/Adafruit_PureIO/smbus.py", line 122, in open
    self._device = open('/dev/i2c-{0}'.format(bus), 'r+b', buffering=0)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/i2c-1'

I am on xubuntu for rpi-3 i have run apt-get udpate and restarted the machine neither worked.

like image 624
Stavros Avramidis Avatar asked May 23 '17 05:05

Stavros Avramidis


1 Answers

I found the solution with a little help form the comments. Especially for xubuntu the steps are:

sudo raspi-config

Select:

3 Interfacing Options

Select:

P4 I2C

and YES

like image 190
Stavros Avramidis Avatar answered Nov 04 '22 17:11

Stavros Avramidis