OpenHABian i2c

Over the weekend (1/28/17) I upgraded from Raspian and Openhab2 Snapshot to Openhabian and the first release of Openhab2.

Unfortunately, when I booted into Openhabian, I can’t seem to get the I2C bus to work correctly. I have followed the standard config of installing i2c-tools and making sure nothing is blacklisted. I ran Raspi-config to enable I2C on the device. I even tried giving the user Openhab complete authority in the Sudoers file.

However, when I run i2cdetect, I have no ID being sent back from the 23017 chip. The voltages all look good on the chip but it doesn’t seem to want to respond.

Is there something that has been removed from the original Raspian that would cripple the I2C bus?

Thanks,

I have the same problem

Looks like in Openhabian I2C support was striped

I2C module is running, checked with this command

[19:14:44] openhabian@openHABianPi:~$ lsmod | grep i2c_

i2c_dev           6788  0
i2c_bcm2708   5930  0

[19:14:44] openhabian@openHABianPi:~$ sudo i2cdetect -y 1

Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

Maybe little late, but I had same problem, probably you need to add the modules.

E.g. as written on:

For Raspi3 I added i2c-bcm2835

This worked for me on a Raspi 3.

openhabian@openhab:~$ sudo apt-get update
openhabian@openhab:~$ sudo apt-get install i2c-tools libi2c-dev python-smbus
openhabian@openhab:~$ sudo vi /etc/modules
    add these two lines:
        i2c-dev
        i2c-bcm2835		# this of for Raspi 3
openhabian@openhab:~$ sudo nano /boot/config.txt
    add/uncomment these two lines:
        dtparam=i1c_arm=on
        dtparam=i2c1=on

openhabian@openhab:~$ sudo reboot
openhabian@openhab:~$ sudo i2cdetect -y 1

Hello @edmund-troche - thanks for your reply
In your code it should be be dtparam=i2c_arm=on instead of dtparam=i1c_arm=on

This did work for me with openHAB 2.5.0~S1558-1 (Build #1558).
however I had to get raspi-config installed first and enable i2c there.
as described here https://community.openhab.org/t/solved-openhabian-config-enable-i2c/30009

i can test, whether i2c is activated with the follwoing line ls /dev/*i2c* - and get /dev/i2c-1 as result = success :slight_smile:

Now I just need to get my MPU 6050 working, this thingy is still not detected - :frowning:

UPDATE - this works now as well - had one pin wrongly connected!

Good to hear you have this working. The procedure I listed above worked for me at the time, unfortunately I forgot to include the versions, maybe the version you are using behaves slightly different. I’m not using a Raspi anymore, otherwise I’d check and include more details here. Either way, between what worked for me before and what you figured out in your version [openHAB 2.5.0~S1558-1 (Build #1558)] others may be able to get this working as well.

1 Like

For anyone looking to enable i2c on modern OpenHABian (1.7.3) on raspberry pi 4 (probably same on 3 though).
@edmund-troche’s solution still works, but now you only need to do two things.

add the following two lines to /etc/modules
  i2c-dev
  i2c-bcm2835 # this is the same for raspi 3 & 4.

add/uncomment these two lines in /boot/config.txt
  dtparam=i1c_arm=on
  dtparam=i2c1=on

reboot and i2c is up and working :slight_smile:

1 Like