Heater Power Budget – Dynamic Power Allocation Between Bed and Hotend

Hi everyone,

I’d like to share a small Klipper feature I’ve been developing and using on my own printer: Heater Power Budget.

The idea is simple: instead of permanently limiting individual heaters, dynamically distribute a shared power budget between the heated bed and hotend based on their actual power requests.

The problem

Consider a printer with the following hardware:

  • Power supply: 350W
  • Heated bed: 220W
  • Hotend: 100W

When both heaters operate at full power, their combined demand reaches 320W, leaving only 30W for the MCU, stepper drivers, motors, fans, and other electronics.

However, this peak demand typically occurs during initial heating. Once the target temperatures are reached, both heaters generally require considerably less power.

One solution is to reduce a heater’s max_power, but that permanently restricts its output, even when the other heater is completely idle.

This seemed unnecessarily restrictive to me.

The solution

I implemented an optional [heater_power_budget] module that dynamically limits combined heater power while allowing each heater to use its full available capacity whenever possible.

For example, with a 300W heater budget:

Heater Requested Allocated
Hotend 100W 100W
Bed 220W 200W
Total 320W 300W

When the hotend’s demand later drops to 40W, the bed can immediately use its full 220W:

Heater Requested Allocated
Hotend 40W 40W
Bed 220W 220W
Total 260W 260W

No unnecessary limitation is applied when sufficient power is available.

The module also supports weighted priorities, allowing users to decide how available power should be distributed when both heaters request more than the configured budget.

Unused capacity is automatically made available to the other heater rather than being permanently reserved.

Configuration

An example configuration:

[heater_power_budget]
max_total_power: 300

extruder_nominal_power: 100
bed_nominal_power: 220

extruder_priority: 100
bed_priority: 0

extruder: extruder
bed: heater_bed

Here, the hotend receives priority during power contention, but the bed can still use all remaining available power.

The implementation also:

  • Preserves existing heater temperature targets and max_power limits.
  • Accounts for dynamic output limits in PID control, including integral limiting.
  • Works at the heater-control level, without requiring special START_PRINT macros.
  • Exposes requested, allowed, and actual estimated heater power through Klipper’s status interface and the QUERY_HEATER_POWER_BUDGET command.
  • Is completely opt-in. Without the configuration section, existing heater behavior remains unchanged.

Installation

The implementation adds only one Python module to Klipper. No existing Klipper source files need to be replaced.

For a standard Klipper installation, connect to your host via SSH and run:

curl -fL https://raw.githubusercontent.com/sezgynus/klipper/heater-power-budget/klippy/extras/heater_power_budget.py \
  -o ~/klipper/klippy/extras/heater_power_budget.py

This downloads the module directly from the PR’s source branch.

Next, add the [heater_power_budget] section shown above to your printer.cfg.

Make sure to adjust the nominal heater power values and the total power budget to match your actual hardware. Reserve sufficient capacity for motors, electronics, fans, and other loads.

Then restart Klipper:

sudo systemctl restart klipper

Once Klipper is ready, open the console in Mainsail or Fluidd and run:

QUERY_HEATER_POWER_BUDGET

This reports the configured budget, current heater power requests, allocations, and whether either heater is being limited.

To uninstall:

  1. Remove the [heater_power_budget] section from printer.cfg.

  2. Remove the module:

    rm ~/klipper/klippy/extras/heater_power_budget.py
    
  3. Restart Klipper:

    sudo systemctl restart klipper
    

These instructions assume the standard ~/klipper installation path and that the module file did not previously exist. Adjust the path if your installation differs, and back up any existing file before replacing it.

Since this is an experimental, non-mainline module, compatibility with future Klipper updates is not guaranteed. Test it carefully before relying on it, especially when changing your power configuration.

Important limitations

This is not an electrical power measurement system.

Power is estimated from configured nominal heater wattage and commanded PWM duty cycle.

The module manages combined commanded average heater power, not instantaneous electrical power. Since the heaters have independent PWM outputs, their ON periods may still overlap.

Other printer loads must be accounted for when choosing the heater budget. This is not a substitute for proper PSU sizing, wiring, or electrical protection.

The initial implementation supports one extruder heater and one heated bed.

Source code

The implementation is currently available as a Klipper patch:

GitHub PR: heaters: add configurable shared power budget by sezgynus · Pull Request #7392 · Klipper3d/klipper · GitHub

It is not part of mainline Klipper.

I originally developed this for my own printer, where I wanted to make better use of the available PSU capacity without permanently reducing heater performance.

I’m sharing it here in case others find it useful.

I’d be interested to hear whether anyone else has encountered similar power constraints, how you’ve approached them, and whether dynamic heater power allocation would be useful in your setup.

Technical feedback, alternative approaches, and potential edge cases are welcome.

Nice work! I added a very hacky version of this to my fork of klipper-toolchanger specifically for multi-extruders but it would be nice to see this in mainline Klipper. Does this approach support multiple hotend heaters? I searched the code and from what I can tell I don’t think it does but I’m not sure.

Thanks! Unfortunately, it doesn’t support multiple hotends yet. Maybe I’ll add support someday if I get a printer with multiple extruders, but for now, no. :slight_smile:

That said, I’m curious how you’d want this to work. I can at least think through the requirements before I use this as an excuse to buy a toolchanger. :slight_smile:

How would you split the power budget between the hotends and the bed? My first instinct would be to give the active toolhead top priority, or bump up the priority of the next toolhead when a tool change is coming up. How do you decide which heater gets priority in your setup? And where does the bed fit in?

I think the bed and active tool could get the highest priority, then if we’d be over budget we cut or reduce heater power on the other tools.