Controlling a 12v fan with a Heater Pin using PWM M42
-
This is how I figured out to wire it up so that it works:
I tested with two different mosfets that had different trigger values and hence the variable resistances of the pull-up resistor. So, yeah, this works. BUT it is ugly. Mostly it is ugly because it inverts the PWM signal. In other words, sending a value of 255 makes the fan stop, but sending a value of 0 turns it on full blast.
- Is there a way to wire these components & pins in such a way that the PWM signal is not backward?
- The resistor value seems kind of small. Is running this low of resistance here going to be a problem?
-
the nature of the N channel mosfet means your signal will get inverted. If you can't use M106 instead then maybe a second mosfet to invert the pwm signal again is a solution.
If you're going to use two transistors anyways, you might as well go p-channel as it has a
nfew advantages for fans, but needs a more complex circuitry. Couldn't find the url I was looking for, but this will suffice for now https://protosupplies.com/product/transistor-p-ch-mosfet-fqp27p06-60v-27a/ -
This post is deleted! -
A few thoughts
-
Pin 1 is +5V but the title here say 12V fan. Is it intentional?
-
Pin 18 is 0/3.3V range output, directly from the microcontroller. Is is safe to pull it up to 5V?
-
The resistor value is on the low side, causing pin 18 to sink current of at least 25ma.
-
What MOSFET transistor are you using? You want one that is conducting at low gate voltage. Possibly even eliminating the pullup resistor and operating on 0/3.3V gate voltage range.
Edit: any reason for not using one of the Duet's fan outputs (which already have power mosfets)? You can run them on different voltage than Vin (e.g. 24V printer with 12V fans).
-
-
@zapta said in Controlling a 12v fan with a Heater Pin using PWM M42:
Pin 18 is 0/3.3V range output, directly from the microcontroller. Is is safe to pull it up to 5V?
It's not safe to pull it up to +5V. Either use a mosfet that needs only 3.3V to turn it on sufficiently, or use a 74HCT gate or buffer to level shift it to 5V.