Linear Interpolation

Inter who? I hear you shout !

Interpolation with motors is to have all motors start and stop at the same time, no matter what the distance is, and even if the distance is different for each Axis.

Simple I hear you shout again!, if we have one motor that needs to have 1000 pulses sent to it and the other motor needs 2000 pulses sent to it and we want them to start and stop at the same time. We simply send 1 pulse to motor1 and 2 pulses to motor2. Yep that will work but what if we need to send 1000 pulses to motor1 and 2222 pulses to motor2, can we really send 1 pulse to motor1 and 2.222 pulses to motor2?. No we cannot as we cannot sent 0.222 of a pulse and also saving up the 0.222 pulses, till we get a full pulse and then sending it, also throws the motors out of sync at so many steps and it gets very complicated.

So this is where again the PTHAT comes in handy as it will allow high resolution frequency pulse trains be produced via the on board DDS processors.

Calculating Interpolation

Lets say we have motor1 that needs 1000 pulses and motor2 that needs 2222 pulses to reach the target travel distance.

As in other examples above we have ballscrews with a 5mm pitch and motor drivers set to 1600 Pulses Per Rev.

We want to go at 100 RPM, so lets do the calculations on the biggest amount of pulses first motor2.
We take our Pulses Per Rev of 1600*0.01666666666=26.666666656 and multiply the result by the RPM required 100*26.666666656=2666.66Hz.

That is motor2 frequency calculated to 2666.66Hz, so it runs at 100 RPM.

Now for motor1 we first divide motor2 pulse by motor1 pulses 2222/1000=2.222 and divide the frequency of motor2 by the result 2666.66/2.222=1200.11Hz

The final result being, is that we:
Run motor2 at 2666.66Hz (100RPM)
Run motor1 at 1200.11Hz (45.45RPM)
Now motor1 and motor2 will start and stop at the same time and both would of done the target pulses.

There are other ways of calculating these numbers and expressions to be used, but I want to try and break it down into easy steps for people to understand.

Here is a scope shot of the PTHAT loaded with the values above and sent to the X and Y Axis motors.

Share This