Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: TonyP on December 27, 2007, 10:46:20 AM

Title: Spindle Speed setup
Post by: TonyP on December 27, 2007, 10:46:20 AM
Hi all,

I've just upgraded to V3.0 and am having some problems with the spindle calibration. I had, by trial & error got a pretty good calibration both in open & closed loop on my old V2.52 installation. I created a profile and carefully saved the xml, then re-installed it after the upgrade. I found that my hard won calibration had vanished!
I've not found any information about using the spindle calibration function and have always had a problem getting it to perform.  The defaults button doesn't seem to get rid of existing corrections.
Can anybody give me ?
1: A clear explanation of how Mach handles spindle speed. Is the data really in the xml?
2: How to use the setup procedure correctly.
I'm using turn, if it makes any difference.

Title: Re: Spindle Speed setup
Post by: tmsmith on December 27, 2007, 06:14:50 PM
I tried the 'calibration wizard' when I fitted spindle control and could not use it successfully.
I was told to forget it, and I obtained reasonable calibration and good control without it.
In fact if you want to ruin your good control just run the wizard.

My 2p worth.

Title: Re: Spindle Speed setup
Post by: softselect on December 28, 2007, 03:50:16 AM
HI everyone,
I have the same problem after upgrading to V3.0. it worked OK on v2.5xx.
With the upgrade my XML file got screwed up and no i didn't have a backup,because i was a fool I didn't think it would be affected by upgrading.
I was in the process of testing Mach3 after getting frustrated with EMC, Linux doesn't work for me.
I have been using TurboCNC for a few years now, so my electronics are tried and tested. but TurboCNC has some funnies with tool offsets
With V3.0 I get the setting changing after a restart the PC even after saving settings.
With V2.5xx i was having a close loop problem with the index pulse and PWM. but after reading some of the posts I was getting there, till the upgrade. once again I wiped the old version so I cant go back.
I think my problem may have been related to the 25k limit on the demo.
so before i purchase Mach3
1. can any one tell me if they have success with the spindle feed back loop as this is used for threading and i do a lot of very fine threading 0.4mm pitch.
2. does Mach3 initialize the LPT at start up, i sometimes experience a flutter on some of the outputs
My breakout goes via a buffer (74HC541) chip and pull up resistors on both ends and the enable line is controlled by the charge pump circuit.
Thanks in advance.
Title: Re: Spindle Speed setup
Post by: TonyP on December 28, 2007, 05:19:39 AM
I'm slowly getting back where I was by a process of altering the step & velocity in motor tuning, while asking for the max spindle speed for the pulley setting. I've done this in open loop and can get within a few revs of the speed this way. When I close the loop it all comes in pretty well. I think that the setup process would linearise the open loop once the basic settings are about right. The problem is that the 'default' doesn't seem to do anything so any corrections seem to be cumulative.
Friedrich, apart from my problems with the upgrading, the feedback seems to work fine for threading. I haven't done a lot yet, but the tests that I have run seem ok. I'm just using one slot on the spindle disc (the wizard doesn't seem to get this right either). I don't think that you need to use closed loop for threading.
Not sure about the LPT flutter. If you're using a charge pump nothing should be enabled until about halfway through boot-up, but only if you have 'chargepump on in Estop' checked in general config.

Title: Re: Spindle Speed setup
Post by: softselect on December 28, 2007, 05:33:47 AM
Hi TonyP,
Thanks for the reply, I am of the opinion that the flutter has something to do with the LPT base address, the card I am using emulates LPT1 base address at E378, so until the driver kicks in it toggels on the port but not on the machine due to the charge pump, I will remedy this with a new LPT card, the problem is with fancy plug and play and PCI you cant predict what will be the base address.
I picked this up by having my scope connected to the port pins (before the breaout)
If you are happy with Mach3 performance I will purchase a licence that way eliminating the 25k kernel restriction.
Thanks Friedrich ;)
Title: Re: Spindle Speed setup
Post by: jimpinder on December 28, 2007, 06:06:14 AM
I am interested in this subject because I have just purchased a board to convert the PWM signal to a 0 - 10 v signal to regulate my Omron inverter (the spindle motor driver). I already have feedback from the spindle to the computer for r.p.m. measurement.

Are we saying there are difficulties in marrying the two together, to get true automatic speed regulation of the spindle ????
Title: Re: Spindle Speed setup
Post by: TonyP on December 28, 2007, 06:43:06 AM
no the system works ok. It's just that the setting up is a bit vague. There is a paragraph or so in the manual about it, but you really have to play with it a bit to understand what's going on. ( I think I know now, but I'd really like to know for sure)
The key seems to be to start with the control system giving out it's max (pwm ratio 1). Set that speed as max for that pulley, ask for it in spindle revs, then juggle the step & velocity numbers to actually get that speed or a little more. (all in open loop). When you've done that you can close the loop. The spindle should settle at the correct speed. It is probable that you'll then have to play with the three PID numbers to obtain a fast speed change with a minimum overshoot.
Friedrich, don't worry about my grumblings. I think Mach is great, and a real bargain for what it does. I just think some of the nuts & bolts need tightening!

Title: Re: Spindle Speed setup
Post by: jimpinder on December 28, 2007, 08:55:17 AM
Tony - thanks for that - because the board is on it's way from Australia !!!

I will have another read of the Mach3 set up manual when it comes.
Title: Re: Spindle Speed setup
Post by: jimpinder on January 02, 2008, 09:39:41 PM
Got my board and fitted it up, and after a bit of fiddling with the settings, it worked.

I used the automatic calibration. If you do this manuall, you never seem to get anywhere. The machine says successful run, store data, or something similar. So I stored the data. Then I manually  put in an M3 S600 command - and the speed was nowhere near. Did the automatic set-up about 4 times - no better.

I closed Mach3 Turn and opened Mach 3 Mill and tried again - same result.

I went back to Mach 3 Turn and put in a speed and it came out spot on with the requested speed. Back to Mill - same thing.

You must have to close down and restart for the data to have effect.
Title: Re: Spindle Speed setup
Post by: TonyP on January 03, 2008, 04:51:48 AM
glad you're getting going. I've not tried running in Mill (as I only have the lathe) but the spindle data won't be the same for both, I think. I've been poking around some of the files to see If I can find where the data lives & I think it's in the Macros folder under the appropriate machine profile. There is a .DAT file in there 'linearity.dat' which may be it. It makes reasonable sense to have different data for different machines, but I suspect that these files get overwritten when you upgrade - which explains the loss of calibration.
I would expect to have to do a setup for every different machine, as Mach can't know that they really are the same one.
On the speed & index front I have, thanks to Graham Waterworth, improved matters. He told me that instead of using the INDEX input in config, he uses the TIMING input and has 4 slots on his disc, with one 50% larger than the others. I knew about the slots, but hadn't done it because I couldn't see how Mach could know there were 4 if it couldn't get 1 right.
I went halfway and cut a second slot opposite the first, which I doubled in width. The software came up with 2 slots ok, but didn't at first show a spindle speed. After I changed the Hi/Lo active setting it started reading ok. I cut a few threads with the loop closed, but the speed wouldn't hold steady & I got pitch errors. With the loop open I managed a couple of satisfactory runs in brass. Today I'll put the other 2 slots in & see if there is any further improvement.

Title: Re: Spindle Speed setup
Post by: jimpinder on January 03, 2008, 01:30:18 PM
My machine is a lathe with a milling head, run off the same motor. I have no pulleys on the lathe drive - that is more or less direct. There are a couple of pulleys on the mill head, but I have only bothered with one yet.

The way the automatic configuration seems to work is that the computer puts out a PWM signal to your driver board, starting at a low speed and ramping up, and then compares the speed it thinks it has set with the actual speed as per your spindle inde. Mine spindle seemed to be about 10% too fast. I would have thought then you would do it again and the computer would gradually adjust itself until it was correct, and announce itself.

It doesn't seem to matter how many times you calibrate, it always goes through the same procedure, but when you save, shut down and then restart the speed setting appears spot on (It is on mine anyway)
Title: Re: Spindle Speed setup
Post by: TonyP on January 03, 2008, 02:29:33 PM
I put the other 2 slots in this afternoon and I think it was worth it. I cut the same M6x1 thread in steel this time and it worked pretty well - fitted the nut anyway! So, to summarise, I'm now running with 4 index slots (1 at 2x width) open loop. I'm also using the timing input, which is mentioned in the manual, if you know where to find it. It's mentioned as a sort of aside in the spindle setup section.


Title: Re: Spindle Speed setup
Post by: softselect on January 08, 2008, 05:20:18 PM
Hi Tony
Did the 4 slots work,
I have tried the 4 slots, 1x 50% bigger, It works but it doesnt.
I had it working perfectly, save settings a few times. shut down
when i restarted the next day, no go!. I made print screens so i could check my setups, and all are OK.
The revs seem to jump around. checked with a scope and the signals are square and clean.
I also noticed now the LED for spindle on Flickers on and of at about 1 hz
Any ideas
PS deleted the Mach driver and ran driver test to reinstall
I know you setup is different but could you perhaps send me a copy of you XML file so I can look what you have done , I may be missing something very simple
Thanks Friedrich
Title: Re: Spindle Speed setup
Post by: TonyP on January 09, 2008, 03:04:52 AM

I'll try & send an xml later on when I've woken up a bit! The lathe is on another PC.
There are two things that I would check: first, that I'm using the TIMING input NOT the INDEX - this was a change to my original 1 slot system. The other thing is to try the opposite polarity in 'Active HI/LO' for that input. One way works for mine, the other doesn't.
Don't know why it shouldn't stay saved though.

Title: Re: Spindle Speed setup
Post by: jimpinder on January 09, 2008, 04:00:17 AM
Have you two tried messing about with the index debounce under general config.

I calculated the maximum speed my spindle would turn, and therefore the interval between the pulses I was going to detect. I ramped up the index debounce time so it was a little under the estimated pulse time. This seemed to give a much steadier detection of speed with far fewer odd readings, particularly at low speeds.

The only problem I have is at very slow speed - under 100 rpm. I think the mirror that I use as a reflector has a bit of a  distortion in it, therefore at low speed, I sometimes get a double "flash" which isn't blocked by the  index debounce. I might try and shorten the mirror, because it is too long anyway.

Even with index debounce, there seems to be a point where "harmonics" come in and I get a little distortion in the reading, but other than that I am pretty pleased with it,
Title: Re: Spindle Speed setup
Post by: softselect on January 09, 2008, 05:44:46 AM
Hi JimPinder
I have the port setup as timing, and i have played with the debounce, currently set at 4
The strange thing is that it all worked perfectly after i made the 4 slot disc, my biggest problem was noise but after earting the PC, controller and VFD to a common point on the lathe that all went away (Star topology). Even though the signal is clean the symptoms are a dirty signal
I think I must wipe the disc and start over.
Thanks Friedrich :(
Title: Re: Spindle Speed setup
Post by: TonyP on January 09, 2008, 02:43:04 PM
Sorry about the delay, I got tied up with work.

Here's my xml.
Title: Re: Spindle Speed setup
Post by: randyray on March 26, 2008, 01:53:31 AM
Maybe it's me...but I am using speed control and feedback...and it works......even the "Calibrate Spindle" stuff seems to work. What I can't figure out is where in any doc (pdf, forum, or wiki) does it explain the whole "Calibrate Spindle" thing. I can't find any reference to it. I'd like to see an explanation of all of the numbers and a little more than the quick blurb in the pdf about how the PID works (I know what it does)......but the calibrate doesn't seem to change the PID I? When I change speeds on the spindle, it takes Mach a several seconds to settle down on an anticipated voltage to send it and I think this is the PID working but I need it to learn and tune itself up faster as it goes....this would mean seeing the PID numbers change a little over time.. Thanks for any help here?
BTW, I running a Hermes 1219 engraver (modified with a Sherline speed control and motor), running on a Jim Cullins/Bob Campbell Combo board and using a Fairchild  QRB1134 reflective object sensor....and turning about 500 to 25,000 rpm)
Randy Ray
Texas MetalCraft
Texas MicroCircuits