Although the downloaded Marlin firmware already has a standard calibration for the axis resolution, you will have to go through this step if you want a precise printer. Here you will tell the firmware the steps per millimeter that your machine actually needs. This value depends on the steps per revolution of your motor and on the size of the thread in the driving rod of your axes. By doing that we make sure that the movement of the machine actually corresponds to the distances in the g-code.
Knowing how to do that will allow you to build a CNC-machine of your own with independence of the component types and sizes.
In this case, X, Y and Z axes have the same threaded rods so the calibration values will be the same for them (but that might not be the your case if you use different components for the different axes).
We will have to calculate how many motor steps are needed to move the carriage 1mm. This depends on:
The pulley radius.
The steps per revolution of our Stepper motor.
The micro-stepping settings in the electronics (in our case 1/16, which means that for one step signal, only 1/16 of a step is performed, giving a higher precision to the system).
We set this value in the firmware (stepspermillimeter).
For the Z axis:
Using the Controller interface (Repetier) we tell the Z axis to move a certain distance and measure the actual displacement.
As an example, we tell it to move 10mm and measure a 37.4mm displacement.
Being N the number of steps defined in stepspermillimeter in the firmware (X=80, Y=80, Z=2560, EXTR=777.6).
N = 2560
N = N*10/37.4
The new value should be 682.67.
We repeat this for 3 or 4 times recompiling and reloading the firmware to the controller, so that we get a better precision.
In the present project we have not used end-stops in order to build a more affordable machine but they could be incorporated easily and the firmware is ready for them. Heaving end-stops makes homing the machine more easy. The lack of them will force us to bring the machine manually to the origin of the printing area.
We are ready for a first test, we can use a pen to test if the distances in the drawing are correct.