arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.18k stars 4.81k forks source link

MLX90614 shows only -999 obj temp #6825

Closed Failx92 closed 4 years ago

Failx92 commented 5 years ago

BUG DESCRIPTION

I connect a MLX90614 Sensor but it shows only -999 degree object temp but for the ambient temp it shows the right temp.

I tried serveral sensors and serveral node mcu boards but the issue is the same. I compiled the 6.6 version and the new 6.7 release.

REQUESTED INFORMATION

FAILURE TO COMPLETE THE REQUESTED INFORMATION WILL RESULT IN YOUR ISSUE BEING CLOSED

13:53:30 RSL: empfangenes topic /Backlog, Datengröße 22, Daten Template; Module; GPIO 13:53:30 RSL: Gruppe 0, Index 1, Befehl BACKLOG, Daten Template; Module; GPIO 13:53:30 SRC: Backlog 13:53:30 RSL: empfangenes topic /Template, Datengröße 0, Daten 13:53:30 RSL: Gruppe 0, Index 1, Befehl TEMPLATE, Daten 13:53:30 MQT: stat/nodemcu_v2/RESULT = {"NAME":"Generic","GPIO":[255,255,255,255,255,255,255,255,255,255,255,255,255],"FLAG":15,"BASE":18} 13:53:31 SRC: Backlog 13:53:31 RSL: empfangenes topic /Module, Datengröße 0, Daten 13:53:31 RSL: Gruppe 0, Index 1, Befehl MODULE, Daten 13:53:31 MQT: stat/nodemcu_v2/RESULT = {"Module":"18 (Generic)"} 13:53:31 SRC: Backlog 13:53:31 RSL: empfangenes topic /GPIO, Datengröße 0, Daten 13:53:31 RSL: Gruppe 0, Index 1, Befehl GPIO, Daten 13:53:31 MQT: stat/nodemcu_v2/RESULT = {"GPIO0":"5 (I2C SCL)","GPIO1":"0 (None)","GPIO2":"6 (I2C SDA)","GPIO3":"0 (None)","GPIO4":"0 (None)","GPIO5":"0 (None)","GPIO12":"0 (None)","GPIO13":"0 (None)","GPIO14":"0 (None)","GPIO15":"0 (None)","GPIO16":"0 (None)"}

EXPECTED BEHAVIOUR

Help to get the sensor to work.

ascillato commented 5 years ago

Hi, you are using Tasmota 6.6.0 that is quite old and core 2.5.2 that it is known to be buggy.

Please, update to latest Tasmota with core pre2.6.0. Thanks.

Failx92 commented 5 years ago

Hi, I posted the outputs from Version 6.6 thats true but I wrote I tried it with Version 6.7 also. Today I tried Dev Version 7.0 but the result is the same object temp keeps at -999.0

Failx92 commented 5 years ago

Hi, I tested my MLX90614 sensors with the adafruit library MLX60914, they works fine so I can rule out a hardware issue.

ascillato2 commented 5 years ago

@gemu2015

Please, can you take a look at this?

gemu2015 commented 5 years ago

i have only one mlx90614 but it works fine. the code is pretty small and the only code difference is that adafruit ignores the error bit which causes the -999 reading in Tasmota. i don't see what should cause the error bit to be set. i2c address conflict ??

you may simply remove the error check the error bit is in the MSB of the raw data

uint16_t uval=read_irtmp(1); if (uval&0x8000) { // error bit set // obj_temp=-999; uval&=0x7fff; obj_temp=((float)uval*0.02)-273.15;

} else { obj_temp=((float)uval*0.02)-273.15; }

ascillato2 commented 5 years ago

@Failx92

Hi, any news on this?

ascillato2 commented 4 years ago

@Failx92

Hi, when you have time, please tell us if this fix solved your issue. Thanks

Failx92 commented 4 years ago

Hello Again, sorry for late reply I was busy.

No sorry it don't work after I changed the code to the comment from gemu2015 it show all the time 382.2 degree.

Regards Failx92

gemu2015 commented 4 years ago

@Failx92 that's what i expected. the error bit is set. did you ensure that there is no i2c address conflict? MPR121 and CCS811 must be undefined because they use the same address.

i personally #undefine all unused sensors and features to save space and avoid conflicts.

Failx92 commented 4 years ago

@gemu2015 how do I do that?

MPR121 and CCS811 are undefined by default I changed nothing at this point, I only defined mlx90614

arendst commented 4 years ago

What is the output of command I2cscan?

arendst commented 4 years ago

What is the output of command I2cDriver?

Failx92 commented 4 years ago

Hello,

11:11:22 CMD: i2cscan 11:11:22 RSL: stat/nodemcu_v2.7.0/RESULT = {"I2CScan":"Device(s) found at 0x5a"} 11:11:40 CMD: i2cDriver 11:11:40 RSL: stat/nodemcu_v2.7.0/RESULT = {"I2CDriver":"7,8,9,10,11,15,20,32"}

