SolvedMarlin Extruder fan doesn't come on automatically.

I have converted my Anet A6 to RAMPS 1.4+ Arduino Mega2560 but cant get the extruder fan working!
It works with M106 S255 command, so I know it is properly connected and the MOSFET works, but it will not come on automatically when the hot-end passes 50ºC !!
I am running the latest Marlin (1.1.8) here are some relevant lines in


#define PREHEAT_1_TEMP_BED     60
#define PREHEAT_1_FAN_SPEED     0 // Value from 0 to 255


#define E0_AUTO_FAN_PIN -1
#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 EXTRUDER_AUTO_FAN_SPEED   255  // == full speed

-----> I have tried setting E0_AUTO_FAN_PIN to 11 with no results
If I use the servo port pin 11 for E0_AUTO_FAN_PIN, it will turn on a fan that is connected to an external MOSFET like TinyFan board when the temp reaches 50ºC !!!
I have tried assigning it to 9, but get an error

#error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN."


// Heaters / Fans
#ifndef RAMPS_D8_PIN
  #define RAMPS_D8_PIN   8
#ifndef RAMPS_D9_PIN
  #define RAMPS_D9_PIN   9
#ifndef RAMPS_D10_PIN
  #define RAMPS_D10_PIN 10

#define HEATER_0_PIN     RAMPS_D10_PIN

#if ENABLED(IS_RAMPS_EFB)                      // Hotend, Fan, Bed
  #define FAN_PIN        RAMPS_D9_PIN

I am at the end of my whits. I need help. I don't know why D9 port (fan connector on the RAMPS board) doesn't turn on the fan automatically, but I can turn it on with the M106 S255 command!


21 Answers

✔️Accepted Answer

To sum up, the intended way to do configuration for the En_AUTO_FAN_PIN settings is to just comment out the ones that you want to enable, and then they will be set to the default pin defined in your board's pins_MYBOARD.h file. For example, to use the default pin for E0_AUTO_FAN_PIN:

//#define E0_AUTO_FAN_PIN -1
#define E1_AUTO_FAN_PIN -1
#define E2_AUTO_FAN_PIN -1
#define E3_AUTO_FAN_PIN -1
#define E4_AUTO_FAN_PIN -1

Or, redefine to the pin you want to use, and it will override the default:

#define E0_AUTO_FAN_PIN 11
#define E1_AUTO_FAN_PIN -1
#define E2_AUTO_FAN_PIN -1
#define E3_AUTO_FAN_PIN -1
#define E4_AUTO_FAN_PIN -1

Since the common FAN_PIN (part cooling fan) has a setting for all boards and is always defined, if you need to use that pin, you would have to comment it out in the relevant pins_MYBOARD.h file. Currently the pin isn't overridable from configurations (at least, without throwing a #warning).

Note also that I'm the idiot who "should stop working on the code immediately."
Nice to meet you too, @PicoPi.

Related Issues:

