Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Controlling a 12v fan with a Heater Pin using PWM M42

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    4
    5
    334
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • punamenonundefined
      punamenon
      last edited by

      This is how I figured out to wire it up so that it works:
      Fan control on Duet 2 Pin 5 using M42

      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.

      1. Is there a way to wire these components & pins in such a way that the PWM signal is not backward?
      2. The resistor value seems kind of small. Is running this low of resistance here going to be a problem?
      punamenonundefined 1 Reply Last reply Reply Quote 0
      • A Former User?
        A Former User
        last edited by A Former User

        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/

        1 Reply Last reply Reply Quote 1
        • punamenonundefined
          punamenon @punamenon
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • zaptaundefined
            zapta
            last edited by zapta

            A few thoughts

            1. Pin 1 is +5V but the title here say 12V fan. Is it intentional?

            2. Pin 18 is 0/3.3V range output, directly from the microcontroller. Is is safe to pull it up to 5V?

            3. The resistor value is on the low side, causing pin 18 to sink current of at least 25ma.

            4. 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).

            dc42undefined 1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @zapta
              last edited by

              @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.

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Unless otherwise noted, all forum content is licensed under CC-BY-SA