gemu2015 commented 4 years ago

@arendst i can confirm that mlx90614 is broken on the last dev version. (just compiled default setup) my fork is still at 6.7.0 and works.

i am short of time and right now can't check what's changed between 6.7.0 and current.

only couple of calls used ???

arendst commented 4 years ago

I'll have a look but cannot test as I don't have a MLX90614 device.

gemu2015 commented 4 years ago

@arendst ok reverified with 6.7.0 and my user config disabled and mlx fails also! there must be an interference with another driver.

sorry i must leave now

@Failx92 here are my undefines in case you want to try.

undef USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0

undef USE_DISPLAY_LCD

undef USE_DISPLAY_MATRIX

undef USE_LM75AD

undef USE_SHT // Add I2C emulating code for SHT1X sensor (+1k4 code)

undef USE_HTU // Add I2C code for HTU21/SI7013/SI7020/SI7021 sensor (+1k5 code)

undef USE_BME680 // Add additional support for BME680 sensor using Adafruit Sensor and BME680 libraries (+6k code)

undef USE_BH1750

undef USE_MHZ19

undef USE_SENSEAIR

undef USE_PMS5003

undef USE_IR_RECEIVE

undef USE_WS2812

undef USE_ARILUX_RF

undef USE_NOVA_SDS

undef USE_ENERGY_SENSOR

undef USE_DOMOTICZ

undef USE_HOME_ASSISTANT

undef USE_DISCOVERY

undef USE_DS18x20

undef USE_SERIAL_BRIDGE

undef USE_PZEM004T

undef USE_SHT3X

undef USE_SGP30

undef USE_SPS0

undef USE_SCD30

undef USE_MLX90614

undef USE_PZEM2

undef USE_RF_FLASH

undef USE_APDS9960

undef USE_ADE7953

undef USE_EMULATION_HUE

undef USE_EMULATION_WEMO

undef USE_DHT

//#undef USE_COUNTER

undef USE_TX20_WIND_SENSOR

undef USE_IR_REMOTE

undef USE_KNX

undef USE_HOME_ASSISTANT

undef USE_PCA9685

undef USE_TUYA_DIMMER

undef USE_RC_SWITCH

undef USE_ARMTRONIX_DIMMERS

undef USE_PS_16_DZ

undef USE_SONOFF_IFAN

undef USE_EMULATION_HUE

undef USE_LIGHT

undef USE_EMULATION

undef USE_HX711

undef USE_CSE7766

undef USE_SR04

undef USE_DS18x20

undef USE_DS18B20

undef USE_DS18x20_LEGACY

undef USE_BMP

undef USE_DS1820

undef USE_PZEM004T

undef USE_PZEM_AC

undef USE_PZEM_DC

undef USE_TIMERS

undef USE_TIMERS_WEBINTERFACE

gemu2015 commented 4 years ago

@arendst

by disabling all other i2c sensors and selectively enabling i found SEVERAL dependencies. (i only testest those by default enabled i2c drivers)

  1. switching all others off MLX works
  2. USE_SHT,USE_HTU,USE_SHT3X,USE_ADE7953 don't harm
  3. USE_BMP disables MLX completely ???
  4. USE_LM75AD causes error -999

the mlx driver is extremely easy and i don't see why it shouldn't work and what causes the interferences

probably we should be able to disable drivers by command

arendst commented 4 years ago

Disable/enable i2c drivers using command i2cdriver is available now using I2CDEVICES.md

Failx92 commented 4 years ago

@gemu2015 I tried the disabling but it dont work for me, the sensor isn't recognized but with i2cscan I see the device at 0x5a.

I used the 7.0 dev version and activate the BMP and DS18x20

I'm busy this week, my next tries are on the weekend.

gemu2015 commented 4 years ago

@arendst a nice, i missed that because i was busy with other things. still no idea what's going wrong here

@Failx92 so you simply compile with mlx enabled and then disable one i2c driver after the other until it works.

at least disable these two

i2cdriver10 0 i2cdriver20 0

ascillato2 commented 4 years ago

@Failx92

Hi, any news on this? Could you test with latest version and @gemu2015's suggestions?

ascillato2 commented 4 years ago

@Failx92

Hi, any news on this? Could you test with latest version and @gemu2015's suggestions?

ascillato commented 4 years ago

@Failx92

Hi, any news on this? Could you test with latest version and @gemu2015's suggestions?

Failx92 commented 4 years ago

Hello,

Sorry for my late reply, I try the latest version tomorrow.

Staars commented 4 years ago

Okay, joining the party now :)

I can confirm that:

at least disable these two

i2cdriver10 0

i2cdriver20 0

Bildschirmfoto 2019-11-23 um 15 42 58

This is a self compiled firmware with build target "tasmota" and uncommenting #define USE_MLX90614.

I will try to dig a little bit.

Staars commented 4 years ago

This is more complex, than I expected. The sensor normally needs this special restart message after transmission, but at the moment it happily reads without this, which is unexpected for me. (I already turned the reading routine upside-down for testing). I need more time for this, as (virtually) all driver combinations must be checked. Even then it might result in coincidence.

