Skip to content

Conversation

@kageurufu
Copy link
Member

PTC heaters need variable power to properly be supported by MPC.

This PR adds three new config options heater_voltage, heater_power_ambient, and heater_temperature_coefficient.

Using the following measurements and formulas, your coefficient can easily be calculated. To simplify this, I've also documented and added a calculator to the MPC documentation.

  • $V$ - Voltage
  • $T_{a}$ - Ambient temperature
  • $R_{a}$ - Resistance at ambient temperature
  • $T_{2}$ - Second temperature
  • $R_{2}$ - Resistance at second temperature

The formulas then provide your configuration values:

heater_voltage = $V$
heater_power_ambient = $T_{a}$
heater_power = $\frac{V^2}{R_{a}}$
heater_temperature_coefficient = $\frac{(R_{2} - R_{a}) - 1}{T_{2} - T_{a}}$

As an example, I am using TZ-V6 with 80W heaters from TriangleLab, which are 88.6W @ 24C, with a coefficient of 0.003131

Checklist

  • pr title makes sense
  • squashed to 1 commit
  • added a test case if possible
  • if new feature, added to the readme
  • ci is happy and green

@kageurufu kageurufu requested a review from a team as a code owner February 18, 2025 16:32
@liampwll
Copy link
Contributor

liampwll commented Feb 19, 2025

This only works for heaters with a linear resistance/temperature curve, but with most heaters that have such a curve the change in resistance is small enough to not matter within the region of temperatures that you can print at. The PTC heaters that don't work well with MPC have curves that look more like the attached image:
image

@liampwll
Copy link
Contributor

liampwll commented Feb 19, 2025

I think a better solution may be adding a LUT which can be automatically found as part of the automatic calibration by slowly raising the temperature at a constant duty cycle. The heater resistance would then just be a function of the current temperature and the temperature delta over time as well as the various heater constants.

@Nathan22211
Copy link

@liampwll is it how it's done in your firmware? Also, as much as I want to test this PR I don't know if it'll work for a Rapido V2

@liampwll
Copy link
Contributor

It's not done at all yet. We have current sensing so we can do things more directly when it is implemented, but the idea is the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants