Using Fan PWM to control a stepper valve?
So this is a pretty obscure use case, but on my printer I have made a stepper driven air valve that is also connected to a potentiometer to determine the position of the valve. This valve is connected to the building's compressed air supply (I made my own Berd-Air tube for part cooling)
As it currently stands, I think the easiest way to set this up would be to make a separate board with an ATTiny, read the output PWM from the Duet, and control the stepper with a separate A4988 board or something - reading the potentiometer with the ATTiny.
I was just wondering if there was some way I could do this natively on the Duet Ethernet that I am missing.
Another way would be to treat the extra stepper motor as an additional axis. Home it by driving it to the fully closed position and using stall detection. Then you can set the position of your new axis according to how open you want the valve to be. You could use a slicer post processing script to replace M106 commands by commands to move the additional axis.
Thanks! I think that will be a pretty good option, didn't even think of stall detection. I would have to drop the current to that stepper way down to have a stall at a reasonable torque - I'm using 3D printed gears on a smooth shaft (no flat on it, although I probably could add one…).
That could eliminate the potentiometer entirely though. This seems like the best option. Thanks again!
Or you could replace the parameter by an endstop microswitch that triggers when the valve is at a known position, e.g. closed.
Unfortunately the valve has a stem that doesn't travel vertically when turned (it has a "non-rising valve stem" - first valve I've ever seen like it), and it is a 10 turn valve. Without some sort of feedback - stall detection or pot - I have no way of knowing when the valve is actually closed.