Kai,
I was thinking about that, aka "gain scheduling" based on position. However right now I am focused on getting the NEMA23 hardware completed.
What my ideal would be is a learning system, which learns the PID pole positions verses location over time and dynamically updates them. This way as you run machine it just gets better, and at any point you can graph your load verse position.
I had originally envisioned the NZS running in open loop when first installed and dynamically calibrating the encoder and the PID. Hence you just install board and let it do the rest...
Anthony,
There are lots of methods of tuning the pPID, try starting by increasing Kp until machine oscillates then dropping Kp in half then increase Ki until steady state error is acceptable, then increase Kd for stability.
After I get the NEMA 23 hardware/firmware running I will work on improving the PID tuning.
The PA term in Mechaduino is the amount to advance the phase for each step in control loop, and is the same for the NZS. This phase advancement should be the motor step size and never change. If you make it larger it is really bad as it can make motor run backwards.
The phase advancement I was looking at was predicting the phase of the motor based on the machine velocity, so for example if you are running motor at 900RPM and it is 1.8 degree motor, with a control loop update rate of 6kHz, then ever control update step the control loop is currently trying to run the following equation phase(t)=phase(t-1)+phaseUpdate(). where phaseUpdate() is the PA term or the desired new phase location. However due the velocity of the motor the equation should be phase(t)=phase(t-1) +velocity+phaseUpdate().. That is if motor is running at 900rpm at time t, the phase(t)=phase(t-1) + 900/60*360/6000 + phaseUpdate() = phase(t-1) + 0.9 + phaseUpdate().
This phase prediction of motor phase location based on the velocity which will allow motor to run much smoother at high RPMs, above around 900RPM on a 1.8 degree motor, or ~450RPM on a 0.9 degree. However there is more to running the motor at such high speeds than just this... That is the time it takes to read a step input comes into play. On the NZS the current firmware limits the step pin changing to around 50kHz, this could be increased by using a timer/counter to count steps. However even at 50kHz, with a 1.8 degree motor and 16x microstepping this is still over 900RPM.
If you have a 18 tooth 2mm pulley on your motor 900RPM is 540mm/sec.
Trampas