Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MPC] Add variable power support for PTC heaters #580

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

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

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 power. 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.

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.

2 participants