Welcome! Log In Create A New Profile

Advanced

Fan controll - MKS Gen v1.4

Posted by mstitdk 
Fan controll - MKS Gen v1.4
March 05, 2017 10:02PM
Hello

i will try again, under this sub cat. what pin do i add for the code below this, to control the fan on a MKS Gen v1.4, i would like to yse the 12 to 24 voltage out put on the board

//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 -1 //Pin used for the fan to cool controller (-1 to disable)
#define CONTROLLERFAN_SECS 50 //How many seconds, after all motors were disabled, the fan should run
#define CONTROLLERFAN_SPEED 255 // == full speed
Re: Fan controll - MKS Gen v1.4
March 07, 2017 08:06PM
The fan needs to be connected to a output with a mosfet

from


your options are d7,d8,d9,d10

Do you have anything in d7?

If not plug the fan into d7

set
#define CONTROLLERFAN_PIN 7
Re: Fan controll - MKS Gen v1.4
March 08, 2017 04:08AM
Quote
Dust
The fan needs to be connected to a output with a mosfet

from


your options are d7,d8,d9,d10

Do you have anything in d7?

If not plug the fan into d7

set
#define CONTROLLERFAN_PIN 7

thx a lot for your answer, that solution have crossed my mind, but i was unsure on that.

you migth also help me with a nother issue, is that the fan on hot-end is off the first two layer, is there som where with in the marlin FW something that control that as i have this coded

#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 EXTRUDER_AUTO_FAN_TEMPERATURE 40
#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed
Re: Fan controll - MKS Gen v1.4
March 08, 2017 05:05AM
"you migth also help me with a nother issue, is that the fan on hot-end is off the first two layer, is there som where with in the marlin FW something that control that"

no, that is a slicer setting. Slic3r or cura, or what ever your using.
Re: Fan controll - MKS Gen v1.4
March 08, 2017 05:50AM
Quote
Dust
"you migth also help me with a nother issue, is that the fan on hot-end is off the first two layer, is there som where with in the marlin FW something that control that"

no, that is a slicer setting. Slic3r or cura, or what ever your using.
i found that

back to subject
i get this error now

exit status 1
#error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN.


#define CONTROLLERFAN_PIN 7 //Pin used for the fan to cool controller (-1 to disable)
#define CONTROLLERFAN_SECS 50 //How many seconds, after all motors were disabled, the fan should run
#define CONTROLLERFAN_SPEED 255 // == full speed
Re: Fan controll - MKS Gen v1.4
March 08, 2017 05:52AM
i have this one

//
// Heaters / Fans
//
#ifndef MOSFET_D_PIN
#define MOSFET_D_PIN -1
#endif
#ifndef RAMPS_D8_PIN
#define RAMPS_D8_PIN 8
#endif
#ifndef RAMPS_D9_PIN
#define RAMPS_D9_PIN 9
#endif
#ifndef RAMPS_D10_PIN
#define RAMPS_D10_PIN 10
#endif

does the -1 be 7?
Re: Fan controll - MKS Gen v1.4
March 08, 2017 07:11AM
#define CONTROLLERFAN_PIN 7 //Pin used for the fan to cool controller (-1 to disable)
#define CONTROLLERFAN_SECS 50 //How many seconds, after all motors were disabled, the fan should run
#define CONTROLLERFAN_SPEED 255 // == full speed

that part work tested OK

what about the #define E0_AUTO_FAN_PIN 9

then i get this error:
exit status 1
#error "You cannot set E0_AUTO_FAN_PIN equal to FAN_PIN.
Re: Fan controll - MKS Gen v1.4
March 08, 2017 09:05AM
Error: you cannot set extruder_0_auto_fan_pin equal to fan_pin

This is caused when you try to, as the error message states, set the EXTRUDER_0_AUTO_FAN_PIN in Configuration_adv.h to the same pin as FAN_PIN in the respective pins file. For the purposes of this particular guide, the specific pins file we’re looking at is the pins_RAMPS.h file.

Before addressing the fix, let’s look at the cause.

In the Configuration_adv.h file that I’ve posted for download, look at the file around line 211 (if you don’t have the line numbers enabled, do that now by clicking File > Preferences in the Arduino IDE, and putting a check in the Display line numbers checkbox). You’ll see something similar to the following:

#define EXTRUDER_0_AUTO_FAN_PIN 9
Now look at the pins_RAMPS.h file in your sketch at around line 150, and you’ll see this:

#if ENABLED(IS_RAMPS_EFcool smiley // Hotend, Fan, Bed
#define FAN_PIN RAMPS_D9_PIN
The problem here should be pretty self-explanatory: We’re telling Marlin that the EXTRUDER_0_AUTO_FAN_PIN and the FAN_PIN are both located at the same place (the shorthand version of “9” vice “RAMPS_D9_PIN” is located elsewhere, but is beyond the scope of this issue), and thought they are technically at the same spot, technically doesn’t cut it here.

The fix is a simple one: In your pins_RAMPS.h file, modify the lines shown above to read this instead:

#if ENABLED(IS_RAMPS_EFcool smiley // Hotend, Fan, Bed
#define FAN_PIN -1 // Default is RAMPS_D9_PIN
To be clear, you don’t need to add the comment (the line marked off with the two forward slashes), but I recommend doing this in the event you want to revert back in the future—it’s great practice to keep the defaults around somewhere, and where better than the file to which they belong?

And that’s it! One simple change eliminated your pin conflict!

[3dprint.wiki]
Sorry, only registered users may post in this forum.

Click here to login