A struggle and a solution with unstable temperature

Basic Information:

Printer Model: Ender 5
MCU / Printerboard: BTT E3 RRF with IDEX
Host / SBC RPi 3B
klippy.log

klippy.zip (360.2 KB)

Hello. As you can see, I have a rebuilt Ender5. The modification is that I have changed the main board to a BTT E3 RRF with an IDEX daughter board. The second extruder is mounted on the back of the X-carriage, and moves together with the first extruder. So it is not an IDEX setup.
The temperature on E1 has always been more unstable than it is on E0. Because of this, I have tried several things, including alternative PID controls. This has made it better, but never as good as E0. Then I got to test query_adc. Without any heat or steppers on. There was over 7 times more variation on E1 than on E0!
So I saw in documentation that there were other ports that also had ADC. Z-stop port is not in use, so I tested this. It is equipped with a 10kOhm resistor from 3.3V instead of the usual 4.7kOhm resistor. So I had to make extra resistors to get 4.7 kOhm. This was very successful! Much better than other PID controls and others that I have tried before. It is recommended to try this if you have an unstable temperature.

I have also made a small circuit, which I think will improve temperature measurements.
I’ve used google translate, so word choice etc may not be the very best…

Finally, I have a question for the developers. ADC I think is 9 bit (0-1023). But what you get back from query_adc is something completely different. Why don’t you get 0-1023?

I see there is not much interest in this, but I choose to update this anyway.
I have created some macros to reveal hardware errors on temperature measurements. My first attempt was not very good, but now I think I have found a better way. The macros compare the temperature now, with the temperature 0.3 seconds ago. A large difference will reveal a problem. First, the macros as I use them:

[gcode_macro L410]
variable_beold: 0.00
variable_bedif: 0.00
variable_e0old: 0.00
variable_e0dif: 0.00
variable_e1old: 0.00
variable_e1dif: 0.00
variable_myold: 0.00
variable_mydif: 0.00
gcode:
    M105
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=beold VALUE={printer.heater_bed.temperature}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=bedif VALUE=0.0
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0old VALUE={printer.extruder.temperature}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0dif VALUE=0.0
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e1old VALUE={printer.extruder1.temperature}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e1dif VALUE=0.0
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=myold VALUE={printer["temperature_fan my_temp_fan"].temperature}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=mydif VALUE=0.0
    G4 P300
    {% for i in range(100) %}
	    L411
	    G4 P300
    {% endfor %}
    L412

[gcode_macro L411] 
gcode:
	M105
    {% set dib = printer.heater_bed.temperature - printer["gcode_macro L410"].beold %}
    {% if dib < 0 %}
      {% set dibb = 0 - dib %}
    {% else %}
      {% set dibb = dib %}
    {% endif %}
    {% if dibb > printer["gcode_macro L410"].bedif %}
      SET_GCODE_VARIABLE MACRO=L410 VARIABLE=bedif VALUE={dibb}
    {% endif %}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=beold VALUE={printer.heater_bed.temperature}	
	
    {% set dif = printer.extruder.temperature - printer["gcode_macro L410"].e0old %}
    {% if dif < 0 %}
      {% set diff = 0 - dif %}
    {% else %}
      {% set diff = dif %}
    {% endif %}
    {% if diff > printer["gcode_macro L410"].e0dif %}
      SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0dif VALUE={diff}
    {% endif %}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0old VALUE={printer.extruder.temperature}
	
    {% set dig = printer.extruder1.temperature - printer["gcode_macro L410"].e1old %}
    {% if dig < 0 %}
      {% set digg = 0 - dig %}
    {% else %}
      {% set digg = dig %}
    {% endif %}
    {% if digg > printer["gcode_macro L410"].e1dif %}
      SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e1dif VALUE={digg}
    {% endif %}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e1old VALUE={printer.extruder1.temperature}
    
    {% set dim = printer["temperature_fan my_temp_fan"].temperature - printer["gcode_macro L410"].myold %}
    {% if dim < 0 %}
      {% set dimm = 0 - dim %}
    {% else %}
      {% set dimm = dim %}
    {% endif %}
    {% if dimm > printer["gcode_macro L410"].mydif %}
      SET_GCODE_VARIABLE MACRO=L410 VARIABLE=mydif VALUE={dimm}
    {% endif %}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=myold VALUE={printer["temperature_fan my_temp_fan"].temperature}
    
    M118 Difference Bed {dibb}   E0 {diff}   E1 {digg}   My {dimm}
    
[gcode_macro L412] 
gcode:
    M118
    M118 Max Dif    Bed {printer["gcode_macro L410"].bedif
    }   E0 {printer["gcode_macro L410"].e0dif
    }   E1 {printer["gcode_macro L410"].e1dif
    }   MY {printer["gcode_macro L410"].mydif}

[gcode_macro L420] 
gcode:
    M118 Temp {printer["temperature_fan my_temp_fan"].temperature}
    

And here is the result after a test, slightly embellished for easier reading:

