Products > 3D printing

Need Help with Marlin 3D printer firmware

(1/5) > >>

Hello Forum!

I am working on adding heated chamber functionality to my 3D printer, which involves a heater and an exhaust fan, i.e. heating and cooling.

My printer mainboard is a Bigtreetech skr 1.4 turbo (now discontinued I think?) running marlin bugfix 2.0.x . So far I have the heater running, I use VScode to edit the files and generate the binary for the mainboard.

The main thing I am stuck on is how to get the cooling fan set up. There are blocks of code for controlling the heater and fan, but there are no entries for the fan in the files that define the actual pins for the processor. I was able to find set the heater pin to what I wanted, but I searched high and low for an enclosure fan pin and didn't find anything.

If anybody has any experience in this area of marlin some help would be greatly appreciated! I think I will have to manually add code to define a pin for the fan, but I don't know how to do that.

Here is some of the code:

// Heated Chamber options
  #define CHAMBER_MINTEMP             5
  #define CHAMBER_MAXTEMP            60
  #define TEMP_CHAMBER_HYSTERESIS     3   // (°C) Temperature proximity considered "close enough" to the target
  #define HEATER_CHAMBER_PIN       P1_00   // Chamber heater on/off pin

  #define CHAMBER_FAN               // Enable a fan on the chamber
    #define CHAMBER_FAN_MODE 1        // Fan control mode: 0=Static; 1=Linear increase when temp is higher than target; 2=V-shaped curve.
    #if CHAMBER_FAN_MODE == 0
      #define CHAMBER_FAN_BASE  255   // Chamber fan PWM (0-255)
    #elif CHAMBER_FAN_MODE == 1
      #define CHAMBER_FAN_BASE  255   // Base chamber fan PWM (0-255); turns on when chamber temperature is above the target
      #define CHAMBER_FAN_FACTOR 0   // PWM increase per °C above target
    #elif CHAMBER_FAN_MODE == 2
      #define CHAMBER_FAN_BASE  128   // Minimum chamber fan PWM (0-255)
      #define CHAMBER_FAN_FACTOR 25   // PWM increase per °C difference from target

  //#define CHAMBER_VENT              // Enable a servo-controlled vent on the chamber
    #define CHAMBER_VENT_SERVO_NR  1  // Index of the vent servo
    #define HIGH_EXCESS_HEAT_LIMIT 5  // How much above target temp to consider there is excess heat in the chamber

I asked to move the thread since you posted in the wrong location:

The pins are defined in another file, \Marlin\src\pins\lpc1768\pins_BTT_SKR_V1_4.h and pins_BTT_SKR_common.h

In the common.h you can find this section:

--- Quote ---//
// Heaters / Fans
#ifndef HEATER_0_PIN
  #define HEATER_0_PIN                     P2_07
  #ifndef FAN1_PIN
    #define FAN1_PIN                       P2_04
  #ifndef HEATER_1_PIN
    #define HEATER_1_PIN                   P2_04
#ifndef FAN_PIN
  #define FAN_PIN                          P2_03
  #define HEATER_BED_PIN                   P2_05
--- End quote ---

If it doesn't exist you'll have to add a definition and ensure the pin isn't used elsewhere in the code. Eg. you can probably steal the second extruder FET if you are not using that.

Thanks for the reply! Sorry I posted this in the wrong place I guess I wasn't paying enough attention, I had no idea there was a 3D printing section.

I figured I would have to add a pin definition. would the syntax be something like this?

   #define CHAMBER_FAN_PIN        P2_04

I don't know what the particular variable should be, it is called CHAMBER_FAN in configuration.h, but I don't know if that is necessarily the actual variable.

I think you need to add "#define HOTENDS  1" to your configuration.h if there isn't an existing define.

So now TEMP_CHAMBER_PIN will auto define to TEMP_1_PIN:

--- Code: ---#if HOTENDS == 1 && !REDUNDANT_TEMP_MATCH(SOURCE, E1)
    #define TEMP_PROBE_PIN            TEMP_1_PIN
    #define TEMP_CHAMBER_PIN          TEMP_1_PIN
--- End code ---

Setup the temperature probe type if you have one, to whatever type of thermistor:

Then in configuration_adv:

define that pin, presumably as "FAN1_PIN" (which is P2_04)

This means you shouldn't have to do any editing in the pin config file at all.

That is a fan for the chamber but I don't think it is the right one. looking at the lines below #define CHAMBER_AUTO_FAN_PIN -1 it looks like this refers to a fan that turns on when the chamber is above a certain temp. I suppose I could use this fan as the chamber cooling fan but if I wanted to change the chamber temp I would have to change it in the firmware.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod