Hello Guest it is December 14, 2019, 06:13:19 PM

Author Topic: Spindle calibration, how I manage to get it working  (Read 10972 times)

0 Members and 1 Guest are viewing this topic.

Spindle calibration, how I manage to get it working
« on: December 01, 2015, 03:15:34 PM »
I have a 3 axix CNC converted Conquest mill (from Chester UK) controlled by Mach3/Geckodrive G540 and recently got quite happy to make it work with the VFD (RPM controlled by Mach3).

For that I simply disconnected the potentiometer from the mill speed control  and replaced it by an analog optocoupler and a resistor. I know G540  VFD is already isolated, but the mill circuit board was powering the low voltage electronics directly from the 220V using a voltage divider... so it got me scared to simply plug the G540 directly.

The advantage of this approach is that I got a working VFD almost for free. The disavantage is that it is highly non-linear. The spindle only starts to turn at about 30 RPM when I command 400 RPM, it  gets close to the commanded value at about a 1000RPM then it undershoots.

So I thought "Lets use the Mach3 spindle calibration and it will work fine"... Well, wrong... for some reason the calibration, at least in my version of Mach3 would not work. Probably it works for correcting small deviations but for my cheapo VFD it was hopeless...

So I read some threads here about this problem and it seems somewhat usual. People referred to a file named "Linearity.dat" so I could not resist taking a look at it.

Long story short, the linearization strategy implemented in Mach3 is actually works great. The problem seems to be the function that generates the file, it probably does not assume that a VFD could be as bad as mine  :D.

So I wrote an Excel table that takes as input the commanded RPM vc Real RPM and produces a  "Linearity.dat" file that works fine.

I am attaching the Excel file so that you guys can try it out. CanĀ“t guarantee anything but that it worked for me. But if some of you have the same issue, I hope it helps.

The way it works is the following:

1- Only make changes to the GREEN cells.
2- Enter your min and max RPM. It will generate a list with 101 input values for you to fill.
3- For each entry, command your machine to spin at the COMMANDED column (blue), take note of the real RPM it is spinning and enter it in the MEASURED column (green)
4- Click the CREATE FILE button. It will run a macro that writes a linearization file. That is the  "Linearity.dat" file that Mach3 is able to read.
5- Shut down Mach3 and copy that file as to replace the one you have. In my case it happens to be at "C:\Mach3\macros\Mill_RS".
6- Start Mach3 and try to see if the RPM is correct now.

Hope it helps.


 
 

Offline Tweakie.CNC

*
  • *
  •  8,022 8,022
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: Spindle calibration, how I manage to get it working
« Reply #1 on: December 02, 2015, 01:10:00 AM »
Excellent information Resalles, thanks for sharing.

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline Fastest1

*
  •  927 927
  • Houston, TX
    • View Profile
Re: Spindle calibration, how I manage to get it working
« Reply #2 on: December 02, 2015, 08:01:32 AM »
I am just about to take this plunge. Will be a good resource. I have had issues on previous machines setting the correct speed very accurately.
I want to die in my sleep like my grandfather, not like the passengers in the car! :-)

Offline rcaffin

*
  •  1,007 1,007
    • View Profile
Re: Spindle calibration, how I manage to get it working
« Reply #3 on: December 27, 2015, 04:25:48 PM »
Hi Resalles

Just exactly what I needed.
But it does not work for me.

The problem is that I want to create an ultra-linear file to reset my system, and the code fails at the last line. When you do a MATCH at line 103 AND column H is a copy of column G, the code ends up looking for an entry in line 104, and there is no entry there.
So I fixed that by adding another line (speed 101).

However, it still does not write out any file that I can find.
Suggestions?

Cheers
Roger

Offline rcaffin

*
  •  1,007 1,007
    • View Profile
Re: Spindle calibration, how I manage to get it working
« Reply #4 on: December 27, 2015, 06:20:48 PM »
UPDATE:

The Linearity.dat file is created in MyDocuments, not in the folder the XLSM file resides, for reasons I have not pursued. You can copy it from there to the Mach/macros folder, replacing the old file.

