Spindle Speed Control and Linear8
=================================

Speed control in SheetCNC is complex:
 - The G-Code calls for a speed.
 - LinuxCNC converts the speed to a PWM signal on a parallel port pin.
 - The breakout-board converts the PWM signal to a 0-10V analog voltage.
 - Finally, the VFD converts the analog voltage to the commanded speed.
 
Clearly, there is scope for errors in the process. And, indeed, the speed
attained by the spindle is likely to be very far from the commanded speed.
Errors of 10%, sometimes 20% are likely.

This can be corrected using an optional feature called 'linear8'.
We've included  linear8 in our configuration, but you need to calibrate it.

                         ----- // -----
                         
To calibrate LINEAR8 in SHEETCNC's configuration, take the following actions:

 - Run the default configuration of SheetCNC.
 - Turn on the VFD. The spindle should run at 1260rpm.
 - Input MDI commands in the form 'M03snnnnn' where 'nnnnn' is a RPM.
 - Determine the values of 'nnnnn' which are those which cause the
   actual speed of the spindle (as reported on the VFD) to reach exactly
   the following values:
    1260, 4508, 7757, 11006, 14255, 17504, 20753, 24000
 - Note that for the speed 1260 you need to find the HIGHest value of nnnnn
   which reliably sets the spindle at 1260rpm. For the speed 24000 you
   need to find the LOWest value of nnnnn which reliably sets the spindle
   at 24000 rpm.
 - Navigate (in Thunar) to ~/linuxcnc/configs/SHEETCNC.
 - Edit the file SHEETCNC.hal .
 - Near the bottom of the file is a list of number pairs:
      setp linear8.0.x0 1260
      setp linear8.0.y0 1260 etc
 - The "x" numbers are the values you want the spindle to achieve.
 - The "y" numbers are the nnnnn values that you needed to 
   input to cause the spindle to achieve that desired speed.
 - Change the "y" number under each "x" number to the matching value
   of nnnnn that you previously determined. Do not change the "x" numbers.
 - Close and save the file.
 - Test as follows:
 - Input MDI commands to set the speed to 1260, 1300, 5000, 10000, 23500, and 24000rpm.
 - Check that the actual speeds attained closely match the commanded speeds.

