No i2c found in /dev/

Hi there!

I’m trying to get sense-hat to work on my raspberry pi 3B running osmc v2018.06-1, but there is no i2c in /dev/ and therefore it doesn’t work.

I already found this link OSMC's May update broke I2C, but updating to the latest version did not help.

Any ideas? :slight_smile:

Thanks in advance!

That was May 2017, so I am not sure it’s relevant.
Some logs might help.

What logs do you need?

osmc@osmc:~/sensehat$ python temp.py
Traceback (most recent call last):
  File "temp.py", line 2, in <module>
    sense = SenseHat()
  File "/usr/lib/python2.7/dist-packages/sense_hat/sense_hat.py", line 42, in __init__
    raise OSError('Cannot access I2C. Please ensure I2C is enabled in raspi-config')
OSError: Cannot access I2C. Please ensure I2C is enabled in raspi-config

Where line 42 looks like this:

if not glob.glob('/dev/i2c*'):
        raise OSError('Cannot access I2C. Please ensure I2C is enabled in raspi-config') 

from python-sense-hat/sense_hat.py at master · astro-pi/python-sense-hat · GitHub

1 Like

There you go: https://paste.osmc.tv/atowuzevul :slight_smile:

This is what I did after rebooting:

osmc@osmc:~$ python sensehat/temp.py
Traceback (most recent call last):
  File "sensehat/temp.py", line 2, in <module>
    sense = SenseHat()
  File "/usr/lib/python2.7/dist-packages/sense_hat/sense_hat.py", line 42, in __init__
    raise OSError('Cannot access I2C. Please ensure I2C is enabled in raspi-config')
OSError: Cannot access I2C. Please ensure I2C is enabled in raspi-config
osmc@osmc:~$ grab-logs -A
Logs successfully uploaded.
Logs available at https://paste.osmc.tv/atowuzevul

With a Device Tree, the kernel will automatically search for and load modules that support the indicated enabled devices. As a result, by creating an appropriate DT overlay for a device you save users of the device from having to edit /etc/modules; all of the configuration goes in config.txt, and in the case of a HAT, even that step is unnecessary. Note, however, that layered modules such as i2c-dev still need to be loaded explicitly.

So add the line i2c-dev to file /etc/modules and reboot.

2 Likes

Thanks!

This solved my problem! :slight_smile: