I am indeed using a stepper motor to drive a fan, everyone will say it makes no sense but it actually does. The torque to speed ratio is great, the cost of the motors is low, they are easy to get in several sizes, and the buzzing can be eliminated with passive isolation and sine wave drive.
I wrote a driver that uses a current sensor on the power supply side, and optimizes current, to optimize energy efficiency, because I found with 3 phase motors in the past that the point when the so called torque angle i.e. the magnetic field of the stator vs the magnetic field of the rotor (so when open loop and no load, it should be close to zero, with true FOC drive it should be close to 90 degrees) is close to 90 degrees, energy efficiency is also optimal.
Simple, no sensors needed, assuming the fan is not subject to shock or anything. Stall detection I have a plan for, as well as verifying the motor is not moving prior to start up.
There is a voltage ramping thing that increases the voltage to some function of the RPM, basically. The optimizer just adjusts a trim voltage to try to optimize the current.
But here’s the amazing thing. I thought the optimizer was not working, because when I loaded the motor, or adjusted the power supply, the “voltage” commanded by simplefoc did not change much. I.e. motor.voltage_limit, which is used in open loop to set the voltage (it’s not really named quite right in that context, but whatever, because it is not really a limit, it’s always at whatever it’s set to), was not changing.
The current would go up though when I loaded the motor by putting my hand on the shaft etc. Similarly, it would go up, and the energy consumption stayed very nearly the same even when I changed the power supply voltage by turning the knob on the power supply.
I can reduce the power supply voltage from 24 volts down to about 17 volts and it automatically self regulates, with the motor at about 350 RPM, during that experiment. It works fine at 400 rpm.
I cut out the optimizer, by commenting out that code, and the behavior is exactly the same. Somehow, the system is superbly self regulating. I might as well be using a fancy sensor and have a well written FOC drive system or something. It all works great, when the motor is actually just being driven open loop.
An incredibly convenient discovery: a normal stepper motor can be used great to drive actual power producing loads, with no sensor or anything. Just voltage ramping. I can try to get the code up later, I am on the wrong computer right now, but seriously it’s voltage ramping with a minimum voltage i.e an affine function. That’s it. And it’s driving my fan with nearly complete silence, using rubber isolators.