Thermocouple temperature readings completely off when LED strip is turned on

I have built a new ESPHome based device that shows a strange behaviour and I was hoping to get my design validated:
I added a MAX31855 thermocouple sensor and an WS2813 LED strip (with 96 LEDs) to a NodeMCU ESP32 running ESPHome 1.14.3. When the lights are off, the temperature readings are normal, but when I turn on the lights, the temperature readings drop by 8-10ºC, and when I then turn on a light effect (e.g. rainbow) the temperature readings drop by about 50-150ºC.

MAX31855 configuration:

  clk_pin: GPIO18
  miso_pin: GPIO19

  - platform: max31855
    name: "Temperature"
    cs_pin: GPIO5
    update_interval: 15s
      - sliding_window_moving_average:
          window_size: 6
          send_every: 4

LED strip configuration:

  - platform: fastled_clockless
    name: "Lights"
    chipset: WS2813
    pin: GPIO33
    num_leds: 96
    rgb_order: GRB
    max_refresh_rate: 32ms
      - addressable_rainbow:
          name: Rainbow fast
          speed: 10

Log extract:

[18:50:22][D][max31855:080]: 'Temperature': Got temperature=20.8°C
[18:50:37][D][max31855:080]: 'Temperature': Got temperature=21.0°C
[18:50:52][D][max31855:080]: 'Temperature': Got temperature=20.2°C
[18:51:07][D][max31855:080]: 'Temperature': Got temperature=21.0°C
[18:51:07][D][sensor:092]: 'Temperature': Sending state 20.15000 °C with 1 decimals of accuracy
[18:51:22][D][max31855:080]: 'Temperature': Got temperature=21.2°C
[18:51:37][D][max31855:080]: 'Temperature': Got temperature=20.8°C
[18:51:52][D][max31855:080]: 'Temperature': Got temperature=21.5°C
[18:51:59][D][light:264]: 'Lights' Setting:
[18:51:59][D][light:273]:   State: ON
[18:51:59][D][light:303]:   Transition Length: 1.0s
[18:52:07][D][max31855:080]: 'Temperature': Got temperature=13.8°C
[18:52:07][D][sensor:092]: 'Temperature': Sending state 19.75000 °C with 1 decimals of accuracy
[18:52:22][D][max31855:080]: 'Temperature': Got temperature=14.0°C
[18:52:37][D][max31855:080]: 'Temperature': Got temperature=13.0°C
[18:52:52][D][max31855:080]: 'Temperature': Got temperature=12.2°C
[18:53:07][D][max31855:080]: 'Temperature': Got temperature=12.8°C
[18:53:07][D][sensor:092]: 'Temperature': Sending state 14.54167 °C with 1 decimals of accuracy
[18:53:22][D][max31855:080]: 'Temperature': Got temperature=13.5°C
[18:53:37][D][max31855:080]: 'Temperature': Got temperature=14.2°C
[18:53:52][D][max31855:080]: 'Temperature': Got temperature=14.2°C
[18:54:07][D][max31855:080]: 'Temperature': Got temperature=12.8°C
[18:54:07][D][sensor:092]: 'Temperature': Sending state 13.29167 °C with 1 decimals of accuracy
[18:54:22][D][max31855:080]: 'Temperature': Got temperature=14.5°C
[18:54:37][D][max31855:080]: 'Temperature': Got temperature=12.8°C
[18:54:52][D][max31855:080]: 'Temperature': Got temperature=10.2°C
[18:55:07][D][max31855:080]: 'Temperature': Got temperature=14.5°C
[18:55:07][D][sensor:092]: 'Temperature': Sending state 13.16667 °C with 1 decimals of accuracy
[18:55:08][D][light:264]: 'Lights' Setting:
[18:55:08][D][light:326]:   Effect: 'Rainbow fast'
[18:55:22][D][max31855:080]: 'Temperature': Got temperature=-25.0°C
[18:55:37][D][max31855:080]: 'Temperature': Got temperature=-35.8°C
[18:55:52][D][max31855:080]: 'Temperature': Got temperature=-26.5°C
[18:56:07][D][max31855:080]: 'Temperature': Got temperature=-28.8°C
[18:56:07][D][sensor:092]: 'Temperature': Sending state -15.20833 °C with 1 decimals of accuracy
[18:56:22][D][max31855:080]: 'Temperature': Got temperature=-31.0°C
[18:56:37][D][max31855:080]: 'Temperature': Got temperature=-24.5°C
[18:56:52][D][max31855:080]: 'Temperature': Got temperature=-33.0°C
[18:57:07][D][max31855:080]: 'Temperature': Got temperature=-21.0°C
[18:57:07][D][sensor:092]: 'Temperature': Sending state -27.45833 °C with 1 decimals of accuracy
[18:57:22][D][max31855:080]: 'Temperature': Got temperature=-26.0°C
[18:57:38][D][max31855:080]: 'Temperature': Got temperature=-34.0°C
[18:57:52][D][max31855:080]: 'Temperature': Got temperature=-25.2°C
[18:58:07][D][max31855:080]: 'Temperature': Got temperature=-29.5°C
[18:58:07][D][sensor:092]: 'Temperature': Sending state -28.12500 °C with 1 decimals of accuracy
[18:58:22][D][max31855:080]: 'Temperature': Got temperature=-8.5°C
[18:58:37][D][max31855:080]: 'Temperature': Got temperature=-35.2°C
[18:58:52][D][max31855:080]: 'Temperature': Got temperature=-34.5°C
[18:59:07][D][max31855:080]: 'Temperature': Got temperature=-33.5°C
[18:59:07][D][sensor:092]: 'Temperature': Sending state -27.75000 °C with 1 decimals of accuracy
[18:59:22][D][max31855:080]: 'Temperature': Got temperature=-26.2°C
[18:59:37][D][max31855:080]: 'Temperature': Got temperature=-30.5°C
[19:00:37][D][max31855:080]: 'Temperature': Got temperature=-11.5°C
[19:00:51][D][max31855:080]: 'Temperature': Got temperature=-29.5°C
[19:00:52][D][light:264]: 'Lights' Setting:
[19:00:52][D][light:273]:   State: OFF
[19:00:52][D][light:303]:   Transition Length: 1.0s
[19:00:52][D][light:309]:   Effect: 'None'
[19:01:06][D][max31855:080]: 'Temperature': Got temperature=20.8°C
[19:01:07][D][sensor:092]: 'Temperature': Sending state -10.29167 °C with 1 decimals of accuracy
[19:01:22][D][max31855:080]: 'Temperature': Got temperature=20.2°C
[19:01:36][D][max31855:080]: 'Temperature': Got temperature=21.0°C
[19:01:52][D][max31855:080]: 'Temperature': Got temperature=21.2°C
[19:02:07][D][max31855:080]: 'Temperature': Got temperature=21.2°C
[19:02:07][D][sensor:092]: 'Temperature': Sending state 12.50000 °C with 1 decimals of accuracy
[19:02:22][D][max31855:080]: 'Temperature': Got temperature=21.0°C
[19:02:37][D][max31855:080]: 'Temperature': Got temperature=21.2°C
[19:02:52][D][max31855:080]: 'Temperature': Got temperature=20.2°C
[19:03:07][D][max31855:080]: 'Temperature': Got temperature=21.5°C
[19:03:07][D][sensor:092]: 'Temperature': Sending state 21.08333 °C with 1 decimals of accuracy
[19:03:22][D][max31855:080]: 'Temperature': Got temperature=21.5°C
[19:03:38][D][max31855:080]: 'Temperature': Got temperature=21.0°C

