I2c not working

I have a SHT31 temp/humidity sensor attached to the i2c pins of a raspberrypi. I enabled the i2c interface in Raspi-config, and added the “dtparam=i2c_arm=on” line to /boot/config.txt as per the docs. I wrote a simple app to publish the sensor readings to the console. The data is published, but there is no data (nan) from the sensor. The sensor works with a photon but not with the i2c on the pi.

Did you reboot the raspberry pi?

I have at least 10 pi’s, not my first rodeo. I have two pi3’s connected to Particle both do the same thing. If you install Particle-agent the i2c shuts down. Use i2c-tools to see the sensor connected and its gone. i2c-tools that normally takes milliseconds to scan the buss, it takes minutes after agent is installed, and it doesn’t see the sensor. Remove (apt-get remove Particle-agent) (and reboot) and i2c is back to normal.

1 Like

Thanks for reporting this. I’m going to investigate I2C this week.

Captured as an issue, here:

I started implementing support for I2C in the Particle firmware on Raspberry Pi.

The issue you saw with i2cdetect is due to the SCL and SDA being changed to inputs when the firmware starts. I’ve changed that behavior and now i2cdetect works again.

I will continue working on the implementation of the I2C functions and update the progress here. Until I finish a first draft it won’t be possible to use I2C from the firmware.

1 Like

I implemented I2C on the Raspberry Pi firmware.

Please give it a shot by reinstalling the agent, rebooting and reflashing your firmware.

bash <( curl -sL https://particle.io/install-pi )
# Accept all setup prompts to replace your firmware by Tinker
sudo reboot

From the Particle Web IDE, CLI or Dev, recompile your firmware and flash to your Pi.

I updated the firmware docs to show what’s supported:
https://docs.particle.io/reference/firmware/raspberry-pi/#wire-i2c-

2 Likes

Pi3 now working nicely with a sht31 temp/humdity sensor and the Adafruit sht31 library. Thanks for the quick work! Now how do I get the data to the pi for tracking?

1 Like

Can you clarify what you mean?

My goal is to get this sensor data and other photon data subscribed to into a mySQL database on the Pi. I don’t think we are near that yet but that is the goal!

1 Like