# 2 stepper cnc inaccurate

I'm building a simple cnc machine that just writes letters. It uses 2 steppers for x and y axis.

Here is how it works

1. generate letters in c# and convert them to list of lines
2. send to arduino mov_xy line.x line.y as string for each line
3. on arduino convert to int, multiply by steps per mm and run with speedy stepper

It eventually builds up to accuracy problems. If it's writing "ZWX", letter "X" would be slightly to the side.

Things i tried:

• 500000 baud rate
• accumulate remainder of float number of steps
• different usb cables
• different cnc machines

It is serial communication error?

Do i need to implement CRC?

Can UNO handle this?

Does SERIAL_8E1 do parity check automatically or do i need do something?

I went trough everything many times. What am i missing here?

This image is generated directly from letter lines in c#, so i doubt the problem is on c# side.

• reduce the complexity of the problem ... instead of ZWX, try engraving three simple squares Feb 14 at 22:16
• Instead of actually driving the motors, you could calculate the position. That would rule out inaccuracy from the motors. Send shapes, that return to the starting point. Add up all steps (the actual steps, after the conversion from the float number), as your CNC code would do with the motors. Then display the endposition, that comes out of your calculations. That would show the accuracy of the calculation part and you can see, if thats the problem. Feb 14 at 22:58

I forgot to take care of negative steps in remainder accumulation. This solved it.

``````// x accum
float resX = mmX * (float)X_STEPS_PER_MM;
float lresX = (long)resX;
_x_acum += resX - lresX;

long extraStepsX = 0;
while(_x_acum > 1.0f){
_x_acum -= 1.0f;
++extraStepsX;
}

while(_x_acum < -1.0f){
_x_acum += 1.0f;
--extraStepsX;
}
// move stepper for lresX + extraSteps
``````