Products > 3D printing
Need Help with Marlin 3D printer firmware
Alex_Baker:
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
//
#if TEMP_SENSOR_CHAMBER
#define CHAMBER_MINTEMP 5
#define CHAMBER_MAXTEMP 60
#define TEMP_CHAMBER_HYSTERESIS 3 // (°C) Temperature proximity considered "close enough" to the target
//#define CHAMBER_LIMIT_SWITCHING
#define HEATER_CHAMBER_PIN P1_00 // Chamber heater on/off pin
//#define HEATER_CHAMBER_INVERTING false
#define CHAMBER_FAN // Enable a fan on the chamber
#if ENABLED(CHAMBER_FAN)
#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
#endif
#endif
//#define CHAMBER_VENT // Enable a servo-controlled vent on the chamber
#if ENABLED(CHAMBER_VENT)
#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
#define LOW_EXCESS_HEAT_LIMIT 3
#define MIN_COOLING_SLOPE_TIME_CHAMBER_VENT 20
#define MIN_COOLING_SLOPE_DEG_CHAMBER_VENT 1.5
#endif
#endif
thm_w:
I asked to move the thread since you posted in the wrong location: https://www.eevblog.com/forum/3d-printing/
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
#endif
#if HOTENDS == 1 && DISABLED(HEATERS_PARALLEL)
#ifndef FAN1_PIN
#define FAN1_PIN P2_04
#endif
#else
#ifndef HEATER_1_PIN
#define HEATER_1_PIN P2_04
#endif
#endif
#ifndef FAN_PIN
#define FAN_PIN P2_03
#endif
#ifndef HEATER_BED_PIN
#define HEATER_BED_PIN P2_05
#endif
--- 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.
Alex_Baker:
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?
#ifndif CHAMBER_FAN_PIN
#define CHAMBER_FAN_PIN P2_04
#endif
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.
thm_w:
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)
#if TEMP_SENSOR_PROBE
#define TEMP_PROBE_PIN TEMP_1_PIN
#elif TEMP_SENSOR_CHAMBER
#define TEMP_CHAMBER_PIN TEMP_1_PIN
#endif
#endif
--- End code ---
Setup the temperature probe type if you have one, to whatever type of thermistor:
"#define TEMP_SENSOR_CHAMBER 0"
Then in configuration_adv:
"#define CHAMBER_AUTO_FAN_PIN -1"
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.
Alex_Baker:
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.
Navigation
[0] Message Index
[#] Next page
Go to full version