Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: SimonD on May 04, 2008, 04:55:46 AM

Title: Spindle Index problem.
Post by: SimonD on May 04, 2008, 04:55:46 AM
I am trying to use a CNC4PC C3 index card into a C11G BOB. I am wired into pin15 for the index, I have tried pin10 and it made no difference.

My spindle disc is 125mm diameter. The spindle should run at 3200 rpm.

The slot width calc gives...

0.0088 x 0.0012 x 3200 x 125 = 4.224mm

The slot in the disc is 6.3mm wide.

Mach3 sees the index pulse when I turn the spindle by hand, I have tried both active low on and off.

Mach3 sees the speed upto about 200 rpm but anything above that and it still reads somewhere between 200 and 250 rpm. it never goes any higher.

What am I doing wrong?

Title: Re: Spindle Index problem.
Post by: Hood on May 04, 2008, 05:00:39 AM
Simon, few things you could try
Try setting the Index Debounce up a bit
Try making the slot a bit wider (10mm is what I use)
 Try using 2 slots, one wider than the other then setting it up to use Timing in ports and pins, Inputs rather than the Index.
Title: Re: Spindle Index problem.
Post by: SimonD on May 04, 2008, 05:07:37 AM
Thanks, I'll give them a try...
Title: Re: Spindle Index problem.
Post by: M250cnc on May 04, 2008, 05:27:36 AM

Is there anything to be gained by having more slots I.E. more accuracy

Title: Re: Spindle Index problem.
Post by: SimonD on May 04, 2008, 05:41:50 AM
I seem to be able to get Mach3 to read just about any rpm value I want for the same spindle speed...

I set the debounce level down from 100 to 10 and it looked promising so I ran the spindle calibration... it seemed to run well but afterwards the machine only runs at full pelt or nothing. It doesn't seem to be taking into account any acceleration or deceleration values. Afterwards I tried an S200 command and it tried to accelerate the spindle so fast it blew the main circuit breaker!

The index debounce was set to 100.
If I set it to 200 then it reports one value, if I set it to 400 then it reports a different rpm even when the spindle is running at the same speed?

The "calibrate spindle" dialog has a bit about number of slots and states that the value should be 0 for 1 slot but mine is reading 1, could this be causing the problem? how do I set this value?

Title: Re: Spindle Index problem.
Post by: SimonD on May 04, 2008, 09:01:42 AM
I have played about with the "index debounce" value... I am reluctant to change the size of the slot right now, presumably if it can't see a slot reliably even at slow speeds, making the slot bigger isn't going to help? Presumably I only need to make the slot bigger if it isn't reliable at fast speeds.

Anyhow here is the strange results I got...

Run the spindle at a requested speed of 500rpm.

Index Debounce        Indicated RPM
10                          1928
20                          963
40                          481
80                          275
160                        148
320                        77
640                        39
1280                       flips between 0 and 40

Surely the indicated RPM shouldn't be roughly proportional to the Index debounce value should it?

Title: Re: Spindle Index problem.
Post by: Overloaded on May 04, 2008, 09:12:56 AM
You may want to keep the Debounce setting in between 1 and 10. Setting it too high will cause it to miss many of the pulses, resulting in reported speeds slower than actual.
Title: Re: Spindle Index problem.
Post by: SimonD on May 04, 2008, 09:17:53 AM
Ah.. ok thanks, I will try that and report back...
The default install set the index debounce to 100 so I assumed it needed to be quite high. it also set the input debounce to 500.

Title: Re: Spindle Index problem.
Post by: Overloaded on May 04, 2008, 09:48:10 AM
One other thing, if the input was active low, it would be ON the entire time that the slot is not at the sensor, quite a long time per rev. Active high, the input is on only while the slot window is open resulting in a much shorter pulse. Mine works fine with 0 debounce.
Seems so anyway, please correct me if I'm wrong,
Title: Re: Spindle Index problem.
Post by: SimonD on May 04, 2008, 10:13:16 AM
The sensor wants to send an output when it is blocked so I have switched the active low setting so that the LED on the Mach3 screen lights when the gap lines up with the sensor.

if I set the debounce levels low e.g. 0-5 the reading is about 1930-1940 rpm when a S500 is requested.
I have no real way of measuring the actual speed so I turned it down to S50 and it reported about 102 rpm I then counted 50 turns and it took about 30 seconds so the reading looks right at that speed.

So I commanded an S100 and got an indicated 595 rpm!

So I thought I would try some other speeds...

S50      102 rpm
S100    595 rpm
S200    Stopped
S110    275 rpm
S120    Stopped
S300    377 rpm
S350    621 rpm
S400    702 rpm
S500    792 rpm
S600    923 rpm
S700    1060 rpm
S800    1202 rpm