Send: L410
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.0
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.0
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.0
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.0
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.0
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.0
Difference Bed 0.02  E0 0.00  E1 0.01  My 0.26
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.37
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.36
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.13
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.08
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.31
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.03
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.22
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.14
Difference Bed 0.02  E0 0.01  E1 0.00  My 0.04
Difference Bed 0.03  E0 0.01  E1 0.01  My 0.13
Difference Bed 0.00  E0 0.01  E1 0.00  My 0.06
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.05
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.25
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.11
Difference Bed 0.01  E0 0.02  E1 0.01  My 0.51
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.29
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.43
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.22
Difference Bed 0.01  E0 0.01  E1 0.02  My 0.03
Difference Bed 0.02  E0 0.01  E1 0.01  My 0.25
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.17
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.31
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.42
Difference Bed 0.02  E0 0.01  E1 0.01  My 0.26
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.35
Difference Bed 0.01  E0 0.01  E1 0.01  My 0.67
Difference Bed 0.01  E0 0.01  E1 0.01  My 0.44
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.0
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.02
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.07
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.14
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.43
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.56
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.01
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.08
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.36
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.1
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.0
Difference Bed 0.01  E0 0.01  E1 0.01  My 0.03
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.32
Difference Bed 0.02  E0 0.01  E1 0.00  My 0.23
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.02
Difference Bed 0.02  E0 0.01  E1 0.01  My 0.3
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.31
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.2
Difference Bed 0.01  E0 0.02  E1 0.02  My 0.4
Difference Bed 0.01  E0 0.01  E1 0.01  My 0.32
Difference Bed 0.00  E0 0.01  E1 0.00  My 0.35
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.51
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.16
Difference Bed 0.00  E0 0.01  E1 0.00  My 0.08
Difference Bed 0.02  E0 0.00  E1 0.01  My 0.03
Difference Bed 0.01  E0 0.01  E1 0.01  My 0.34
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.4
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.03
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.12
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.42
Difference Bed 0.00  E0 0.01  E1 0.00  My 0.65
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.28
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.11
Difference Bed 0.00  E0 0.00  E1 0.02  My 0.16
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.17
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.18
Difference Bed 0.01  E0 0.01  E1 0.01  My 0.32
Difference Bed 0.00  E0 0.01  E1 0.02  My 0.22
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.27
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.33
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.3
Difference Bed 0.02  E0 0.00  E1 0.00  My 0.2
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.21
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.04
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.27
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.14
Difference Bed 0.00  E0 0.01  E1 0.00  My 0.0
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.06
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.09
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.14
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.01
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.08
Difference Bed 0.00  E0 0.01  E1 0.00  My 0.32
Difference Bed 0.00  E0 0.00  E1 0.00  My 0.19
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.34
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.4
Difference Bed 0.00  E0 0.01  E1 0.00  My 0.11
Difference Bed 0.01  E0 0.00  E1 0.00  My 0.13
Difference Bed 0.01  E0 0.01  E1 0.01  My 0.03
Difference Bed 0.00  E0 0.00  E1 0.01  My 0.14
Difference Bed 0.01  E0 0.01  E1 0.00  My 0.02
Difference Bed 0.02  E0 0.01  E1 0.01  My 0.14
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.12
Difference Bed 0.01  E0 0.01  E1 0.02  My 0.33
Difference Bed 0.00  E0 0.01  E1 0.01  My 0.27
Difference Bed 0.01  E0 0.00  E1 0.01  My 0.03
Recv: 
Max Dif    Bed 0.03  E0 0.02  E1 0.02  MY 0.67

The measurements after “MY” are the input that BTT has intended for Extruder1 to use (HOT1). It is quite clear to see that that input has problems. And with such problems with the temperature measurement, it becomes difficult to get a stable temperature, naturally enough.

And here is the macro for Bed and one Extruder:

[gcode_macro L410]
variable_beold: 0.00
variable_bedif: 0.00
variable_e0old: 0.00
variable_e0dif: 0.00
gcode:
    M105
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=beold VALUE={printer.heater_bed.temperature}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=bedif VALUE=0.0
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0old VALUE={printer.extruder.temperature}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0dif VALUE=0.0
    G4 P300
    {% for i in range(100) %}
	    L411
	    G4 P300
    {% endfor %}
    L412

[gcode_macro L411] 
gcode:
	M105
    {% set dib = printer.heater_bed.temperature - printer["gcode_macro L410"].beold %}
    {% if dib < 0 %}
      {% set dibb = 0 - dib %}
    {% else %}
      {% set dibb = dib %}
    {% endif %}
    {% if dibb > printer["gcode_macro L410"].bedif %}
      SET_GCODE_VARIABLE MACRO=L410 VARIABLE=bedif VALUE={dibb}
    {% endif %}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=beold VALUE={printer.heater_bed.temperature}	
	
    {% set dif = printer.extruder.temperature - printer["gcode_macro L410"].e0old %}
    {% if dif < 0 %}
      {% set diff = 0 - dif %}
    {% else %}
      {% set diff = dif %}
    {% endif %}
    {% if diff > printer["gcode_macro L410"].e0dif %}
      SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0dif VALUE={diff}
    {% endif %}
    SET_GCODE_VARIABLE MACRO=L410 VARIABLE=e0old VALUE={printer.extruder.temperature}
	
    M118 Difference Bed {dibb}   E0 {diff}
[gcode_macro L412] 
gcode:
    M118
    M118 Max Dif    Bed {printer["gcode_macro L410"].bedif
    }   E0 {printer["gcode_macro L410"].e0dif}

It would have been very nice if others had also taken the time to test this. There is only one macro to be run from the terminal, L410. The biggest difference will appear in the last line:

Recv:  Max Dif    Bed 0.05   E0 0.03

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.