|
|
|
|
|
by Animats
2274 days ago
|
|
I've done a fair amount of timing-critical design, including control of stepping motors and encoders for specialized uses. My experience has been that "real time" programming on a mainstream computer with an operating system is a headache, if it's possible at all. It's just a lot easier to do that kind of stuff on a mid range microcontroller, where the processor has exactly one task and predictable sequencing of operations. Yes. This is just a "keep motor A in sync with encoder B" problem. That should be on something at the Arduino level, although you might need a faster CPU version. Something with no caches, no superscalar, just dumb static memory and fixed-time instruction execution. Linux would just get in the way. The loop that keeps both sides in sync should probably be running around 1000Hz or so. In one of the OP's rather long and numerous videos, he mentions 10Hz not being enough. Right. If it needs a user interface, that might be on a separate computer, with an interconnect to set the ratio in the motor controller over I2C or something equally dumb. Also, you can get stepper motors with encoders, so you can tell if you missed a step and correct. You don't have to use a servomotor, which seems to have complicated this project. Shopbots and Tormach mills use stepper motors with encoders. Many people have converted existing milling machines to CNC, and there are kits for that. This is a much simpler project. |
|
Note it's a 4096 step encoder, mounted on a different shaft than the one he's driving, that can run upwards of 2500rpm. His motor control loop (not the complete end-to-end, but the bit that maintains output position to that desired) takes under a microsecond. His code works with either a Nema 24 stepper or Nema 23 servo, and he demonstrated both.
In the second video he maths out some projections for error/drift (factoring in floating point representation error) and its ultimate impact on thread accuracy (which provides some motivation for what you might initially consider "overkill" hardware).
10hz is just the refresh rate for the tachometer calculation.