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

    Code for making a fan always run during a print

    Scheduled Pinned Locked Moved
    General Discussion
    3
    7
    224
    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.
    • Feynman137undefined
      Feynman137
      last edited by

      Hello I have a duet mainboard 6hc and I have two fans which cool each of my XY steppers. I'd like the fans to run during all of my prints. How can I accomplish this? Do I need to edit the config file of my printer and also the start gcode?

      For reference my board is a duet mainboard 6hc. And the fans are on out7 and out8.

      OwenDundefined 1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @Feynman137
        last edited by OwenD

        @Feynman137
        You need to define the fans in config.g using M950
        e.g. M950 F3 C"out7" Q100

        Then you could put M106 in your start.g (this will run before any slicer code)
        M106 P3 S255

        and turn them off in stop.g (this runs if you use M0 at the end of print in your slicer).
        M106 P3 S0

        start.g and stop.g must be created in your /sys directory.

        Alternately use M106 in your slicer start and end gcode sections to start and stop the fans.

        Feynman137undefined 1 Reply Last reply Reply Quote 2
        • Feynman137undefined
          Feynman137 @OwenD
          last edited by

          @OwenD

          Interesting this explains a lot. I was just using the slicer start g code did not know it was an option to create a start.g file!

          I am not using a PWM controlled fan. So do I need the Q100 portion and does this actually impact anything?

          OwenDundefined 1 Reply Last reply Reply Quote 0
          • OwenDundefined
            OwenD @Feynman137
            last edited by OwenD

            @Feynman137
            Using the slicer start and end code is fine as long as you've configured teh fans in config.g
            the Q parameter of M950 is the PWM frequency.
            If you leave it out, RRF will use the default.

            Refer to the docs for M950 and wiring fans

            Feynman137undefined 1 Reply Last reply Reply Quote 1
            • Feynman137undefined
              Feynman137 @OwenD
              last edited by

              @OwenD

              But there is no PWM freq for a 2 wire fan right? Just Vcc and GND so what does the PWM frequency mean in this case?

              OwenDundefined deckingmanundefined 2 Replies Last reply Reply Quote 0
              • OwenDundefined
                OwenD @Feynman137
                last edited by OwenD

                @Feynman137
                The ports you're using are PWM capable.
                Any dc motor can be driven by a PWM signal which uses the full voltage at a defined duty cycle.
                Some fans don't work well at low PWM values. 2 wire fans are more likely to fall into this category especially at low PWM values. This can be helped if teh right frequency is used for the fan.
                If you use M106 with an S value of 1.0 or 255, you are using 100% duty cycle, so effectively not using PWM.

                1 Reply Last reply Reply Quote 1
                • deckingmanundefined
                  deckingman @Feynman137
                  last edited by

                  @Feynman137 In addition to what @OwenD has said, be careful about the terminology. Pulse Width Modulation (which is what PWM) stands for essentially means turning the suppyly voltage on and off in pulses. The PWM value is essentially the ratio between the on pulse and the off pulse. So a PWM value of 0.5 means that the on pulse will be equal in time to the off pulse. A PWM value of 1.0 means that the fan will be permanently on. The PWM frequency is the number of cycles per second. If the requency is say 100Hz, then one cycle will take 10 milliseconds. If the PWM value is 0.5, the the on time will be 0.5 milliseconds and so will the off time. If the PWM value is 1.0, then the on time will be the full 10 milliseconds.

                  Ian
                  https://somei3deas.wordpress.com/
                  https://www.youtube.com/@deckingman

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