Pwm 5v pin duet wifi 2 gcode
-
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!
-
@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.
-
The Duet does it's switching on the ground side.
Do you have a link to the controller board for more info?
-
@phaedrux
Most of the info is in my prior post/the screenshot/video linked therein:
https://forum.duet3d.com/topic/28198/cpap-blower-fan?_=1650921126293Here's the fan/board (the 24v one):
https://a.aliexpress.com/_m0re36Q -
@Phaedrux so, any ideas?
-
@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
-
@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. -
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.
-
@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.
-
@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.
-
@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!
-
@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
-
@droftarts @Phaedrux
2 related questions:-
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;
-
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
-
-
@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
-
@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