Welcome! Log In Create A New Profile

Advanced

Firmwareadjustments

Posted by Schild0r 
Firmwareadjustments
January 31, 2017 06:05AM
Cheers,

I want to improve the situation of my hotend-fan.
Marlin 1.1.0 RC8 gives me the opportunity to control my layer-fan and my hotend-fan seperatly (at the moment they both run from the same port) in the configuration_adv.h with the feature of EXTRUDER_AUTO_FAN. Therefore I have to define a pin.

My question is: Can I simply use the pins of the X_MAX_ENDSTOP which is not in use (I use the X_MIN_ENDSTOP)? The pins are [D2; GND; 5V]
Would I set the EXTRUDER_AUTO_FAN_PIN value from -1 to 2 and the X_MAX_PIN value from 2 to -1 then and connect the fan with D2 and GND?

Thanks for your help
Re: Firmwareadjustments
January 31, 2017 06:56AM
It is smarter to check things in the pins.h file. You can swap pretty much any set of pins with any other similar set, amongst other tricks.


... but for what you want, just find a pin that isn't being used and put the setting in there somewhere. Unused endstops should be fine.

It has to go in the bit that defines your particular board. If you don't know your board, you have to do it in ALL of them.

Not everybody has Arduino and Ramps, but most people have spare pins. If a set dies on you from hardware failure, and you have a spare unused set, you can remap them, and carry on using that controller for awhile.

Edited 4 time(s). Last edit at 01/31/2017 07:01AM by DragonFire.
Re: Firmwareadjustments
January 31, 2017 07:56AM
In the pins.h file there are just all boards included. My board is the mks base (attached .pdf). In the pdf. you can see that I have 6 slots for endstops but only three are being used. This is the reason why I want to use one of these for another fan.

In the Board_mks_base.h there is only one pin setting for another extruder and then there is the board_ramps.h included.
In this file (board_ramps.h) i want to disable the X_MAX_PIN by setting it to -1 (from 2).
But i can't find the EXTRUDER_AUTO_FAN_PIN there so i want to define it in the configuration_adv.h file because this option is there defined by default (but disabled because of the value -1) and the comment there explicitly says "if you can't find this setting in your boards file you can overwrite it here"
Attachments:
open | download - MKS_BASE_PINS.pdf (141 KB)
Re: Firmwareadjustments
January 31, 2017 07:57AM
So do you agree that my plan should work or is there a mistake I don't see?
Re: Firmwareadjustments
January 31, 2017 07:53PM
You can use any IO pin, but you cant use it directly. And yes using X_MAX_PIN should be fine

You must use a mosfet on the pin to actually control the fan power.
Re: Firmwareadjustments
February 01, 2017 02:13AM
Does the MOSFET connect to al three pins then [D2; GND; 5V] and has two outputs for the fan?
Re: Firmwareadjustments
February 01, 2017 02:22AM
Something like that?

As I understand the MOSFET is only needed when I want to controll the fan (different speeds)
But do I need it when I only want to run this fan at full speed?

Edited 1 time(s). Last edit at 02/01/2017 02:44AM by Schild0r.
Attachments:
open | download - Screenshot_20170201-081704_01.png (262.4 KB)
Re: Firmwareadjustments
February 01, 2017 05:31AM
An io pin can only drive 5v and at very low current. Most fans are higher voltage, I also wouldn’t want to drain all that current threw the micro

It has nothing directly related to speed control. (That's PWM, a feature of some IO pins)

Most fans people have are 12v.


A mosfet is used when you need to control a device that needs higher current or voltages than an IO pin can handle.

"MOSFET connect to al three pins then [D2; GND; 5V]" "and has two outputs for the fan"
Sorry no.


This is a very primitive description of mosfet operation.
Mosfet has 3 pins. Gate (this turns the mosfet on and off), Source , Drain (is connected to source when on)

Take a look at [reprap.org]
In the box on the left middle, heaters and fans. The P$1, P$2 etc are the screw terminals you attach fans and hotends and beds to.

We will use D9 as our example, but all 3 mostly the same.
IO pin D9 is applied to the mosfet gate
In this case the mosfet is what is known and a N-channel (think negative) so it controls the ground line.
The source is connected to GND and the drain is connected to the negative of your fan.
The positive of your fan is connected directly to the power supply (+12v or +5v or what ever) (see all the odd numbered P$ screw terminals)

When D9 is off, Source and Drain are not connected. so the circuit has no GND and no electricity will flow
When D9 is on, the Source and Drain are connected, so the circuit has a GND and electricity flows and the fan will turn.
Re: Firmwareadjustments
February 01, 2017 06:10AM
Okay first of all thank you for explaining it in detail to me but there ist one thing I want to ask:
I have a 5V fan and you said the pins cannot handle very much of current. Does that only apply to IO pins or to the pins of endstops and so on in general?
Because after your description I would connect the Gate to my D2 now (which was the X_MAX_PIN) and Source to the GND pin right next to D2 (normally this pin would be connected to the endstop as well) and the VCC cable of the fan to the 5V pin next to the GND pin (also normally connected to an endstop).
Is that correct or do I have to use a 5V and GND screw terminal (unfortunately there is no unused set left)?
I would use the 12V Screw Terminal then which is directly connected to the power supply and put a resistance in line with the fan. This should work doesnt it?

Edited 1 time(s). Last edit at 02/01/2017 06:14AM by Schild0r.
Sorry, only registered users may post in this forum.

Click here to login