I’m putting together a 3 phase triple half H-bridge MOSFET variable frequency generator for a small 3 phase motor. This motor is within an engine RPM indicator, used in various cold-war era British jet aircraft. I aim to drive it from flightgear open source flight simulator. Info on the indicator here on scottbouch.com.
I need very accurate speed control, based on a parameter parsed in from Serial.
I am using millis() to run through the cycles at a variable value of milliseconds.
My demand is 0 - 100% RPM which is translated to the required AC frequency with a multiplication factor, I then am calculating the time period with T=1/F. The resulting time in milliseconds to % RPM is exponential / logarithmic, which means I have wonderfully accurate control at low RPM’s, but poor control at high RPM. I used the word resolution in the title as it is associated with size of step changes.
This is evident in this early potentiometer test I videoed, nice accurate control down low, getting rougher the higher up we go: Youtube video of test
I could only get it up to 40% RPM as anything higher, the step changes were too big and the magnetic field would collapse. I took some cycle time period measurements and using excel predicted it up to 105%.
The issue is graphically explained in the attached images.
One graph shows the relationship of % RPM to calculated Frequency as a linear relationship, the other graph is % RPM to predicted Cycle Period as an exponential / logarithmic relationship.
When observing the cycle period chart, the problem is very obvious about accurate control at one end, and rubbish control at the other end.
Clearly I can add decimal places to improve the bad end, switch to micros() instead of millis(), and also this will further improve the good end too. But are there any clever Arduino tricks, libraries etc… that would resolve this for me?