MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.34k stars 19.26k forks source link

Automatically turn the Fan on when Extruder is on #3234

Closed Grogyan closed 8 years ago

Grogyan commented 8 years ago

I was going to suggest this as a feature, however I found that the feature is in configuration_adv

I sometimes forget to turn on the fan before I turn on the extruder, as I am now using the fan port on the RAMPS 1.4 in EFB mode. With enabling this feature within the configuration_adv.h file, the fan is not turning on as expected when the hot end is over the EXTRUDER_AUTO_FAN_TEMPERATURE threshold, which is typically at 50 degrees C If I set EXTRUDER_0_AUTO_FAN_PIN to FAN_PIN, the sanity check prevents this as a possibility. Maybe i'm not using this feature correctly.

If I set the PLA_PREHEAT_FAN_SPEED to say, 200, in configuration.h, this only turns the fan on from a smart display like the Full Graphics Display. So if I turn the Extruder on in Repetier Host, this doesn't turn the fan on automatically either.

Currently the ideal scenario is for the fan to automatically turn on when the hot end is above a certain temperature (eg 50 degrees), and stays on until the temperature drops below this threshold. Even if the extruder is turned on with Repetier/OctoPrint/Smart Display.

Currently using RC4 RAMPS 1.4 EFB Full Graphic Display

jbrazio commented 8 years ago

Which fan are you talking about ? There are two types of fans: the fan which should start at 50C and aims to cool down the cold part of the hotend, and the "PLA blower fan" which you start using GCODE.

Grogyan commented 8 years ago

I do not at the moment have a blower to cool the part as it is being printed.

I will in the future will have both the blower and the active extruder cooling fan on the same Fan port on the RAMPS board

jbrazio commented 8 years ago

So what you want to accomplish is to activate the hotend-fan when the temperature of the extruder is above 50C right ?

Grogyan commented 8 years ago

Correct

jbrazio commented 8 years ago

Just edit Configuration_adv.h:

// Extruder cooling fans
// Configure fan pin outputs to automatically turn on/off when the associated
// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
// Multiple extruders can be assigned to the same pin in which case
// the fan will turn on when any selected extruder is above the threshold.
#define EXTRUDER_0_AUTO_FAN_PIN 11
#define EXTRUDER_1_AUTO_FAN_PIN -1
#define EXTRUDER_2_AUTO_FAN_PIN -1
#define EXTRUDER_3_AUTO_FAN_PIN -1
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed

If your board only has one FAN port then you must #undef FAN_PIN and #define EXTRUDER_0_AUTO_FAN_PIN to that pin.

In a nutshell FAN_PIN is the blower fan, EXTRUDER_X_AUTO_FAN_PIN is the cooling fan for cold part of the hotend.

Grogyan commented 8 years ago

That didn't work

jbrazio commented 8 years ago

Did you disabled FAN_PIN ? What you cannot do is to have FAN_PIN assigned to the same pin as EXTRUDER_0_AUTO_FAN_PIN.

Grogyan commented 8 years ago

I disabled FAN_PIN, however this produced other errors with compiling

jbrazio commented 8 years ago

Try this #define FAN_PIN -1.

Grogyan commented 8 years ago

Did that, got the compiling error exit status 1 'fanSpeeds' was not declared in this scope

jbrazio commented 8 years ago

Where are you doing it ?

Grogyan commented 8 years ago

In pins_RAMPS_14.h

jbrazio commented 8 years ago

pins_RAMPS_14.h has the following definition about FAN_PIN:

#if MB(RAMPS_14_EFF) || MB(RAMPS_13_EFF) || ENABLED(IS_RAMPS_EFB)
  #define FAN_PIN           9 // (Sprinter config)
  #if MB(RAMPS_14_EFF) || MB(RAMPS_13_EFF)
    #define CONTROLLERFAN_PIN  -1 // Pin used for the fan to cool controller
  #endif
