TemperatureSwitch is an optional module that automatically controls an output ( typically to control one of the small MOSFETs ) through a Switch) module, based on a configurable threshold temperature.

It is commonly used to turn on/off a cooling fan or water pump to cool a 3D printer extruder hot end's cold zone.

Simply, TemperatureSwitch turns on/off the switch.xxx where xxx is the used defined switch.xxx = fan or misc in the default configuration files.

If the printer has multiple hot ends, TemperatureSwitch will monitor all of them and if any one goes over the threshold, will turn on the switch. It will only turn the switch off if all of them are below the threshold temperature.

Since hot ends heat up relatively quickly and cool off slowly, the polling interval for heatup and cooldown are independently configurable in the configuration file. This is done to minimize processor load during printing.

Here's a description of the configurable parameters:

# automatically toggle a switch at a specified temperature
# useful to turn on a fan or water pump to cool the hotend
temperatureswitch.hotend.enable                 true             # enable this module
temperatureswitch.hotend.switch                 fan2             # select which MOSFET to use, must match a switch configuration (fan2 below)
temperatureswitch.hotend.designator             T                # first character of the temperature control designator to use as the temperature sensor to monitor
temperatureswitch.hotend.threshold_temp         60.0             # temperature to turn on (if rising) or off the switch
temperatureswitch.hotend.heatup_poll            15               # poll heatup at 15 sec intervals
temperatureswitch.hotend.cooldown_poll          60               # poll cooldown at 60 sec intervals

switch.fan2.enable                              true             # enable
switch.fan2.input_on_command                    M42              # gcode to turn on
switch.fan2.input_off_command                   M43              # gcode to turn off
switch.fan2.output_pin                          2.4              # pin that controls the fan

Many temperatureswitch instances can be defined that monitor different temperatures and trigger different switches for instance one to turn a motor fan on and off
also note that a readonly temperature control can be defined…

temperatureswitch.motor.enable               true             #
temperatureswitch.motor.switch               motorfan         #
temperatureswitch.motor.designator           M                #

switch.motorfan.enable                       true             # enable
switch.motorfan.input_on_command             M42              # gcode to turn on
switch.motorfan.input_off_command            M43              # gcode to turn off
switch.motorfan.output_pin                   2.4              # pin that controls the fan

# define a readonly temperaturecontrol for a motor
temperature_control.motor.enable             true             # Whether to activate this ( "hotend" ) module at all. All configuration is ignored if false.
temperature_control.motor.thermistor_pin     0.24             # Pin for the thermistor to read
temperature_control.motor.heater_pin         nc               # set to nc to makeit a readonly tempertaure control
temperature_control.motor.thermistor         EPCOS100K        # thermistor name
temperature_control.motor.designator         M                # designator
# turn the PSU off when the hotend temp cools below 50, only do this once M1100 S1 has been executed to arm it

temperatureswitch.psu_off.enable              true             #
temperatureswitch.psu_off.designator          T                # first character of the temperature control designator to use as the temperature sensor to monitor
temperatureswitch.psu_off.switch              psu              # select which switch to use, matches the name of the defined switch
temperatureswitch.psu_off.threshold_temp      50.0             # temperature to trigger at when falling
temperatureswitch.psu_off.heatup_poll         30               # poll heatup every 30 seconds
temperatureswitch.psu_off.cooldown_poll       30               # poll cooldown every 30 seconds
temperatureswitch.psu_off.arm_mcode           1100             # M1100 S1 will arm it
temperatureswitch.psu_off.trigger             falling          # only trigger when the temp falls below after being above
temperatureswitch.psu_off.inverted            false            # turn the switch off when we trigger (by default switches on when rising and off when falling)

All options

Option Example value Explanation
temperatureswitch.module_name.enable true Create and enable a new TemperatureSwitch module if set to true. This module automatically toggles a Switch module at a specified temperature ( read from a TemperatureControl module ).
temperatureswitch.module_name.designator T This module does not read temperature by itself, it asks an existing TemperatureControl for it's current temperature. This is used to specify which module to read temperature from, and must match the designator for that module.
temperatureswitch.module_name.switch misc This module does not have any output by itself, instead, it switches the state of an existing Switch module. Here you must speficy the name of that Switch module.
temperatureswitch.module_name.threshold_temp 60 Turn the switch ON above this temperature, and OFF below this temperature. In °C.
temperatureswitch.module_name.heatup_poll 15 Poll temperature at this frequency ( in seconds ) when heating up.
temperatureswitch.module_name.cooldown_poll 60 Poll temperature at this frequency ( in seconds ) when cooling down.
temperatureswitch.module_name.trigger level can be level, rising, falling - level is the default
temperatureswitch.module_name.inverted false will turn the switch off when the temp > target and vice versa when set true
temperatureswitch.module_name.arm_mcode 1100 M code used to arm the edge triggered switch eg M1100 S1 arms it

This site is a WIki, which means you are very welcome to help us improve it. Help on how to do that can be found at the Editing the Wiki page . You can edit any page by clicking the "Edit" button bellow :