By the time you do all that, you could just do it all in the AVR and have a system that works much better.
By better, I presume you mean smoother motion. I agree that the motion would be smoother. This is with the trade off that Mach now has no idea where Z is.
The concept of a PID loop is to alter the feedrate based on the rate of change of the process variable.
Yes, however, how does the isolated AVR system establish the rate of change. As far as I can tell, it only knows that the height changed, it can't actually know at what rate the height is changing since it doesn't know the horizontal velocity it's moving at. For example, if Mach is moving the axis and the height changed 0.25", we'd really need to know whether the axis is moving at 40ipm or 140ipm to establish the velocity/speed required for the Z movement. Where I can see the PID loop being used with an external THC is to tune the mechanics. This is static, since once the mechanics are fixed the tuning is related to the velocity and inertia of the axis. Also, if they are using DC servos, there's a PID loop for the servos to the shaft encoders. But, this has nothing to do with the height sensor. Could it be that the commercial THC works better due to better drive components (ie DC Servo/Encoder instead of Steppers)?
By using Mach's THC function, you're still using on/off control at a fixed feedrate. A high end THC uses a PID loop to control the Z drive directly. That allows high speeds with no over-shoot.
So, given the On/Off at a fixed feed rate how can we lessen over shoot. Since we know the feedrate, the duration we turn the THC on will provide a set amount of travel and inertia. If we tune the system, we should be able to turn off the signal early enough to avoid over shoot/deceleration. Theoretically, I could put a shaft encoder on my Z and feed it to the AVR to close the loop for even more control. And, Mach still keeps control of the Z axis. When I think about the stepper drivers, they only receive step & dir, this is similar to what were doing with the Up/Down. Mach sends pulses at a given frequency, we turn off/on for a given duration. Granted, this in no way will give us the same control, but will it be good enough... I guess I'll find out.
With starting/acceleration, the only option I see is accelerating at the maximum the axis can move. If we don't, we stand to undershoot the slope of the height change as we lack the horizontal acceleration info. Better to overshoot than undershoot in my opinion.
I believe this is what TP was getting at as a possible solution.
I appreciate your guys' input. It provides new information and also helps me work out my own thinking.
Brett