Marlin Full graphic controller issues under Arduino >1.0.6
Just hit this with a Tevo Tornado with a MKS GEN L board and RRD Full Graphic Smart Controller tryin...
Marlin Extruder fan doesn't come on automatically.
To sum up the intended way to do configuration for the En_AUTO_FAN_PIN settings is to just comment o...
Marlin Reprap Discount Full Graphics Smart Controller Display is Garbled
I've tried 0 400 0 and 250 250 250 but nothing changes So here I am again ...
Marlin [BUG] TMC2209 Sensorless homing sensitivity is off
@boelle Thank you for reopening it I'm about to close it again but I will update for the benefit of ...
Marlin Ender 3 v1 with 4.2.7 board
Marlin Firmware to get Creality v4.2.7 boards working perfectly Steps to help anybody that needs to ...
Marlin Marlin with power loss and resume
which firmware version has this bugfix-1.1.x and bugfix-2.0.x how can I activate the feature so I ca...
Cura Unable to open any STL in 4.7
It is not very easily hackable but it is possible The following instructions come with no warranty p...
meshlab [Ubuntu - Snap] Can't open any file on external hard drive
I had the same issue (also Meshlab 2016.12 running on Ubuntu 16.04) I couldn't open a file under /mn...
Cura Z-axis not moving up as it should in new Cura 3.6.0
Great that confirms the bug and it has to be one of the oddest bugs I've seen in a long time ...
Cura 2.6 Filament Diameter and Nozzle Temp Ignored
Thanks for reporting I'm using Cura 2.6 on Windows this is a clean install with no previous profiles...
Cura [3.5] Temperature is not correct in the GCode
Does M104 S{material_print_temperature 0} work for you? I Have the following entry in the Start GCod...
arduino esp32 WiFiClientSecure make issue
This seemed to work for me make menuconfig Good luck. Hardware: (Doesn't matter for this issue !) Bo...
arduino esp32 Task watchdog got triggered. The following tasks did not feed the watchdog in time
Anyone who still want to avoid that error should try adding these three line to your continuous rtos...
Arduino Use proper configuration files location on linux
Updating numerous web pages that mention the existing location doesn't seem like such a nice task an...
arduino esp32 How can I turn off the radio on ESP32?
There is an example for this:
johnny five Browserify / Webpack support
I just ran into this issue At a high level the goal here would be to make requiring johnny-five in p...
arduino esp32 tone was not declared in this scope
I think tone is part of the ledc functions in esp32 I don't have a speaker around to test but try th...
arduino esp32 SmartConfig fails connection - appears not saving SSID
@dhernandezgt for it to reconnect automatically on boot Hardware: Board: ESP32 Core Dev Module Gener...
arduino esp32 hostname can not set
I change the order of Statement ,than it is worked. Please fill the info fields it helps to get you ...
arduino esp32 unreliable connecting to wifi
I had the exact same problem and it drove me crazy for ages It all started when I added a 2nd Wifi m...
Tasmota MagicHome LED (ESP-IR-B-v2.3 / ESP8285MOD ESP-M2) not working with tasmota f/w
Well I worked mine out Color order was just a case of switching the PWM1 and PWM2 because my LED str...
arduino esp32 FSBrowser problem
Try this comment out in webserver.cpp Hardware: Board: ESP32 wroom32 Core Installation/update date: ...
Arduino Menu don't show up in OSX High Sierra Menubar
I found a simpler workaround Force the language to English for the .app Open a Terminal and run: def...
Tasmota More effects with leds
Hello everyone First of all thank you for this wonderful library I have found it very useful ...
arduino esp32 Simultaneously use the two I2C bus of the ESP32.
Thanks beegee-tokyo With your help i could modify a I2C Scanner to this dual channel I2C Scanner Tes...
arduino esp32 Missing branch #idf-release/v4.0
Because i had to get this working for a commercial application too i have forked a recent fork of th...
homie esp8266 [develop-v3] OTA failing
Hey guys I found the problem and learned a few things along the way The hardware WD timer was being ...
Tasmota lc technology 2ch relay
Closing issue as there is no feedback Please when you have time tell us if the proposed solution wor...
Tasmota Upgrade to Tasmota from Shelly mongoose trough SW ( not cable)
@seritos - it seems that the upload to the ftp server did not work for some builds but the actions w...
Tasmota Alternative PWM implementation for ESP8266 devices
Hi All I know this is an old issue This thread came up when I was looking to use Tasmota to control ...
arduino esp32 Server ota updates
Has anyone been able to do something like this to update ESP32 firmware through a URL: ESPhttpUpdate...
platformio core Debug by CLion
Hi all There is a piece of good news here We are so happy to present the first MVP of the PlatformIO...
Arduino Arduino IDE 1.6.5/1.6.8 Mac OS X 10.11/10.11.3 -- Error downloading package_index.json
@shanetoven @remct Could you please try deleting ~/Library/Arduino15/package_index.json and restarti...
arduino esp32 Touch Examples
first do not read the touch pins in the loop Then instead of that set in the interrupts a boolean fl...
arduino esp32 How can I reset Serial2 / UART2?
I propose a change in the Serial.flush function to avoid the trouble with serial2 ...
arduino esp32 Onewire & Wifi Problems
@cristianhumelnicu as I posted up above portDISABLE_INTERRUPTS() is called before you do the tempera...
TinyGSM Library not working with ESP32 hardware Serial2
@vshymanskyy sorry for the untidiness I have quickly assembled this example to download .bin server ...
Tasmota Alexa issue
You can try setoption41 40 PROBLEM DESCRIPTION I have been using the Tasmota version 6.3.0 for about...
Tasmota multiple switchtopics?
As you are running WITHOUT a relay it is not a sonoff and therefore anything could happen but appare...
IRremoteESP8266 Adding Support for Carrier AC 72 bit
I added some debug messages to see why 56 bit swing send does not work and so far I confirmed that t...
IRremoteESP8266 Sending Raw as hex, possible timing issues.
You probably won't love my solution but because the infoglobe protocol does not have both spaces and...
arduino esp32 Router connection: 50% failure (50% success)
@me-no-dev I suggest re-opening this issue as I am still getting this problem I am using the MH-ET L...
nodemcu firmware Policy of supporting Lua in ROM
OK It looks as if I have ironed out most of the issues and can put together an evaluation PR ...
nodemcu firmware Upgrade to SDK 3.0 -- update 1
I'll do the proper PR today or tomorrow Sorry guys but I've been a bit poorly and this has hit my ab...
esp32 snippets ESP32 BLE does not connect to Bluetooth LE Lamp (Magic Blue)
After investigating more time I've found the problem The signature of BLEClient->connect is the foll...
nodemcu firmware enduser_setup "Handling POST" failure on 310faf7 and dev
Can we roll back to the version in for the next drop to master giving someone with motivatio...
fwupd Can't update logitech unifying receiver: cannot handle firmware requirement 'not-child'
I have actually managed to install RQR24.06_B0030 by myself Here is what i did: Comment out lines 62...
Heimdall unable to compile from source
If you just want the command line tool then compilation (and download times) can be sped up ...
GalaxyBudsClient Linux port?
The port is mostly finished Some stuff such as the tray bar integration is still missing but this sh...
axios Axios catch error returns javascript error not server response
I have exactly the same environment Try this: Modify from console.log(error) to console.log(