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

    Pwm 5v pin duet wifi 2 gcode

    Scheduled Pinned Locked Moved
    General Discussion
    6
    15
    1.2k
    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.
    • clearlynotstefundefined
      clearlynotstef
      last edited by

      Hi friends, I'm trying to control a cpap fan that has its own controller board that needs a 5v pwm pin from my duet Wi-Fi 2 for control. I use 24v/VIN hotend fans so I can’t use a fan output to drive this (need a 5v pwm signal for this driver board). Duet WiFi 2. Fw 3.3.x, new to the new firmware so not super familiar with how to make this work… can I grab a 5v pwm pin from the unused expansion header and define it as a part cooling fan such that my slicer will turn it on and off and such? Which pin? What’s that gcode look like?

      Thanks in advance for any help!

      clearlynotstefundefined 1 Reply Last reply Reply Quote 0
      • clearlynotstefundefined
        clearlynotstef @clearlynotstef
        last edited by

        @clearlynotstef starting to wonder if this is even possible, are all the unused pins 3.3v? And the fan headers, they do the pwm on the ground rather than the +, no? So I couldn't even step down the fan+ to 5v or something? How can I get a 5v pwm pin to this driver board (and how do I tell duet it's my part cooling fan)? Hope I can make this work.

        1 Reply Last reply Reply Quote 0
        • Phaedruxundefined
          Phaedrux Moderator
          last edited by

          The Duet does it's switching on the ground side.

          Do you have a link to the controller board for more info?

          Z-Bot CoreXY Build | Thingiverse Profile

          clearlynotstefundefined 1 Reply Last reply Reply Quote 0
          • clearlynotstefundefined
            clearlynotstef @Phaedrux
            last edited by

            @phaedrux
            Most of the info is in my prior post/the screenshot/video linked therein:
            https://forum.duet3d.com/topic/28198/cpap-blower-fan?_=1650921126293

            Here's the fan/board (the 24v one):
            https://a.aliexpress.com/_m0re36Q

            clearlynotstefundefined 1 Reply Last reply Reply Quote 0
            • clearlynotstefundefined
              clearlynotstef @clearlynotstef
              last edited by

              @Phaedrux so, any ideas?

              droftartsundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
              • droftartsundefined
                droftarts administrators @clearlynotstef
                last edited by

                @clearlynotstef you are correct, all I/O pins on Duet are 3.3V. You need a level shifter. They are built in on the DueX and EBOB Duet 2 expansion boards.

                Ian

                Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                clearlynotstefundefined 2 Replies Last reply Reply Quote 0
                • o_lampeundefined
                  o_lampe @clearlynotstef
                  last edited by

                  @clearlynotstef @droftarts
                  Wouldn't it be possible to use a voltage divider? (two resistors in series, like 47k + 10k)
                  The resistors would be between 24V and GND permanently and the negative fan-output would short the lower resistor to ground.

                  alankilianundefined 1 Reply Last reply Reply Quote 0
                  • alankilianundefined
                    alankilian @o_lampe
                    last edited by

                    @o_lampe

                    When the negative fan connection stops shorting the bottom of the lower resistor to ground, the connection between the two resistors will be pulled up to 24 Volts.

                    Are you sure this fan will even work with a PWM signal?

                    From the data sheet it looks like it takes an analog voltage between 0 and 5 volts to set the fan speed. Sometimes you can drive those with PWM signals and they can sort of work, but usually not well.

                    You can look around on this site and find links to threads where someone built a PWM-to-Analog-out fan adapter and that would probably work for you.

                    SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

                    o_lampeundefined 1 Reply Last reply Reply Quote 0
                    • o_lampeundefined
                      o_lampe @alankilian
                      last edited by

                      @alankilian said in Pwm 5v pin duet wifi 2 gcode:

                      When the negative fan connection stops shorting the bottom of the lower resistor to ground, the connection between the two resistors will be pulled up to 24 Volts.

                      The bottom of the lower resistor is fixed to GND and the negative fan pin is connected between the resistors. That way, the input of the CPAP fan sees a small division of 24V according to the resistor values or it is pulled to GND when the fanport shorts the lower resistor.

                      Nightowlundefined 1 Reply Last reply Reply Quote 0
                      • Nightowlundefined
                        Nightowl @o_lampe
                        last edited by Nightowl

                        @o_lampe Would something like this help?

                        https://smile.amazon.co.uk/gp/product/B0789738RC/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

                        I appreciate it's a PWM to DC converter, but might help with your situation.

                        Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                        I'm still on my learning curve, so take everything I say with caution!

                        RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                        1 Reply Last reply Reply Quote 0
                        • clearlynotstefundefined
                          clearlynotstef @droftarts
                          last edited by

                          @droftarts related question then...Would a new Duet 3 board be able to drive this 5v pwm directly? I've been looking for a hardware reason to upgrade anyway!

                          droftartsundefined 1 Reply Last reply Reply Quote 0
                          • droftartsundefined
                            droftarts administrators @clearlynotstef
                            last edited by

                            @clearlynotstef Yes. All Duet 3 mainboards (6HC, 6XD and Mini 5+) have one output with 5V PWM signal level for hobby servos, laser or VFD. It's usually shared with one of the OUT ports, eg on Mini 5+ OUT_6 is shared with LASER/VFD pins: https://docs.duet3d.com/Duet3D_hardware/Duet_3_family/Duet_3_Mini_5+_Hardware_Overview#io-port-pin-capabilities
                            You should be able to use this for the 5V fan controller.

                            Ian

                            Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                            1 Reply Last reply Reply Quote 0
                            • clearlynotstefundefined
                              clearlynotstef @droftarts
                              last edited by

                              @droftarts @Phaedrux
                              2 related questions:

                              1. Forgetting pwm, would it be possible to get a 5v binary on/off pin that could be controlled by firmware as a fan on the duet wifi 2? The cpap board has a speed knob I could use to set the power, I can put it somewhere appropriate and just use the board to turn it on and off;

                              2. Alternatively, if I can't get a 5v pin with or without pwm, I'll see what happens if I just give it a 3.3v pwm signal. Presumably it'll just run between 0-60% or so? Is there a preferred pin to use for this with pwm? What's the gcode look like to create a pwm pin and assign it to be the part cooling fan?

                              Thanks

                              droftartsundefined 2 Replies Last reply Reply Quote 0
                              • droftartsundefined
                                droftarts administrators @clearlynotstef
                                last edited by

                                @clearlynotstef Yes, the fan pins on the Duet can be supplied by either VIN or 5V. There's a jumper to select this. But ALL fan pins will run at 5V then. If you just want a binary on/off, just set the fan pin you use to S0 (off) or S255 (on).

                                Thinking about it, if you already have other 12V fans, you could take 5V (from any 5V pin), connect it to the +ve side of the fan controller, then take a wire from the -ve side of the fan controller and connect it to the GND side of an available fan header (the fan MOSFETs switch on the ground side). That would allow you to have the rest of the fans at 12V.

                                Ian

                                Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                1 Reply Last reply Reply Quote 0
                                • droftartsundefined
                                  droftarts administrators @clearlynotstef
                                  last edited by

                                  @clearlynotstef said in Pwm 5v pin duet wifi 2 gcode:

                                  Alternatively, if I can't get a 5v pin with or without pwm, I'll see what happens if I just give it a 3.3v pwm signal. Presumably it'll just run between 0-60% or so? Is there a preferred pin to use for this with pwm? What's the gcode look like to create a pwm pin and assign it to be the part cooling fan?

                                  PWM means Pulse Width Modulation. It is not controlling the actual voltage output, just how long the pin is on for. 50% PWM means that the pin is on, at 3.3V, for half the time. By 'time', I mean the frequency set by the M950 Q parameter. So no, it won't be on at 60%. It's just whether 3.3V is a sufficient voltage to trigger the fan controller to turn on.

                                  Ian

                                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

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