Staars commented 4 years ago

@Failx92

Are you able to compile and test this? https://github.com/arendst/Tasmota/pull/7022

ascillato2 commented 4 years ago

Fix merged.

@Failx92

Please, can you test latest codebase and confirm if your issue is solved? Thanks

Failx92 commented 4 years ago

Hello,

issue is solved. Thanks.

Karl-opec commented 4 years ago

Just for Info:

I tried today e self compiled version 9.0.0.2 with "platformio run -e tasmota-sensors " and enabled MLX90614 I got -999 OBJ Temp.

with i2cdriver10 0 i2cdriver20 0

I Got a correct Reading.

The first Reading after Boot is also correct, before it changed to -999

Edit: Sorry shortly thereafter -999 Reading reapeared {"I2CDriver":"3,4,5,7,8,9,!10,11,12,13,14,15,16,17,18,!20,24,29,32,36,41,42,44,46,47,48"}

I compiled new "platformio run -e tasmota " and expliced ennabled the i2c driver i wanted it worked. this ist now i2cdriver: {"I2CDriver":"3,4,5,7,11,15,32,47,48"} so there must be some issues left.

NickyNL commented 1 year ago

A few years later, running into a similar issue with OBJ temp -999 while the AMB temp is working. I am trying it with the latest tasmota release (13.2.0). Can`t get older versions to work properly yet in gitpod otherwise I would have tried 6.7.0 as that sounded like it worked in the past.

My I2Cscan does find the device; {"I2CScan":"Device(s) found at 0x5a"} My I2Cdriver usually only shows this; {"I2CDriver":"7,32"}

Does anybody have a version that still works with the MLX90614?

ghost commented 12 months ago

**quote NickyNL

A few years later, running into a similar issue with OBJ temp -999 while the AMB temp is working. I am trying it with the latest tasmota release (13.2.0). Can`t get older versions to work properly yet in gitpod otherwise I would have tried 6.7.0 as that sounded like it worked in the past.

My I2Cscan does find the device; {"I2CScan":"Device(s) found at 0x5a"} My I2Cdriver usually only shows this; {"I2CDriver":"7,32"}

Does anybody have a version that still works with the MLX90614?** @ESP32 it Work: Screenshot 2023-11-08 at 22-43-33 Tasmota - Main Menu

@ESP8266 12E I got also -999 and CRC errors. The only workarroud was to use the old Method to readout the MLX90614 . This should work without CRC .

I changed something back into the xsns_46_MLX90614.ino void MLX90614_Every_Second(void) void MLX90614_Every_Second(void) { //mlx90614.i2c_buf = I2cRead24(I2_ADR_IRT, MLX90614_TOBJ1); //Enable <---------- mlx90614.value = MLX90614_read16(I2_ADR_IRT, MLX90614_TOBJ1); //Disable <------- if (mlx90614.value & 0x8000) { mlx90614.obj_temp = -999; } else { mlx90614.obj_temp = ((float)mlx90614.value 0.02f) - 273.15f; } //mlx90614.i2c_buf = I2cRead24(I2_ADR_IRT,MLX90614_TA); //enable <--------- mlx90614.value = MLX90614_read16(I2_ADR_IRT, MLX90614_TA); //Disable <-------- if (mlx90614.value & 0x8000) { mlx90614.amb_temp = -999; } else { mlx90614.amb_temp = ((float)mlx90614.value 0.02f) - 273.15f; } }

Till now there are still bugs inside. The console shows many sensor timeouts and the Thermostat driver do not detect the sensor values at the moment. "Current Temperature = 0°C" I would create an IR-Thermostat but no luck. With BMP180 and DS18B20 it work.

I don't know why it work for him:

quote from Christian Baars "Finally found my sensor and tested it with ESP8266 and ESP32-C3. Both work with the current driver for me too.

@Solar320 I fear you have a non-optimal hardware setup, as you see the check of a potential error condition - sadly revealing an error. If you leave out the CRC check (like in the old Tasmota driver or Adafruits library example), then everything seems to work, but in fact it does not. Even consistent wrong values that look plausible are wrong.

ghost commented 12 months ago

@ Christian Baars OK, I found mysterious things. I am now relativ sure that your code has nothing to do with this CRC errors.

Today I tested again this ESP8266-12E without or with very few CRC errors. I do not change something, I only restart this device. Also I saw that this Obj Temp was jumping up and down 3 Kelvin alle the time. (Sensor was not moved and was directed away from me.)

The Oszilloskop do not bring any news, the voltage spikes at 3,3v were arround +-10mV Then I Tested an ESP8266-MOD, again with only +-10mV at 3,3V. But the big difference is that the ObjTemp and AMBTemp are stable now, no jumping arround and only <1K difference between the two values. (Same Sensor, same cableconnectors!) I will make an test over night to confirm this. May be an bug of this ESP 12E Modul.........