Using a rc servo to drive my cooling (fan0)
-
Hello,
I use a servo connected to a valve to drive my cooling (i made a 24 to 5v pwm converter, hardware is ok)
I want to know how i can assign this servo like a fan0 ?
I use the following code, it work perfectly when i send manual command, but the servo could not be driven by "cooling" (fan disappear in the web interface and cannot be done by slic3r or other slicer)M950 P0 C"fan0" Q50
M280 P0 S90Any idea or solution ?
Thanks in advanceYann
I'm using
Duet3d Ethernet
Reprap fw 3
DIY Huge Delta printer -
Not sure what you're actually trying to achieve here; but lets for a second assume you're using an RC servo to control the angle of a baffle or something like that?
The difference between a fan output and a servo is the servo needs a specific pulse length to correlate to a given position; while the fan only need a duty cycle proportional to the desired speed (slightly simplified). DuetWebControl will only display slider for control of fans, not servos associated with tools afaik.
So to have a chance at making a (configured) fan output generate servo compatible pulses you'd have to adjust the frequency for the output to give you a chance of re-creating the absolute pulse lengths needed by the servo which probably mean you loose pretty much all the available resolution
ref https://en.wikipedia.org/wiki/Servo_control
setting 50Hz fan output gives you the correct period of 20ms. but of these 20ms the servo only respond to a pulse length of 1 to 2ms.
basically you can only adjust the slider between 5%(1ms) and 10%(2ms) to control the full range of the servo without changing something in software or hardware i think.
I'd try to increase the the frequency and see how low a period the servo will accept to increase the granularity of control when controlling it with
M106
as if it was a fan. Or dive into the firmware or DuetWebControl to make some changes, but thats not so trivial.(or I could be completely wrong and someone else will give you another answer)
-
@bearer said in Using a rc servo to drive my cooling (fan0):
Not sure what you're actually trying to achieve here; but lets for a second assume you're using an RC servo to control the angle of a baffle or something like that?
The difference between a fan output and a servo is the servo needs a specific pulse length to correlate to a given position; while the fan only need a duty cycle proportional to the desired speed (slightly simplified). DuetWebControl will only display slider for control of fans, not servos associated with tools afaik.
So to have a chance at making a (configured) fan output generate servo compatible pulses you'd have to adjust the frequency for the output to give you a chance of re-creating the absolute pulse lengths needed by the servo which probably mean you loose pretty much all the available resolution
ref https://en.wikipedia.org/wiki/Servo_control
setting 50Hz fan output gives you the correct period of 20ms. but of these 20ms the servo only respond to a pulse length of 1 to 2ms.
basically you can only adjust the slider between 5%(1ms) and 10%(2ms) to control the full range of the servo without changing something in software or hardware i think.
I'd try to increase the the frequency and see how low a period the servo will accept to increase the granularity of control when controlling it with
M106
as if it was a fan. Or dive into the firmware or DuetWebControl to make some changes, but thats not so trivial.(or I could be completely wrong and someone else will give you another answer)
Thanks for your reply, i know it and i tried, thats why i need to use the servo
M950 P0 C"fan0" Q50
M280 P0 S90If i use pwm for servo,
It give me ~1 to 2ms, i mesure it with my scope From 0 to 180°.
If i use pwm signal from fan, it does not work, like you describe.I just want to know how to handle servo in place of Fan regulation to be interpreted correctly by a slicer and a duet web interface
-
@yk said in Using a rc servo to drive my cooling (fan0):
I just want to know how to handle servo in place of Fan regulation to be interpreted correctly by a slicer and a duet web interface
If you want to use M106 to drive it as a fan then those are the limtaitons.
I'm guessing it'd be simpler to take the cheapest microcontroller and write a short program to measure the duty cycle of a normal fan output and map it to the pulse length of a servo. Alternatively
https://github.com/Duet3D/RepRapFirmware/
https://github.com/Duet3D/DuetWebControl/edit: or use as script to translate the relevant M106 commands generated by the slicer to M280 - however that only solves half the problem, still no control in duetwebcontrol.
-
Imagine I want to use a stepper motor to drive my cooling instead a normal fan to be understand by any slicer, this is my question
-
The answer doesn't change -
M106
which is the somewhat standarized g-code for controlling fans will control the fan output as a variable duty cycle PWM signal.If you want something else you either need to tell the slicer to send something other than
M106
or change the firmware. -
you didn't understand the question, sorry, how to substitute or have the slicer interpret the fan control by a stepping motor...
-
I think you are a little limited to the understanding of the question that I ask
-
@yk said in Using a rc servo to drive my cooling (fan0):
you didn't understand the question, sorry
@yk said in Using a rc servo to drive my cooling (fan0):
how to substitute or have the slicer interpret the fan control by a stepping motor...
@yk said in Using a rc servo to drive my cooling (fan0):
I think you are a little limited to the understanding of the question that I ask
okay, lets play stupid ... to have the slicer control a stepper motor you configure the firmware to assign a driver to an axis. Lets say axis
A
.then ask slicer to send
G1 A1 Fn
wheren
would be the speed relative to the steps/mm setting and the stepper would drive your fan a certain distance.The downside is that the printer would not be able to move any other axis in the same time as a stepper motor needs to be a coordinated move.
So what you really would need to do to make that work is to modify the firmware to allow you to control a stepper driver independently of the coordinated motion of the other stepper drivers, but if you knew how to do that I don't think you'd be wasting your time telling me how limited my understanding is.
Bye.
-
ok, thank you for your answer, how to assign to the fan a command which is not foreseen in the standard code for my stepper motor