## CNC speed calculation

This formula is nothing very special but I had to think some time about it. 😉 For my CNC I need to calculate the speed of the machine in mm/min (seems this is the standart measuring unit at least in metric systems). Here it is:

An example:

– Threadpitch: 0.8mm

– Steps/Revolution: 200 Steps

– Microseconds/Revolution: 1.000 micros

Hope this is correct! 😉

## Linear interpolation

As I researched about my own custom G-Code interpreter on the Arduino I realised that it was neccesary to interpolate between two points in space. Thats because when both stepper motors step at the same time at the exact same speed a target value is reached too soon when one coordinate is not equal to the other ( x != y).

To avoid that problem one has to interpolate between the points and check if the interpolated value has to in- or decrement. I came up with this function to return an interpolated coordinate on the vector between the points:

1 2 3 4 5 6 7 8 9 10 11 |
long linearInterpolate(long a1, long b1, long a2, long b2, long C1) { long _C2 = 0; if(a1 == a2) { _C2 = b2; } else { _C2 = b1 + ((C1-a1)*b2 - (C1-a1)*b1)/(a2-a1); } return _C2; } |

Some reference and further reading on that topic here!

## The TurnMachine

I thought its time to learn something new in my sparetime so the **TurnMachine** is my first attemp in building usefull machines with the help of the **Arduino** development plattform. Arduino is an electronics plattform made especially for artists and people who want to learn microcontroller programming the first time without the hassle of studying electronics in depth. I build this as a finger exercise for Continue Reading →