At the last one I took the voltage applied to the inverter. It read 2.12v with a reference voltage at 10.22v so it is about 1/5 full speed which is 663 rpm

So the S commands don't seem to be outputting a proportional voltage and the index reading is erratic.

How do I reset everything and start again?
Title: Re: Spindle Index problem.
Post by: Ian Ralston on May 04, 2008, 03:20:35 PM

The slot width on Art's Boxford was more like 20mm in the manual. Also, when I was doing a tachometer on my big manual lathe, it needed a Schmitt trigger IC to clean up the  output of the opto switch to get a clean signal to feed to a frequency counter.

Title: Re: Spindle Index problem.
Post by: SimonD on May 04, 2008, 03:36:01 PM

Thanks for the reply, it is driving me nuts!

I was going by what the manual stated... The manual I've got states "3 slots at 4mm and one at 8mm" So I assumed one at 6mm would work OK. I figured it should at least work OK at low revs.

The CNC4PC C3 card I am using already has a Schmitt trigger IC on it.

Do I really need to set "pulley ratios" I have been just using pulley set 1 set to the maximum speed rating 0-3200 rpm Is this wrong?

What have you got the step/direction settings set for on the motor tuning? I set them up the same as the C11G manual suggests. e.g. 1000 steps per and 1500 velocity and something really small for accel (I can't remember off the top of my head)

Title: Re: Spindle Index problem.
Post by: Ian Ralston on May 04, 2008, 04:23:49 PM

Can't help with pulley ratios, I am still on manual spindle control.
Settings, Steps per mm at 1000.
Kernal speed is now 100kHz.
Acceleration at 286 mm/sec/sec. I have seen faster recommended but this is about 0.1 sec from 0 to maximum, which is fast enough for me!
Step pulse at 4.
Dir pulse at 4.

Experimenting with the Geckos, I got the X up to 4000 mm/min,scary stuff!

Title: Re: Spindle Index problem.
Post by: SimonD on May 04, 2008, 05:31:44 PM

I might end up on manual speed control at this rate! seems a shame as it is all wired up!

kernel at 100kHz sounds scarey! my poor little PC can't cope with that. I will experiment with the kernal once it is all running.
4000mm/min is very scarey on a machine with only a 200mm or so of total travel!

I am just connecting up the front panel, it used to work off 12v but luckily it also works on 5v so all the buttons are trivial to wire up to a 2nd parallel port. (if the postman ever brings the card!)

I really wanted to get the spindle working while I was waiting for the smoothstepper and 2nd BOB to arrive.
It seems to run fine and I can change the speed using Mach3 it just doesn't go to the speed I request which is really annoying, I am so close yet so far away! I have a funny feeling it is something to do with pulley ratios but I don't know.

The "calibrate spindle" routine just seems to mess everything up completely. I start off with a fairly linear spindle range albeit producing the wrong values and after running the calibrate spindle I get complete rubbish! to the point this afternoon where I have had it running nothing but 0 and full speed for any commanded speed and then some wierd "calibration" where the spindle would respond to everything except s200-s300 where it was stationary!

Tomorrows job might be to make the slot wider, I can see it making a difference at the top end of the speed range but I don't see how it can help at the lower end of the speed range.


Title: Re: Spindle Index problem.
Post by: M250cnc on May 04, 2008, 07:46:17 PM
Hi Simon

I too am waiting for a SS and a second BOB i hope this info may be helpful.

I am running a milling machine it has 12 spindle speeds via belt change.

My new motor and VFD allows the motor to run at double speed

I am not  using an index pulse on the mill so at the moment this does not confuse the issue.

With the motor being able to run at double speed i decided to set the minimum speed at 50% at/on any given pulley

So i set up 12 pulleys and according to the speed chart i set the minimum to 50% and max to 200% of each pulley speed giving me 12 pulley speeds

On pulley 10 i now have a speed range of 500 rpm to 2000 rpm "NO VFD it would have been 1000 rpm"

Now this is where some trial and error comes in, varying the steps &/or velocity so that on max speed i get 10 volts on the BOB and at 50% speed i get 5 volts on the BOB i could get this accurate as my VFD has frequency output

The settings of the motor setup are a starting point 1000 x 1500 mine are a lot lower

Set the trim pot to the centre

Run at max speed monitor voltage "To high lower step value" "To low raise step value"

Keep this up until you get close to 10 volts then use trim pot to set to 10 volts exactly

Then try 50% speed this should read 5 volts

I think if you get this bit working correctly then move onto setting up the pulse card

I to am using Arturos products, excellent but the instructions can be vague at times  ;D ;D ;D

Title: Re: Spindle Index problem.
Post by: SimonD on May 05, 2008, 07:35:48 AM

Thanks for the reply...

I have 1 pulley set up set to min 0 max 3200 rpm.
If I go to the motor tuning page and press the up arrow key then I get a solid 10v out of the BOB. I think this tells me the max speed is set ok.

If I then command a S3200 I get 9.15v out of the BOB. I also get this when I set the speed to S2000, in fact I get the same anywhere between S2000 and S3200 at S1600 I get 7.6v

I think I need to reset the spindle calibration but I can't seem to find out how to do it. Any ideas anybody?

As for the RPM reading, Thanks to Hood and Overloaded for pointing out the debounce value and that is was set too high. I am now getting a constant reading but I think it is reading twice as fast as it should be.

Title: Re: Spindle Index problem.
Post by: SimonD on May 05, 2008, 09:28:36 AM
I take it back, The reading on the rpm is about right, certainly at slower speeds. I manually counted revolutions and am getting about the same although I can't count any faster than about 250 rpm!

Now how do I get the spindle range to be linear? I have tried the "calibrate spindle" dialog but it seems to be making it worse, not better. the lower end of the range seems to be fairly linear at present but only upto s2000

Title: Re: Spindle Index problem.
Post by: Graham Waterworth on May 05, 2008, 10:35:55 AM
Hi Simon,

if you go to diags is the current pulley set to 1?

I have a disc with 7 10mm slots and one 20mm slot, Mach reads this with the timed signal through a CNC4PC C3 board, I have very good control from 200-4500 rpm with no spindle calibration.

I also found that if the slotted disk was painted black it was better, ? :o , answers on a post card  ;D

You will find if you do threading you will need a multi slot disk,  more slots makes for better pitch control.

Title: Re: Spindle Index problem.
Post by: SimonD on May 05, 2008, 11:04:06 AM
Hi Graham,

Yes the current pulley is set to 1. I thought if I get the first pulley set up then I should be able to work the others out but...
I did try putting black tape around the disc but it made no difference as my disk has a myriad of holes around it on a different pitch from the original timing and I though maybe they were masking the signal.

I didn't realise I would need more slots to do threading. I will have to cut more.

Title: Re: Spindle Index problem.
Post by: Hood on May 05, 2008, 11:24:55 AM
 I will disagree with Graham regarding the multi slots being needed for threading. I do a lot of threading, in fact I have just finished making 30 or so pullstuds for my mill and the threads are perfect, also a month or so back I made a load of pullstuds up for Brett (Chaoticone) and these too were perfect, same with the toolpost bolts I made, the prop shafts I have made and so on. The largest thread I have done so far was 2.5 inch BSP and the  smallest thread I have done was M4  so maybe if you go ultra small it will be a different story but I dont think so.
 My spindle isnt controlled by the Index pulse however as the spindle speeds on my Lathe are controlled with Electromagnetic clutches, possibly if you have the speed set and controlled from a VFD a multi slot disc might be better.

Title: Re: Spindle Index problem.
Post by: Hood on May 05, 2008, 11:32:22 AM
Heres a pic of one of the pullstuds I just finished, not great pic as its with the phone but you should be able to see the thread is good.
Title: Re: Spindle Index problem.
Post by: Graham Waterworth on May 05, 2008, 11:34:39 AM
Hi Hood,

your points are duly noted.

I would agree with you if the Boxford had the sort of power you are playing with.  A 10x1.5 thread on the Boxford can get out of pitch if the spindle stalls at all when the tool starts to cut.  By having more slots the pitch is corrected much sooner and the thread saved.

Title: Re: Spindle Index problem.
Post by: Hood on May 05, 2008, 11:40:42 AM
Good point Graham, just wanted to say that it may not always be the case that multi slots are needed. I think the most important thing is that you have a nice clean pulse from the Index or timing and I pay particular attention to all my 5V carrying wires to be properly shielded and grounded.

Title: Re: Spindle Index problem.
Post by: SimonD on May 05, 2008, 01:14:49 PM
Graham / Hood,

I decided that I should make the slot larger and while I was at it I added 3 more slots. I now have 3 off 10mm slots and 1 off 20mm slot. I configured Mach3 to look at timing instead of index and voila the speed readout is exactly the same as the timing input gave me with my one smaller slot!  It was definitely the debounce level far too high which was causing the bad reading at the start of this thread.

I will leave it at 4 slots for now, I can allways add some more later if the screwthreads are bad. As my builder allways told me "you can cut some off but you can't cut some on!"

I can't get the speed to match the requested speed but at least I can find out the speed it is actually running at now!
I have been advised by the Yahoo group that there is some wierd relationship between the motor tuning and the voltage output so I will try that tonight.
Currently my spindle calibration line looks more like a boomerang!

Thanks for all yours and everybody elses help.
Title: Re: Spindle Index problem.
Post by: Ian Ralston on May 06, 2008, 04:52:26 AM

I am going to have to tackle this problem soon, so, when you get this sorted to your satisfaction, can you post a simple step by step guide for the rest of us.

Title: Re: Spindle Index problem.
Post by: SimonD on May 09, 2008, 03:53:50 PM
Here is my guide for setting up the Speed control...
All the usual disclaimers apply...
"Your mileage may vary"
"Keep out of reach of children"
"These instructions are packed by weight not volume, contents may settle in transit"

I am using the following hardware...

Boxford 160TCL
CNC4PC C11G Breakout Board
CNC4PC C3   Index Pulse Board
CNC4PC C15  Dual relay Board
Lenze 534   DC Speed Controller

Setting up The Index or Timing Pulse
Initially I had a single ~6mm wide slot on a 125mm disc. This is the original timing disc on the Boxford. The choice of ~6mm was made for me as it was the distance between the outside edges of 2 of the existing holes in the disc.

Make sure that the sensor is not lined up with the miriad of holes, but the solid area on the disc.

I have connected the Signal to Pin15 on the C11G card as that is the fastest input on the card.
Be carefull to connect the ground to a ground pin on the C11G. The pin next to Pin15 is a 5v pin NOT ground!

The C3 card defaults to outputting a signal when it is NOT aligned with the slot. So you need to flip the "active low" setting in Mach3 until the dignostic page "Index" or "Timing" LED lights when it is aligned with the slot.

Mach3 sets the default "Index Debounce" level to 100. On my system this was way too high and resulted in being able to get whatever RPM value I wanted just by changing the debounce value. The higher the debounce the lower the RPM.
I have my debounce set to 2.

At this point I didn't believe the speed reading I was getting so I decided to try the "Timing" input instead.

I changed the slots to 3 off ~10mm wide and 1 off ~20mm wide and changed the "Inputs" section of Mach3 to see the "Timing" instead of the "Index" on Pin 15 and hey presto I got exactly the same RPM values!

NOTE - If you go to the "Calibrate Spindle" dialog the "number of pulses per rev" should tell you how many slots you have, ignore the note in the dialog which tells you it should show 0 for 1 slot. Mine allways said 1 when I had 1 slot and now says 4.

Setting the Analogue Output
The C11G has an analogue out section which converts a STEP/DIR signal to a 0-10v signal.
The C11G only has 1 mechanical relay. This *can* be used as the direction relay for the spindle, however, when I tried it, I found that when you hit the E-Stop the power would be cut and the direction relay would reset and the spindle would suddenly run down in the opposite direction.

I did not like this so I decided to use the C15 relay board to change the direction of rotation using the M3 & M4 signals.

First you need to set the "Ports and Pins" to send out STEP on Pin14, I left the DIR set to pin 0 and I am not using it.

The C11G manual tells you to go into motor tuning and set the Steps Per to 1000 and the Velocity to 1500. On my system I found that this maxed out the pulse train and made it so the POT on the board would not change the final voltage.
Despite what the C11G manual states, I found that the maximum voltage put out was directly proportional to the "Steps Per" value and the pulse length made very little difference.
So I reduced the Velocity to 1000 and the "Steps Per" to 1000.

I then set the pulley1 set to min and max of 320 and 3200 rpm. This sets the allowable S range that can be commanded.

I then needed to adjust the C11G output voltage to 10v at maximum speed.

NOTE - Do not have the speed controller connected at this point!

Entering M3 S3200 starts the voltage flowing and I could fine tune the output to 10v using the POT on the C11G board.

I then commanded S400 to S3200 in steps of 400 to see how linear the voltage was and it turned out to be very good.

Connect up the speed controller.

At this point I remembered that the original speed controller was used to getting 8v from the original board and so I started the spindle with a low speed and turned down the "Nmax" on the speed controller.

Next is to command a S3200 and adjust the Nmax setting on the speed controller until the Mach3 speed showed 3200 rpm.
At this point you will more than likely find that the speed control is fairly linear but does not give you the right readings.

On plotting the speed against requested speed I found it to be quite linear but with the wrong gradient. This told me that the slow speed was too slow and the fast speed way too fast but it was quite linear inbetween.

Command the slow speed S320 and tune the "Nmin" setting on the speed controller until the RPM reading is 320rpm.
Now check the S3200 speed and I found it was now too high!

I then adjusted the S320 speed and S3200 speed alternately until they both resulted in the correct speed for the commanded speed.

The result is now within 1% of the commanded speed! I have no doubt I could get it even better, if I could be bothered to continue the iteration process. 1% is good enough for me!

Many thanks to everyone for their help, without which I would never have managed to get this far!
Title: Re: Spindle Index problem.
Post by: Ian Ralston on May 09, 2008, 04:30:26 PM

Thanks for documenting your spindle speed set up, that is a big help.
Have you got the reverse working yet? I think in Mach config there is a settable wait time for M03/M04, so that you can call M05 with a delay to allow the spindle to slow down.

Title: Re: Spindle Index problem.
Post by: SimonD on May 09, 2008, 05:21:54 PM

Yes, both directions work ok. and yes there is a settable delay for switching the M03/M04 on and off.
The rundown time when a E-Stop is activated is a bit too long for my liking so I still need to add a breaking resistor somehow but I will work on that later. I tried switching in a resistor across the windings but it didn't seem to do much. I need to readup on it a bit.

Title: Re: Spindle Index problem.
Post by: SimonD on May 10, 2008, 04:35:48 AM

Where is your slotted disc mounted? actually on the spindle or on an intermediate pulley? If it is mounted on the spindle then I would not think you need to adjust the spindle speed using a ratio.

I cannot speak from experience as I have onlyjust got my spindle to work properly, I haven't actually cut anything yet but I would imagine you need to get a good reliable rpm reading from Mach3 before you consider trying to cut a thread otherwise who knows what the result will be!

Title: Re: Spindle Index problem.
Post by: SimonD on May 10, 2008, 07:48:36 AM

Check your index debounce level. Try 0 or 1 and see if that makes it better.

Title: Re: Spindle Index problem.
Post by: jimpinder on May 10, 2008, 01:57:56 PM
I would suggest that the problem lies in the speed you are trying to do this. Cutting a thread - e.g. an 8 mm thread - this is 1.25mm pitch. That is 10mm movement for every 8 revs of the spindle. If you can move your axis at 500 mm per min, this means a spindle rev of only 400 revs per min. This is slow for the average 3 phase motor on an inverter, and you will loose power.

Really you need to be in the equivelant of backgear on the lathe to get the spindle speed down to these low speeds, but still retain the power of the reduction gearing to maintain a smooth cut. You need to have everything working well with parameters to do a nice thread.

On the old lathes, with thread cutting gearing, they were usually cut in backgear.
Title: Re: Spindle Index problem.
Post by: jimpinder on May 11, 2008, 05:04:18 AM
You will have to ask someone who has more experience of threading ( Hood might be able to answer) - but the answer MUST be YES.

Quite clearly the speed of the Z axis must be varied with the speed of the spindle.

When you say the Z travel does not seem to vary when you alter the spindle speed - are you doing this on the "fly". If so, the only thing I can think of is Mach looks at the "line" of Code and says  - I am going from A to B, pitch is X, spindle speed is Y therefore my Z speed is whatever. It then puts out that information until the move is finished - and does not vary the speed whilst moving.

This is why I am saying that the machine should be working well within its parameters, so there is little likelyhood of anything altering.
The best way is perhaps a set of gears connecting the spindle to the lead-screw (now where's my spares box - I have some somewhere)
Title: Re: Spindle Index problem.
Post by: Hood on May 11, 2008, 06:34:41 AM
To be honest I am not sure, will be a hard thing to test on my Lathe as the speed is set by clutches and so is not variable within the speed ranges. I couldnt take a test cut deep enough to slow my motor down either, the tool would break long before the spindle would slow. I have taken 12mm DOC (1 inch on Dia) on a 3inch Dia EN24 bar and the motor hardly changed sound so there is no way a threading tool could slow it.
 I would imagine that Mach steps are put out per revolution and maybe as Graham said if the timing pulse and a multi slotted disc is used it will be less than a  rev but I just dont know for sure. I may be able to test it out on the mill as that has a pot to control the spindle via VFD, just have to remember to try it out and see LOL
Title: Re: Spindle Index problem.
Post by: vmax549 on May 11, 2008, 09:18:50 PM
MACH software does NOT allow for electronic gearing of the z to the spindle. SO no mach cannot alter the z feed to compensate for spindle speed variations while in cycle. It monitors the RPM and sets the feed to the RPM at the start of the cycle. IF the RPM varies too much then the threads suffer accordingly.

HOPE that helps, (;-) TP