I have already noticed that changing the max_refresh_rate value in the fastled_clockless configuration has an impact on the effect, i.e. the smaller the value (shorter refresh rate), the higher the temperature deviation.

Have I hit the hardware limitations of the ESP? Has anyone seen a similar effect with any other sensors and resolved this issue somehow?

1 Like

The MAX31855 datasheet lists a -0.3°C/V power supply rejection. So it’s not your 3.3V power supply sagging under load of the LEDs.
Most likely induced noise. A ferrite choke around the thermocouple leads as close as possible to the MAX31855 might help.

1 Like

Thanks for the quick response. I just tried this, and it indeed alleviates the effect somewhat. In this test - for reference without the ferrite choke - the temperature reading without the lights turned on was about 20ºC, with the lights turned on about -150ºC. With the ferrite choke, the temperature readings were around -80ºC while the lights were turned on. I tried three different sizes of ferrite chokes, but that did not change the temperature readings significantly.

What happens if you change the PWM frequency?

Do you mean as an overlay to the fastled_clockless platform configuration? Also, that link refers to an ESP8266, but I’m using an ESP32.

Ok so it is most likely noise induced in the thermocouple cabling.

Other things to try, screened thermocouple cable and a 0.1uF capacitor across the thermocouple input. Also a 0.1uF cap across the MAX31855 power supply, close as possible to the MAX31855 and a ferrite choke on all the cables on that side of the board too. Put the MAX31855 in a screened/metal enclosure.

I suspect all that will improve but may not not eliminate the issue.

The problem is that voltages generated by thermocouples are tiny, easily swamped by noise. Is there a reason you are using a thermocouple? What are you measuring the temperature of?

You might be better off with a different type of sensor.

1 Like

You are right, that doesn’t apply in this situation. I didn’t read your config file very carefully and thought you were using a different method of driving the lights. :flushed:

It looks like your can’t change the driver frequency on the WS2813 either, so going that route won’t work.

The thermocouple cable already has a metal screening.
I only had 0.22 µF capacitors here, and adding one to the thermocouple input already worked very well. Adding the other capacitor and the two ferrite chokes has now almost eliminated the issue (about 26ºC without lights on, and about 22ºC with lights on).
I didn’t have a suitable metal enclosure, but will try to get one in the next few days.

The thermocouple sensor is mounted inside my BBQ, so I need to measure temperatures up to 300ºC. I will need to heat the BBQ up to see if the above solution still works under high temperatures.

If you know any other way to measure this temperature range, I’m happy to consider other options. :slight_smile:

Heh. No that’s your best option.

If you put a ferrite on the power and data lines to the LED strip it will only slow the rise time of the first data section. After the next addressable LED data line will be squared up again. It would slow the rise time of the LED power rails, and they are carrying the most current and probably generating the RFI. Worht a try.

1 Like

Just a quick update:
In the meantime I’ve soldered 0.1 µF capacitors onto the thermocouple input and the power input, and mounted the MAX31855 board with ferrite chokes into an aluminium case.

The temperature readings are now quite accurate (only 1-2 degrees off when the LED is turned on). And, also surprisingly close to the analogue temperature sensor in my Weber.

1 Like