#elif MB(RAMPS_14_EEF) || MB(RAMPS_14_SF) || MB(RAMPS_13_EEF) || MB(RAMPS_13_SF)
  #define FAN_PIN           8
#else
  #define FAN_PIN           4 // IO pin. Buffer needed
#endif

At the end of the file could you please try:

#undef FAN_PIN
#define FAN_PIN -1
Grogyan commented 8 years ago

Same error `In file included from sketch\ultralcd.cpp:55:0:

sketch\dogm_lcd_implementation.h: In function 'void lcd_implementation_status_screen()':

dogm_lcd_implementation.h:286: error: 'fanSpeeds' was not declared in this scope

u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeeds[0] ? status_screen0_bmp : status_screen1_bmp);

                                                                              ^

exit status 1 'fanSpeeds' was not declared in this scope`

jbrazio commented 8 years ago

Could you please attach here you configuration (.h and adv.h) files ?

Grogyan commented 8 years ago

Configuration.h http://pastebin.com/HWpG0FUx

Configuration_ADV.h http://pastebin.com/BAe7dSqj

jbrazio commented 8 years ago

This is a bug.

Please try if this fixes your error.

  1. Download my cfe514e33bdb436ed02b1f143cc7d05a67bd296f branch from here.
  2. Copy your configuration files
  3. In Configuration_adv.h add #define EXTRUDER_0_AUTO_FAN_PIN 9
  4. Edit pins_RAMPS_14_EFB.h and add the following to the end:
#undef FAN_PIN
#define FAN_PIN -1

Please report if it fixed your problem.

thinkyhead commented 8 years ago

Patched!

Grogyan commented 8 years ago

I will probably be testing this tomorrow.

Cheers

cemalgultekin commented 5 years ago

I am trying to do the same thing with my board that has firmware 2.0.bugfix( FLSUN Kossel Delta). I'm using windows 7 x64, with Arduino 1.8.9 On Configuration.h I set motherboard to

#ifndef MOTHERBOARD
  #define MOTHERBOARD BOARD_RAMPS_14_EFB
#endif

On my Configuration_adv.h, I set FAN_PIN to -1,

#define FAN_PIN -1
#define E0_AUTO_FAN_PIN 9
#define E1_AUTO_FAN_PIN -1
#define E2_AUTO_FAN_PIN -1
#define E3_AUTO_FAN_PIN -1
#define E4_AUTO_FAN_PIN -1
#define E5_AUTO_FAN_PIN -1
#define CHAMBER_AUTO_FAN_PIN -1
#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
#define EXTRUDER_AUTO_FAN_SPEED 255   // 255 == full speed

I have configured it as above as in pins_RAMPS.h, FAN_PIN is defined as below

#ifndef FAN_PIN
  #if EITHER(IS_RAMPS_EFB, IS_RAMPS_EFF)          // Hotend, Fan, Bed or Hotend, Fan, Fan
    #define FAN_PIN        RAMPS_D9_PIN
  #elif EITHER(IS_RAMPS_EEF, IS_RAMPS_SF)         // Hotend, Hotend, Fan or Spindle, Fan
    #define FAN_PIN        RAMPS_D8_PIN
  #elif ENABLED(IS_RAMPS_EEB)                  // Hotend, Hotend, Bed
    #define FAN_PIN         4                  // IO pin. Buffer needed
  #else                                        // Non-specific are "EFB" (i.e., "EFBF" or "EFBE")
    #define FAN_PIN        RAMPS_D9_PIN
  #endif
#endif

, so defining it to -1 should prevent sanity_check from failing(shouldn't it?). and the result is

sketch\src\module\motion.cpp: In function 'get_cartesian_from_steppers':

sketch\src\module\motion.cpp:253:1: internal compiler error: Segmentation fault

 }

 ^

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

lto-wrapper.exe: fatal error: C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

Update

I have fixed that segmentation fault using this answer on stackexchange. I have installed Arduino AVR Boards version 1.6.21 from Tools -> Board -> Board Manager . And the segmentation fault is gone.

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.