I want a cooler in bed and toolhead

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)

I think this is one of those things that if you don’t know how to do it (or can’t figure out how to do it) you probably won’t be able to do it.

I don’t know how to do it, but if I were going to try to figure out how to do it, I’d probably start by studying klipper/klippy/extras/heaters.py and using it as the base for a “cooler” module that essentially inverts the logic by using a positive PWM signal to reduce the temperature (assuming your hardware even works that way).

If you get that working, then you’d need to further investigate the codebase to figure out how to create a cooler object and assign it to the toolhead or bed, then hope the existing PID tuning algorithms work for this application (or else write new ones), and then figure out some sort of control logic so the printer knows when to use a heater and when to use a cooler, so that the two aren’t constantly competing with each other.

Good luck!

Hello,

I have a question, and it is: why? I could see the nozzle, but why the bed? Wouldn’t you want it to stay hot?

Best Regards,
Blake

A certain glue, which is fluid at low temperatures, cures at room temperature or high temperature. The printhead needs to be kept at a low temperature and the bed at room temperature or slightly higher than the printhead temperature, which may also be low relative to room temperature. Due to the different glue formulations, the temperature requirements are also different. So I wanted to make a bed and printhead that could both heat and cool.

1 Like

It seems like it would be easier to put the printer in a refrigerated enclosure so you can set the “ambient” temperature as low as you want, then use the bed and hotend heaters to achieve the desired temperature gradients.

2 Likes

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