Meteorological visibility from a sensor?

I have the same result (sensor reading - 1037.5°C) … Have you found a solution? P.S. - I use updated files from github.

No, I have given up on that sensor.
I waited for the other sensor I bought but I believe I’m not going to get it.

As just mentioned on the GitHub issue you reported, this temperature value was derived from value 0xFFFF from the sensor. Could indicate a wiring issue. Please also note that there appear to be 3V and 5V versions of this sensor.

I have 2 of these sensors and they currently appear to be working fine and report very reasonable temperatures. Originally I had issues with out-of-range values, hence implemented that small improvement in the custom code to discard those values, but in those cases the sensor was reporting those values just right after starting up for a few minutes, not constantly.

As I am not yet understanding all scripts especially the low level parts I had to stick to trial and error and tried other libraries and replacements of all kinds and it did not work. Also changing the frequency did not solve it and changing the address (as proposed in other sensors libraries) didnt help.

But then found something that fixed it immediately and now is stable for thousands of readings (one per second since last eventing):

  double ambient_temperature = mlx.readAmbientTempC();
  double object_temperature = mlx.readObjectTempC();

I do two readings shortly after each other by just duplicating the first line and creating a dummy variable to feed into. That solved it for the ambient temp.

double dummy = mlx.readAmbientTempC();

After that the object temp started to fail. So I did the same for that line (double it and first reading to dummy2).

double dummy2 = mlx.readObjectTempC();

This solved it for me by dropping the first reading then only using the second one. Not sure of the root cause (and if I knew about these things a nice solution could be found) but it works here.

1 Like

Dear exxamalte,

Can you share the connection diagram betwwen ESP and the sensor?, and where is defined the pins for SCL and SDA?.

Thanks in advance,

Jose

Sure, this is how I wired up a Lolin D1 Mini Pro with a MLX90614 module:

  • Sensor VIN → ESP 5V (3.3V works as well)
  • Sensor GND → ESP GND
  • Sensor SCL → ESP GPIO5 (D1)
  • Sensor SDA → ESP GPIO4 (D2)

Unfortunately I don’t have that ESP module nor the MLX90614 as Fritzing parts, but I found a diagram that is very close to how my wiring looks like:

If you use the ESP’s standard I2C pins then you don’t need to actually define the pins in the ESPHome configuration.

Thanks exxamalte, it’s working ok now.

1 Like