# I2c not working

**URL:** <https://community.particle.io/t/i2c-not-working/27509>\
**Category:** Raspberry Pi\
**Created:** [November 25, 2016, 4:54pm UTC](https://community.particle.io/t/i2c-not-working/27509 "2016-11-25T16:54:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcomeau](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rcomeau/32/7593_2.png) [@rcomeau](https://community.particle.io/u/rcomeau)\
**Post date:** [November 25, 2016, 4:54pm UTC](https://community.particle.io/t/i2c-not-working/27509/1 "2016-11-25T16:54:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [November 27, 2016, 2:17am UTC](https://community.particle.io/t/i2c-not-working/27509/2 "2016-11-27T02:17:55Z")

</div>

Did you reboot the raspberry pi?

---

<div class="post-metadata">

**Author:** ![rcomeau](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rcomeau/32/7593_2.png) [@rcomeau](https://community.particle.io/u/rcomeau)\
**Post date:** [November 27, 2016, 5:15am UTC](https://community.particle.io/t/i2c-not-working/27509/3 "2016-11-27T05:15:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [November 28, 2016, 4:16pm UTC](https://community.particle.io/t/i2c-not-working/27509/4 "2016-11-28T16:16:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![will](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/will/32/23374_2.png) [@will](https://community.particle.io/u/will)\
**Post date:** [November 28, 2016, 8:31pm UTC](https://community.particle.io/t/i2c-not-working/27509/5 "2016-11-28T20:31:31Z")

</div>

Captured as an issue, here:

> <https://github.com/particle-iot/particle-agent/issues/1>

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [November 28, 2016, 11:00pm UTC](https://community.particle.io/t/i2c-not-working/27509/6 "2016-11-28T23:00:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [November 29, 2016, 10:15pm UTC](https://community.particle.io/t/i2c-not-working/27509/7 "2016-11-29T22:15:29Z")

</div>

I implemented I2C on the Raspberry Pi firmware.

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

```auto
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-](https://docs.particle.io/reference/firmware/raspberry-pi/#wire-i2c-)

---

<div class="post-metadata">

**Author:** ![rcomeau](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rcomeau/32/7593_2.png) [@rcomeau](https://community.particle.io/u/rcomeau)\
**Post date:** [November 30, 2016, 4:07pm UTC](https://community.particle.io/t/i2c-not-working/27509/8 "2016-11-30T16:07:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [November 30, 2016, 4:40pm UTC](https://community.particle.io/t/i2c-not-working/27509/9 "2016-11-30T16:40:57Z")

</div>

> [@rcomeau](#):
>
> Now how do I get the data to the pi for tracking?

Can you clarify what you mean?

---

<div class="post-metadata">

**Author:** ![rcomeau](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rcomeau/32/7593_2.png) [@rcomeau](https://community.particle.io/u/rcomeau)\
**Post date:** [November 30, 2016, 5:09pm UTC](https://community.particle.io/t/i2c-not-working/27509/10 "2016-11-30T17:09:12Z")

</div>

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!
