# How to turn off heater bed when it exceeds temperature

**URL:** https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286
**Category:** General Discussion
**Created:** [November 27, 2024, 9:32am UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286 "2024-11-27T09:32:55Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![JuanR3D](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@JuanR3D](https://klipper.discourse.group/u/JuanR3D)
#### Post date: [November 27, 2024, 9:32am UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/1 "2024-11-27T09:32:55Z")

</div>

### Basic Information:

Printer Model: Custom  
 MCU / Printerboard:Manta M8P  
 Host / SBC CB1  
 klippy.log -

Hi everyone, I’m looking to add a safety feature to my heated bed setup.

I have two temperature sensors: one on the print platform (target temperature) and another directly on the heater element itself.

Currently, I control the temperature of the print platform as the target. However, the issue arises because the heater often overheats in order to get the print platform to the desired temperature. For example, when the platform’s target is 80°C, the heater can reach up to 200°C while the platform is still warming up. (Once the temperature stabilizes, both settle around 80°C.)

I would like to keep controlling the print platform temperature as I have been, but I want to implement a safeguard to stop the heater when its own temperature exceeds, say, 200°C. **Ideally, this should be done via software.**

### Possible Solutions I’ve Considered:

1. **Hardware Approach** :  
Use a relay controlled by a `temperature_fan`. The relay would cut power to the heater when it exceeds 200°C and re-enable it when the temperature drops below 200°C.
2. **Software Approach (Delayed Macro)**:  
Use a delayed macro to evaluate the heater’s temperature periodically. If the temperature exceeds 200°C, the macro would set the heater bed’s target to 0°C, effectively disabling it. Once the temperature drops below 200°C, the target would be restored.  
However, I’m hesitant about this method because delayed macros can sometimes respond too slowly, especially if there are long movement commands or complex operations queued beforehand.

### My Question:

Is there a more automated or efficient way to implement this kind of safety mechanism within Klipper? Perhaps a component or feature that I’m not aware of that can handle these types of safety constraints?

Thanks in advance for your help!

---

<div class="post-metadata">

### Author: ![3dcoded](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/3dcoded/32/20297_2.png) [@3dcoded](https://klipper.discourse.group/u/3dcoded)
#### Post date: [November 27, 2024, 11:46am UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/2 "2024-11-27T11:46:11Z")

</div>

You can set a `max_temp` in your config. See [Configuration reference - Klipper documentation](https://www.klipper3d.org/Config_Reference.html#heater_bed)

Also, did you PID tune your heat bed? Overshooting by 120ºC is not normal.

---

<div class="post-metadata">

### Author: ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)
#### Post date: [November 27, 2024, 12:19pm UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/3 "2024-11-27T12:19:51Z")

</div>

AFAIK, there is currently no option to do this. See [Dual Loop PID, a accurate bed surface temperature](https://klipper.discourse.group/t/dual-loop-pid-a-accurate-bed-surface-temperature/6268) for a previous discussion on this topic.

An option _might_ be the rather new template function for `output_pin`. See [Add support for output\_pin and fan templates by KevinOConnor · Pull Request #6695 · Klipper3d/klipper · GitHub](https://github.com/Klipper3d/klipper/pull/6695) for the implementation details and [Configuration reference - Klipper documentation](https://www.klipper3d.org/Config_Reference.html?h=template#display_template) for some information on the general idea and where it came from.

---

<div class="post-metadata">

### Author: ![JuanR3D](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@JuanR3D](https://klipper.discourse.group/u/JuanR3D)
#### Post date: [November 27, 2024, 1:12pm UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/4 "2024-11-27T13:12:09Z")

</div>

Yes, it is correctly tuned. And yes, when you have a veeery big and thick print platform, the heater gets very hot in order to heat the platform (they are two different elements, the plattform receives the heat from the heater, so heater is always hotter than plattform. Also, the bigger the plattform, the bigger the heat disipation, and the bigger the difference between these elements).

---

<div class="post-metadata">

### Author: ![JuanR3D](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@JuanR3D](https://klipper.discourse.group/u/JuanR3D)
#### Post date: [November 27, 2024, 1:12pm UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/5 "2024-11-27T13:12:58Z")

</div>

Thanks, i’m going to take a look.

---

<div class="post-metadata">

### Author: ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)
#### Post date: [November 27, 2024, 2:08pm UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/6 "2024-11-27T14:08:58Z")

</div>

Should not the thermal runaway protection kick in?

---

<div class="post-metadata">

### Author: ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)
#### Post date: [November 27, 2024, 2:56pm UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/7 "2024-11-27T14:56:55Z")

</div>

This is not what you want. If you control the heating power from the surface temperature, but the “leading sensor” is on the heating mat itself, you will get a delta between the surface and the heating mat. On my printers and with a heating mat temperature of 120°C this delta is easily \>20°C.

So to protect the heating mat you would want to limit its maximum temperature but still control it via the surface temperature sensor.

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)
#### Post date: [January 26, 2025, 2:57pm UTC](https://klipper.discourse.group/t/how-to-turn-off-heater-bed-when-it-exceeds-temperature/20286/8 "2025-01-26T14:57:16Z")

</div>

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