Welcome! Log In Create A New Profile

Advanced

Marlin CONTROLLERFAN is always on

Posted by 3DEn­thu­si­ast 
Marlin CONTROLLERFAN is always on
February 04, 2016 04:57PM
Hello,

I'm using the Marlin Firmware on my selfmade cartesian 3D printer for a while now. Until yesterday I had the fan, which is cooling the Ramps 1.4 board, directly connected to the powersupply, but now I have it controllable with a mosfet, but it doesn't turn of automatically how it's supposed to be. I also update from 1.0.2 to 1.1 RC3, without any improvements in this regard. I just had some trouble with the different pindefinitions of the Ramps-version 1.3 and 1.4 and I can't see why the config below should not work.

Configuration_adv.h
//This is for controlling a fan to cool down the stepper drivers
//it will turn on when any driver is enabled
//and turn off after the set amount of seconds from last driver being disabled again
#define CONTROLLERFAN_PIN 5 //Pin used for the fan to cool controller (-1 to disable)
#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
#define CONTROLLERFAN_SPEED 255 // == full speed

If I power up the Arduino Mega + Ramps the controllerfan kicks in after a short period of time and stays on, even if I didn't move any axis, but also after a print and some M18 commands. I also tested M42 P5 S0, but just after a second or so the fan comes back on. There is another oddity that is maybe related to this problem. Sometimes on motor (the one connected to the normal Y driver slot not to the other extruder 1 one) of my dual-Y with separated drivers is activated so that the motor gets warm and I can not move the axis, although I send the M18 command. For testing purpose I also deactivated the Y-dual setup for a single time, but the controllerfan problem remained.

So I'm looking for a solution to have it almost immediately silent after a print or just some axis movement.
Re: Marlin CONTROLLERFAN is always on
February 20, 2016 08:17AM
Okay, it seems like nobody else has a similar problem.

Currently I think the problem is related to the following function:

Marlin_main.cpp

void controllerFan() {
static millis_t lastMotor = 0; // Last time a motor was turned on
static millis_t lastMotorCheck = 0; // Last time the state was checked
millis_t ms = millis();
if (ms >= lastMotorCheck + 2500) { // Not a time critical function, so we only check every 2500ms
lastMotorCheck = ms;
if (X_ENABLE_READ == X_ENABLE_ON || Y_ENABLE_READ == Y_ENABLE_ON || Z_ENABLE_READ == Z_ENABLE_ON || soft_pwm_bed > 0
|| E0_ENABLE_READ == E_ENABLE_ON // If any of the drivers are enabled...
#if EXTRUDERS > 1
|| E1_ENABLE_READ == E_ENABLE_ON
#if HAS_X2_ENABLE
|| X2_ENABLE_READ == X_ENABLE_ON
#endif
#if EXTRUDERS > 2
|| E2_ENABLE_READ == E_ENABLE_ON
#if EXTRUDERS > 3
|| E3_ENABLE_READ == E_ENABLE_ON
#endif
#endif
#endif
) {
lastMotor = ms; //... set time to NOW so the fan will turn on
}
uint8_t speed = (lastMotor == 0 || ms >= lastMotor + (CONTROLLERFAN_SECS * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
// allows digital or PWM fan output to be used (see M42 handling)
digitalWrite(CONTROLLERFAN_PIN, speed);
analogWrite(CONTROLLERFAN_PIN, speed);
}
}

Has anyone a idea? Which part could be wrong? Are there known problems, especially for a Dual Y driver setup? I'm still guessing it could one of the Y enabled states, because one of them (i think it is the one in the original Y slot, not the Extruder 1 one) does sometimes not behave like it should be. It is activated, althought the M18 command was send.
So either it is some strange behaviour of the controllerFan() function or one or some of the steppers are not disabled correctly and because of the controller fan stays on...

It would be great if somebody could give me some input. Thanks.
Re: Marlin CONTROLLERFAN is always on
February 20, 2016 10:44AM
Okay, I added a little serialdebugging lines to the firmware. I got some strange values:

the driver is actually enabled, if the epin is low = 0

after reset (all hopefully disabled):
MS:627500, lastMotor:627500 Estate X, Y, Z, E0, E1, X2, Y2:0011101 //all steppers are disabled, but why are E_Y and E_X = 0?

x,y,z enabled:
MS:665000, lastMotor:665000 Estate X, Y, Z, E0, E1, X2, Y2:0001000 //readings of X and Y don't work, but from Z and Y2

x and z enabled:
MS:312500, lastMotor:312500 Estate X, Y, Z, E0, E1, X2, Y2:0001101 //x doesn't change, but Z

Y enabled:
MS:440000, lastMotor:440000 Estate X, Y, Z, E0, E1, X2, Y2:0011000 //Y reading doesn't work, but Y2

Has anyone a idea, why the X_ENABLE_READ and Y_ENABLE_READ functions don't work?
Re: Marlin CONTROLLERFAN is always on
February 20, 2016 02:43PM
X_ENABLE_READ is defined here:

stepper_indirection.h
00036: #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
00037: #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
00038: #define X_ENABLE_READ READ(X_ENABLE_PIN)

My guess would be you have the wrong pin defined for X_ENABLE_PIN (and Y_ENABLE_PIN).
Re: Marlin CONTROLLERFAN is always on
February 20, 2016 05:13PM
Thank you, for your idea.
It seems obvious, because there couldn't be much behind the READ function. Strange is, that I can move the Y- or the Y-axis independently (thereby just the one axis comes activated) . As long as I don't disable all by the M18 command I just can't move the axis manually, which I have moved before. This behaviour and the fact that I didn't change any stepper related pins in the ramps pinmapping let me think, that those enable-pins are correct assigned.
I tried to toggle the enable-pins by the M42 command, but that didn't work on any axis. I have no ideas anymore.

(I'm now also trying to use the Repetier Firmware. With that one the controllerfan works a treat, but I can't find any Z_Min servo support...)
Re: Marlin CONTROLLERFAN is always on
February 21, 2016 06:47AM
I just found out, that if E_X and E_Y are "disabled" a could measure a voltage around 1.6v. Kind of floating state. The drivers are already disabled, but if the firmware declares them as a Input, which is strange, but could explain the floating, it reads the 1.6v as low. If I activated them, they come really low.
What happens to the E_X and E_Y and why? Which solutions are available?
Re: Marlin CONTROLLERFAN is always on
February 21, 2016 07:55AM
Okay, I found the Issue. The enable pins of the X and Y slot are faulty. The have a resistance to ground around 40Ohms, the working one a resistance of 100kOhms. Now the controllerfan works like it should.

Has anyone a idea how to fix the DRV8825 enable pin? The driver still works pretty good, its also possible to disable, but due to the high ground current the voltage drop is so high, that it reaches 1.6v and the controller reads it as low. Is there maybe a pulldown resistor on the board, which I could replace?
Re: Marlin CONTROLLERFAN is always on
February 25, 2016 02:21PM
I'm not very electronically minded, so what was the problem in human speak? A short? Where? How did it happen?

Asking as my controllerfan stays on after the default 60 seconds at which time it used to turn off.


My Instructables - both total newbie instructables and some for intermediate users.
My Designs on Thingiverse
YouTube channel containing a few 3D printing videos - they are videos for my Instructables, and mostly not standalone.
Ultius / Tantillus Thingiverse Group
Sorry, only registered users may post in this forum.

Click here to login