Problem wih Oled and MLX90614

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
SpasT
New user
Posts: 4
Joined: 06 Feb 2019, 11:14

Problem wih Oled and MLX90614

#1 Post by SpasT » 11 Aug 2020, 16:28

Hi . I made custom build using latest sources and included "P024_MLX90614" and 'P036_FrameOLED". Both using I2C bus. Upload to LiLon NodeMCU V3. Changed I2C clock speed to 100 kHz so MLX90614 can work correct.
Each of devices work OK , but when enable it together P024 stop reading temperature and show: 1037.5 grad C.
When I go to "Hardware" page and press "Submit" button -P024_MLX90614 start to read correct temperature until next restart of ESP8266 or when I make any changes to settings for OLED device.

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Problem wih Oled and MLX90614

#2 Post by Ath » 11 Aug 2020, 17:19

I hope you got the latest sources from github?

When using a Normal build of ESPEasy, both plugins P024 and P036 are included, so no need to make a custom build for that :o
Latest releases (compiled binaries and matching source code) can always be found here: https://github.com/letscontrolit/ESPEasy/releases

When checking the output from the I2C Scan, what devices are shown there?
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Problem wih Oled and MLX90614

#3 Post by TD-er » 11 Aug 2020, 21:15

I think the used library of the OLED does set the I2C frequency.

I will have a look at it to see if I can disable it and just focus on the set I2C clock frequency in the ESPEasy settings.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Problem wih Oled and MLX90614

#4 Post by ThomasB » 12 Aug 2020, 04:26

I think the used library of the OLED does set the I2C frequency.
Good catch. The MLX90614 is a low speed device (100KHz max). The OLED plugin is most likely initializing the i2c bus to the default 700KHz.

- Thomas

SpasT
New user
Posts: 4
Joined: 06 Feb 2019, 11:14

Re: Problem wih Oled and MLX90614

#5 Post by SpasT » 12 Aug 2020, 07:17

Ath wrote: 11 Aug 2020, 17:19 I hope you got the latest sources from github?

When using a Normal build of ESPEasy, both plugins P024 and P036 are included, so no need to make a custom build for that :o
Latest releases (compiled binaries and matching source code) can always be found here: https://github.com/letscontrolit/ESPEasy/releases

When checking the output from the I2C Scan, what devices are shown there?
It is my mistake ( at first time in the rush I didn't see plugin in normal build) .
I flashed with : ESP_Easy_mega_20200801_normal_ESP8266_4M1M and situation are identical with custom build. The same issue with readings. Thanks

SpasT
New user
Posts: 4
Joined: 06 Feb 2019, 11:14

Re: Problem wih Oled and MLX90614

#6 Post by SpasT » 12 Aug 2020, 08:38

ThomasB wrote: 12 Aug 2020, 04:26
I think the used library of the OLED does set the I2C frequency.
Good catch. The MLX90614 is a low speed device (100KHz max). The OLED plugin is most likely initializing the i2c bus to the default 700KHz.

- Thomas
Yes.. The I2C speed is defined in SSD1306Wire.h at line 52 : Wire.setClock(700000);
When I changed to Wire.setClock(100000); the issue is gone.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Problem wih Oled and MLX90614

#7 Post by TD-er » 12 Aug 2020, 11:16

So that line should be removed from the OLED library.
The 700 kHz was not possible on ESP82xx, so it was forced to 400 kHz anyway, but still a library should not set parameters for a shared bus.

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Problem wih Oled and MLX90614

#8 Post by Ath » 12 Aug 2020, 11:25

In that case there are a few ways to resolve this:
a) Remove the Wire.setClock(700000) setting and let it run at the configured speed (though that may influence the screen-update speed). It is only set on initial setup of the display. Already in PR #3208
or
b) Reset Wire.setClock(Settings.I2C_clockSpeed) after calling any function there
or
c) Set Wire.setClock(Settings.I2C_clockSpeed) before any PLUGIN_* call to an I2C device
or
d) Add a setting for each I2C device to configure a specific bus speed, and set it before calling that device (when > 0).
or
e) Add Wire.setClock(100000) in the MLX90614 plugin before every I2C call (could be an optional setting to force the bus speed to an acceptable value), and reset to Settings.I2C_clockSpeed after the call. (And maybe add the 'feature' to all I2C devices that are having bus-speed issues like this device)

what solution would be the most robust?

Edit: One vote for solution a) already :D
Last edited by Ath on 12 Aug 2020, 11:49, edited 2 times in total.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Problem wih Oled and MLX90614

#9 Post by TD-er » 12 Aug 2020, 11:27

I added a reminder for me on Github: https://github.com/letscontrolit/ESPEasy/issues/3207

User avatar
Ath
Normal user
Posts: 3418
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Problem wih Oled and MLX90614

#10 Post by Ath » 12 Aug 2020, 11:46

TD-er wrote: 12 Aug 2020, 11:27 I added a reminder for me on Github: https://github.com/letscontrolit/ESPEasy/issues/3207
And I PR'd https://github.com/letscontrolit/ESPEasy/pull/3208 to implement suggestion a) from my list above.

Other options are still viable, IMHO, but this one seems eminent.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests