there is heater in bed and toolhead now.
I want to install a cooler on the bed and printhead. It is realized with semiconductor refrigeration sheets. Achieve control below ambient temperatures. Heating and cooling are available at the same time. How should I modify my klipper code and configuration files?
I need to print a glue. It is gelatinous at low temperatures and cured at room or high temperatures. Of course, temperature is relative, and sometimes low temperatures refer to 40 or 50 degrees Celsius. I need to control the temperature of the printhead and bed between 0-60 degrees Celsius. Modify the heater.py, copy the BangBangControl, and modify the temperature comparison logic algorithm. Add heater generic to the printer.cfg file, referencing this algorithm.
Now the problem: two heaters need two temperature sensors. Actually, my heating and cooling flaps are mounted together, acting on the same bed, and using a temperature sensor to measure the current temperature. When the heater generic references the same temperature sensor, the sensor pin is repeated incorrectly.
Currently the hot bed and cold bed can be controlled separately, but that’s not what I want, what I want is to combine the two into one and use a temperature sensor. add an ambient temperature sensor. When the target temperature is higher than the ambient temperature, the heating mode is used. When the target temperature is lower than the ambient temperature, the refrigeration mode is used. The mode is selected at the beginning of printing and remains unchanged until the end of printing.
I don’t want to add a heater generic, just one bed for cooling and heating, which is more versatile for slices.
----------------------------------------------------------------------------------------
11/01/2023 update
----------------------------------------------------------------------------------------
The existing cooler pin PB4 corresponds to the sensor C pin PB0. Existing heater, pin PB3, sensor H pin PB1. The hardware section has been assembled and the two sensors are attached to the surface of the bed. I want to use sensor H as an ambient temperature sensor and attach it to the printer housing. Sensor C acts as a temperature sensor for the bed. In the heater.py, the algorithm of refrigeration was added. How to modify this file to determine the measured values of sensor C and sensor H are introduced as judgment values for heating and cooling. After judgment, PWM is output through the heater and chiller pins.
cooler pin: PB4
heater pin: PB3
sensor bed: PB0, name C
sensor house: PB1, name H
How are the measurements of the two temperature sensors introduced, as well as the two output pins?
class ControlBangBang_cooler:
def __init__(self, heater, config):
self.heater = heater
self.heater_max_power = heater.get_max_power()
self.max_delta = config.getfloat('max_delta', 1.0, above=0.)
self.heating = False
def temperature_update(self, read_time, temp, target_temp):
if self.heating and temp <= target_temp-self.max_delta:
self.heating = False
elif not self.heating and temp >= target_temp+self.max_delta:
self.heating = True
if self.heating:
self.heater.set_pwm(read_time, self.heater_max_power)
else:
self.heater.set_pwm(read_time, 0.)
def check_busy(self, eventtime, smoothed_temp, target_temp):
return smoothed_temp < target_temp-self.max_delta
# set output pin here
heater_pin = config.get('heater_pin')
ppins = self.printer.lookup_object('pins')
self.mcu_pwm = ppins.setup_pin('pwm', heater_pin)