IF all you want to do is to kill a faulty linearisation file, then just delete it from the Mach/macros folder. If Mach3 cannot find this file, it will create a new 100% linear version when it starts. Then you can do the autocal routine again.

If you want to create a new Linearity.dat file, I recommend you first adjust the maximum pulley speed to the right value (and save settings) before you exit Mach3 and before you kill the Linearity.dat file. This may not in fact be required as the linearity file does not seem to hold any absolute data - I have yet to check.

Cointrary to what many have said, the spindle autocal routine does work. However, if your system has a noisy or inadequate spindle pulse feedback, the result may not be exactly what you want. In that case, first fix your hardware.

Peter Homann's method of tweaking the maximum pulley speed may work but it is entirely a work-around, and does not actually liearise the spindle speed. it just tweaks the maximum (or some selected value).

You can NOT freely increase the maximum speed in the spreadsheet without updating the observed spindle speed column, as that may create invalid data in some spreadsheet cells (#REF I think).

Cheers
Roger

Offline rcaffin

*
  •  1,007 1,007
    • View Profile
Re: Spindle calibration, how I manage to get it working
« Reply #5 on: December 28, 2015, 06:24:28 PM »
Further update:

It seems that the very first setting of the spindle speed, before any M3 command, only references the maximum pulley speed, and does not consult the linearity.dat file. My observations are thus:

If I adjust the max pulley speed value so that it corresponds to the output from my PWM system at 100%, then the first S setting gives the right result. So setting the spindle driver to give 3000 RPM at 100% input AND setting the max spindle speed to 3000 RPM does give the right spindle speed the very first time. This is very close to what Peter Homann was suggesting.

But if I set the max spindle speed to 2000 RPM while the spindle driver HW is set to deliver 3000 RPM at 100% PWM input, then the first S command will still scale off the 3000 RPM. S1000 will give 1500 RPM for instance.

Ah, but an S1000 AFTER the M3 command seems to load the Linearity.dat file and calculate what PWM ratio is need to get 1000 RPM. So if I want to limit the spindle speed to something lower than the HW can provide, I have to do it like this:
F100 S100
M3
S1000

Yet another slight bug in Mach3 I guess.

Cheers

Offline rcaffin

*
  •  1,007 1,007
    • View Profile
Re: Spindle calibration, how I manage to get it working
« Reply #6 on: December 31, 2015, 02:22:51 AM »
Yet another update:
Spindle calibration works fine in MILL mode.
I am still having a few issues in LATHE mode. I usually have to issue a spin command twice to get close to the calibrated spin, otherwise it runs faster - sometimes a little faster, sometimes a lot. Sigh.

The comment was made somewhere that there is little difference between spinning at 1500 RPM and 1600 RPM. This may be so on a Mill, but on a Lathe it can mean the difference between sitting right on tool/part resonance and being way off resonance and quiet. Mumble.

Cheers And Happy New Year
Roger
Re: Spindle calibration, how I manage to get it working
« Reply #7 on: January 04, 2016, 03:53:10 PM »
I converted my Sieg lathe (Microlux 7x14) to CNC this spring.  I have been able to get approximate spindle speed to work. 

Since the spreadsheet has only one column do you use the highest/fastest spindle gearing or doesn't it matter?

TIA

Offline midyo

*
  •  14 14
    • View Profile
Re: Spindle calibration, how I manage to get it working
« Reply #8 on: March 20, 2016, 10:49:22 AM »
If mach is calculating the rpm, then why does'nt mach adjust the speed or is that just too simple? Am I misssing something?

Offline rcaffin

*
  •  1,007 1,007
    • View Profile
Re: Spindle calibration, how I manage to get it working
« Reply #9 on: March 20, 2016, 05:02:21 PM »
Mach can control the spindle speed IF and only IF you are using the direct parallel port interface.
If you are using an external engine such as the SS, it cannot.

Mach does not 'calculate' the RPM: it just measures the Index pulses coming back.

Cheers
Roger