Code for making a fan always run during a print
-
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.
-
@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.
-
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?
-
@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
-
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?
-
@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. -
@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.