# Photon i2c issues - ADS1115 influence SSD1306

**URL:** <https://community.particle.io/t/photon-i2c-issues-ads1115-influence-ssd1306/35313>\
**Category:** Troubleshooting\
**Created:** [August 14, 2017, 9:57am UTC](https://community.particle.io/t/photon-i2c-issues-ads1115-influence-ssd1306/35313 "2017-08-14T09:57:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![r-morgenstern](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@r-morgenstern](https://community.particle.io/u/r-morgenstern)\
**Post date:** [August 14, 2017, 9:57am UTC](https://community.particle.io/t/photon-i2c-issues-ads1115-influence-ssd1306/35313/1 "2017-08-14T09:57:10Z")

</div>

Dear Community,

in my setup I have a SSD1306 OLED display and an ADS1115 4-channel Analog Digital Converter working on i2c. Each for it self works properly. When I bring both together the display messes up and die ADC values get worse.

 ![](https://us1.discourse-cdn.com/flex026/uploads/particle/original/2X/5/5e4329d9d7bff25d960772abb9ddd56f5d5cbc45.jpg)

For both I’m using the libraries provided by the Particle IDE. They are also on different addresses OLED on 0x3C and ADC on 0x48;

Any idea where to start trouble shooting?

---

<div class="post-metadata">

**Author:** ![r-morgenstern](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@r-morgenstern](https://community.particle.io/u/r-morgenstern)\
**Post date:** [August 14, 2017, 5:30pm UTC](https://community.particle.io/t/photon-i2c-issues-ads1115-influence-ssd1306/35313/2 "2017-08-14T17:30:33Z")

</div>

I did some tests and it seams the issue relates to a software timer. The timer is used to measure every second a voltage by the ADS1115.

Any thoughts on that?

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 14, 2017, 5:45pm UTC](https://community.particle.io/t/photon-i2c-issues-ads1115-influence-ssd1306/35313/3 "2017-08-14T17:45:24Z")

</div>

@r-morgenstern, software timers are like interrupt service routines. The issue is that the I2C peripheral is unique and if the timer fires during an I2C transaction to the display, it will “clobber” that transaction while doing the ADS1115 transaction. You have two choices:

1. Set/reset a global “mutex” (mutual exclusivity) flag every time the timer or the display code interacts with the I2C. Check the flag prior to any I2C transaction and skip if the flag is set.

2. Use a non-blocking timer (using millis()) in loop() or set a flag in the software timer that you can sample in loop(). When it is set, do the ADC sampling.

I suggest the second choice since it is simple and easy to implement. 😉

---

<div class="post-metadata">

**Author:** ![r-morgenstern](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@r-morgenstern](https://community.particle.io/u/r-morgenstern)\
**Post date:** [August 14, 2017, 6:41pm UTC](https://community.particle.io/t/photon-i2c-issues-ads1115-influence-ssd1306/35313/4 "2017-08-14T18:41:04Z")

</div>

@peekay123 Thank you. I did your second suggestions. It works perfect now and timing seams also ok without timer!

---

<div class="post-metadata">

**Author:** ![AL64](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AL64](https://community.particle.io/u/AL64)\
**Post date:** [July 1, 2024, 6:50am UTC](https://community.particle.io/t/photon-i2c-issues-ads1115-influence-ssd1306/35313/5 "2024-07-01T06:50:40Z")

</div>

Hi could be possible to get the code? I met the same issue. Thank you
