Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: GytarrMann19 on April 02, 2012, 03:15:27 PM

Title: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 02, 2012, 03:15:27 PM
Hello all,

Trying to give my lathe the ability to thread. I followed the advice given by Chris Humphris, and used an Optek OPB982T51Z optocoupler and made an interrupter wheel which is mounted on the spindle. Mach is seeing the pulse, as it does display an SActual value, but the displayed value swings/oscillates wildly. I've played with the slot width on my interrupter, I've toyed with the Index debounce value, changed active states, etc., to no avail. Whats going wrong?

The setup I'm using feeds the index pulse through a C23 BOB and SS. I've read a few other threads on here where people had better luck feeding the pulse direct through a PPort.

Any ideas?

Thanks,

Kevin
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 02, 2012, 03:21:51 PM
I used OPB 916B or 917B and they worked very well. I used to power them from and put the input in to Port 3 on the SS.
I found on all machines from PP to SS that index debounce needed to be zero for me.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 02, 2012, 03:46:00 PM
It is unclear to me how to calculate the pulley ratio. I set my VFD manually to 700RPM. I then measured the actual spindle RPM using a tach, which showed 1250RPM. I assume the correct math is 1250/700=1.7857

I set Pulley 1 to 1.7857, then commanded Mach to run the spindle at 1000 RPM. The actual spindle speed was nearly 2000. I the tried arbitrarily changing the pulley ratio, but it never had an effect on spindle speed. Changing the max speed, however does. IE changing the max speed from 4000 to 8000 with my calculated pulley ratio brought the actual spindle speed closer to 1000. Whats going on here?

Meanwhile, the S Actual was reading 500,000RPM regardless of what I set index debounce to.
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 02, 2012, 05:22:07 PM
You need to set the max spindle speed in the Pulleys page to what your max spindle speed will be or you will get weird speeds.
Where is your sensor, if its on the spindle then you should not have any ratio or rather it should be 1, if its on the motor side then yes you need the ratio.
Hood

Edit, just to clarify, the ratio is simply used for Mach to set the displayed spindle speed and not for altering the commanded speed. For example if you have the sensor on the motor side and you have a 2:1 ratio then the spindle would be rotating twice as fast as the index pulse so setting a ratio lets Mach know that and the displayed spindle speed would be twice the motors speed.
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 03, 2012, 01:24:04 PM
I think I understand. The max speed needs to be set to the maximum attainable speed with my setup.  I thought I was just arbitrarily setting it to the max speed I want to run at. Big difference there.

As for my index pulse problem, I think electrical interference from the VFD is causing the wild readings. Index debounce doesn't help this, and the shielded cable I'm using doesn't help much either.

Anyone have experience with VFD noise filters/line suppressors?
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 03, 2012, 02:01:40 PM
It is the Max you will be running it at, ie  the full 10v to your VFD, whatever that speed will be.

Shielded cable should be enough if you have the shield correctly grounded. Have you tried connecting the index direct to the SmoothStepper?
Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 03, 2012, 02:22:34 PM
I'm using a C23 BOB, which plugs directly into the SS. I tried soldering the index wire onto the BOB pin that plugs into the SS. Tried a pin on both ports, but that just gave me wild numbers all the time. 
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 03, 2012, 02:24:51 PM
I would use port 3 on the SS, I would also power it from the power pins on port 3, that is assuming it doesnt draw a huge amount of current.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 03, 2012, 03:38:32 PM
It draws 20mA. How do I use port 3 on the SS? Do I need a new SS plugin to utilize that?
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 03, 2012, 03:45:08 PM
Nevermind. I looked at the SS manual and figured it out. I used Port 3 Pin 1 but I still just get crazy numbers.
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 03, 2012, 03:49:10 PM
20mA is fine. Just connect direct to the screw terminals on Port 3, there are set out as follows,
1A (Port 3, pin 1 to Mach)
1B (Port 3, pin 2 to Mach)
1Z (Port 3, pin 3 to Mach)
5V
0V(Gnd)
2A+ (Port 3, pin 4 to Mach)
2A-
2B+ (Port 3, pin 5 to Mach)
2B-
2Z+ (Port 3, pin 6 to Mach)
2Z-

The inputs 2A+ etc are differential inputs, that means you can connect differential encoders or MPGs to them however you can use them as single ended inputs also. You would in that case just ignore the 2*- ones and connect to the + ones/

The 1A, 1B and 1Z are single ended inputs

So You have a total of 6 inputs available on Port 3 of the USB SS three of which can be connected differential or single ended.

For your Index pulse I would just use 1A, and take the power from 5V and Gnd, you would then just set the Index in Ports and pins to Port 3 pin 1.

Hood
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 03, 2012, 03:51:48 PM
Have you got the shield properly Grounded to a single point in your control?
If you attach your xml I will look and see if there is an issue with it.
Is there any way you can spin the spindle with a cordless drill or similar so that you can see if the index pulse is fine without the VFD being on?

Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 03, 2012, 06:14:12 PM
Tried the cordless drill, got huge numbers...like 8 digits. Drill probably runs 400RPM or so.
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 03, 2012, 06:27:28 PM
Attached is my XML
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 03, 2012, 11:39:32 PM
Update- I moved power and ground to the SS as well. Works perfectly now.
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 04, 2012, 05:54:54 PM
Likely the problem was the extra layer of isolation via the breakout board, assuming it is isolated. The issue when putting in to Port3 and not using its power would likely have been there was nothing for the SS to reference the signal to, connecting the Gnd of it to the Gnd terminal may have been enough but personally I think powering fully from port 3 is the best way.
Glad its working now.

Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 04, 2012, 07:02:57 PM
Thanks for the replies, Hood. We're lucky to have someone as helpful as you.  I understand that threading is unavailable in the demo version. What does this mean?  The G76 cycle still appears to function. However, at best I was able to produce a corn cob effect by using it. It appears to have major fluctuations in pitch. Does this have anything to do with being a demo version, or might I need to better compensate for axis acceleration?

Thanks again,

Kevin
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 04, 2012, 07:10:30 PM
I am 99.9% certain that is what you will get with demo mode, I have seen reports of it sort of working but not doing a proper thread and that seems to tie in with what you are getting. I have  never tried myself in demo as I dont fancy risking crashing my lathe as at best I would break a tip, at worst I could rip off my new turret and have 100Kg  flying through the air at me ;D
Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 04, 2012, 08:09:38 PM
Perhaps I should finally register my copy of Mach. I've been hesitant to do so, not because I'm a cheapskate, but because I don't want to spend any more money on this project than I have to until I'm sure it's actually going to work. If anyone else is reading, please confirm this is what happens using the Demo version. Just so I can stop pulling my hair out for tonight.

Kevin
Title: Re: Spindle Index Pulse Problem
Post by: RICH on April 04, 2012, 08:22:25 PM
You'll just need to splurge and buy Mach if you want to thread.
RICH
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 05, 2012, 03:35:07 AM
When I said I was 99.9% certain I was meaning that what you were seeing was how threading reacts in demo mode, I am however 100% certain that threading does not work without a licence so you will have to splash out if you want it.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 05, 2012, 05:19:20 PM
Purchased and installed a license today. Got the exact same results. Attempting to cut 13 TPI at 800 RPM. This works out to 61.5 IPM, so I know I'm not trying to feed too fast. The results I'm getting are the cut is not starting at the same spot every time. I'm starting .400" in front of the part, leaving plenty of time for acceleration.
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 05, 2012, 05:25:31 PM
Can you attach your current xml and I will see if there is a config issue.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 05, 2012, 08:04:25 PM
Here it is. Thanks for the help.
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 06, 2012, 03:53:55 AM
Disable the Turn Diagnostics plugin.
What version of Mach are you using?
Can you attach the code you are trying.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: RICH on April 06, 2012, 12:02:52 PM
Are you setting the spinde rpm manualy?
RICH
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 07, 2012, 04:31:17 PM
Spindle RPM is set by Mach, using PWM to analog converter to operate a VFD. According to Mach SActual, spindle rpm stays steady within 2 or 3 RPM. I am using V. R3.043.060

Offending code is as follows:

M6T0303
M3S400
G4P1
G0Z.4X0
G95
G76X-.02Z-.5Q1P.07692H.005I29.5C.05
G94
G0X.1z.5
M30
END

And:

G94
M3S200
M6T0303
G0Z.3X-.01
G95
G32Z-.5F.07692
G94
G0X.05
Z.4
M30
END

Running the G32 cycle multiple times produces the same results as the G76, the thread does not start at the same place everytime. Also, disabling thread diagnostics had no effect.

Thanks,

Kevin
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 07, 2012, 04:32:53 PM
Did you disable the Turn Diagnostics plugin?
Hood
Title: Re: Spindle Index Pulse Problem
Post by: RICH on April 07, 2012, 07:26:47 PM
I am thinking that the threading cycle may be fighting the VFD. The cycle is adjusting for the 2-3 rpm change and adjusting feedrate based on the average. The more stable the rpm the better ( like 1 ). Then on the next / following  thread cycle the VFD changes the rpm some and there is also a  modified feedrate from the threading cycle compensation and you end up with an even greater "equivalent" swing in the rpm.  I am assuming that backlash is not a factor. Just a thought and that's why i said can you set it manualy.

I am also assuming that when you run the driver test that the pulse stream is consistant and close to set kernel speed selected.

No need in testing to actualy do threading as you can do per your reply the G32. You should be cutting "a thin" disc at the same mark every time...very closely in fact as seen under a micropscope ......not even see a slight deviation....if not not forget about even trying to do multiple threads.
 
RICH
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 08, 2012, 02:55:50 AM
Hes using the SS I think Rich.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: RICH on April 08, 2012, 07:17:15 AM
Hood,
Ah ...as noted in the first posting....
I never did any testing with the SS and haven't used mine in a long time. So additional electronics are involved.

If we just forget about the actual threading then there seems to be a timing issue. ie.The G95 informs Mach that the index was seen x amount of times and
based on an average of the rpm the axis is then instructed to move / accelerate over some linear distance. So the index trigger point,
acceleration value, current rpm of the spindle in a time frame, and actual movement of the axis needs to be consistant to arrive at an exact location.
If one were to use  a thin disc ( btw ....the bigger the disc diameter the better one would see any timing issues ) you can get a flavor of magnitude since the cut marks would be off by a greater amount.

If we assume that there is no backlash, the starting point is exactly the same location, and the system can respond  to the requested motion,
but, and i say but , the instructions are not the same  as the PP, then there could be something wrong in MACH. But before one guesses at that they need to verify that the system is all correct and that is hard to pin point a possible problem.

He is using a max velocity of 190 with accel around 4. So even though his kernel frequency is high that dosen't mean he can use that high velocity in a repeatable
accurate way. The max values are used during the move from standstill to the start of the threading and not the 65ipm he notes.
Maybe try a reduction in spindle rpm and velocity to say 1/2 the currrent velocity value and do some testing to "scribe" marks on the edge of a disc.
I will note to use the wizard since it will check that the spindle rpm and current tuning settings are adequate for the threading to be done.

Not sure what else to say at the moment.....

RICH


Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 08, 2012, 08:02:16 AM
I would say you may be right on reducing the RPM especially for testing.
With the SS the threading is done in it rather than Mach and all reports are that it is very accurate and works extremely well even on low powered spindles. One added benefit of the SS is that it can see tiny index pulse widths, I use the Index pulse on my motors encoders and it works great.

Hood
Title: Re: Spindle Index Pulse Problem
Post by: RICH on April 08, 2012, 12:21:29 PM
Here is why testing at a lower velocity is worth trying.
If one assumes the acceleration, axis movement, and triggering are correct then any difference in the point of first contact would be the difference on the circumference of two marks due to variation of the spindle rpm.

For a 1" diameter disc:
800 rpm =13.3 rev/sec = 1.3 rev in 0.1sec
circumferential distance a point would travel in .1 sec =4.188"
( time of .1 sec somewhat close to the accel for 13tpi @61.4 ipm)
since 3/800=.00375 (.375%) possible variance of the rpm  then the contact point can be +- 0.16" off

Dropping the rpm to say 100 rpm the contact point could be off by +- 0.002"

So slower spindle rpm reduces the possible error of where the cutter is  in relation to the point of just starting the thread / scribing mark.

One should see a reduction in inaccuracy ...i would think

You may also be able to just do an axis move G1 Z.5 F.076923 and get a entry point and v groove on the disc. Then  pick up the thread and now do a
G32 move to see what the difference would be, but must say that you'll need to very meticulous on doing it. In the Threading on the Lathe Manual
on how to pick up a thread.

Just some thoughts on trying to find out what's wrong,

RICH



Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 09, 2012, 05:52:38 PM
Thanks for the replies guys. I will attempt to test some of these ideas as soon as I get some time. Note: Disabling turn diagnostics did make a big difference. I was able to produce a thread good enough to turn a nut onto, so the starting points were much closer, but still off somewhat. I ended up with a widened root, and very sharp crest.

Question for you on kernel speed v. feedrate- how does kernel speed limit my feed/rapid rate? The current max velocity is set to 190, as around 220-230 I trip the drive for following error. I assume this is because the servo lacks enough torque to accelerate any faster and keep up with the pulse train.

Same thing happens when accel gets to around 6.

I have my drives tuned such that I get around 6-8 steps max following error, and they are set to trip at 12 steps.

Thanks again,

Kevin
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 09, 2012, 05:58:24 PM
Kernel doesnt affect you at all as you are not using the parallel port.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on April 09, 2012, 06:27:09 PM
Does it matter at all then what I have it set to?
Title: Re: Spindle Index Pulse Problem
Post by: Hood on April 10, 2012, 01:41:45 AM
No, kernel has no effect on the SS. The equivelent for the SS is set for each axis on the SS config page. Like the parallel ports kernel it is best to not use more than you require so set to the nearest above what each axis requires. in other words Vel times Steps per unit divided by 60 then divide by 1000 to get KHz.

Hood
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on November 24, 2012, 06:37:15 PM
Still not having much luck threading. One thing I notice, is that my spindle speed fluctuates quite a bit. Up and down as much as 30-40rpm between passes sometimes. In a recent test, I got 3 good passes before things got out of whack...and I think it's because the spindle speed stayed about the same.

What results do others notice they are getting as far as spindle speed variation? I'm using a 3 phase induction motor driven by a VFD. No speed feedback to the VFD...just open loop.

Thoughts?

Kevin
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on November 24, 2012, 09:44:40 PM
Did a little more testing. Checked the output from my digispeed DC-05 board...voltage stayed pretty constant during speed fluctuations, so I assume the problem is in my VFD.


Next, I notice that my speed fluctuates slightly less at higher RPMs. Which also means the % fluctuation is quite a bit less due to the higher RPM.  Tried doing some thread testing at 2500rpm and I get much cleaner results than at 500.

I assume the index pulse must be pretty clean if I get decent results at that high speed. Which kinda reinforces to me that my trouble is the speed fluctuation. How does Mach use the index pulse during threading cycles? What kind of speed variation can it compensate for? Does it compensate during the cut or only as it is starting each pass?

Keep in mind I'm only scribing a piece of stock with layout dye on it, not taking actual cuts.

The only problem with threading that fast is that my servos can't decelerate fast enough, so the lead shortens up towards the end of the cut. But I leave plenty of room for accel before staring into the work, and most of the thread comes out with a correct, even lead.

Help!

Kevin
Title: Re: Spindle Index Pulse Problem
Post by: Hood on November 25, 2012, 03:17:29 AM
Dont know what to suggest, I am wondering why your spindle is slowing down if you are just scribing, it is either massively underpowered that even a scribe is too deep or there are other issues.
Is there any way you can just configure the VFD to run at a set Hz so that there is no speed control from Mach and then do a thread test?
Oh and with the SS it is not Mach that does the actual threading, it is the SS.
Hood
Title: Re: Spindle Index Pulse Problem
Post by: RICH on November 25, 2012, 08:35:18 AM
Kevin,

Quote
How does Mach use the index pulse during threading cycles? What kind of speed variation can it compensate for? Does it compensate during the cut or only as it is starting each pass?
See Threading on the Lathe-Mach3 Turn write-up in Members Doc's section 2 as it explains in detail.
The more consistant the speed control the better. 30-40 rpm variation is not good. Speed is monitored and an adjustment made based on the previous pass. The monitored speed is very accurate and more so than you may  be able to measure. The DRO should
not change by more than 1 when not threading.

One problem is if the vfd is changing the rpm and Mach is compensating for the rpm then the two are fighting each other.
Thus screwed up threading.
I would suggest you try manualy setting the rpm and see what happens with the scribbing tests.

RICH
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on November 26, 2012, 10:10:00 PM
Screwed up threading  ;D

I set the speed on the VFD manually, and it stayed steady within 1 or 2 rpm. Gave me much better results on the scribing test. I checked the PWM signal from the SS with my volt meter, and that appeared to stay constant. The analog output voltage from Homann's DigiSpeed board seems to vary up and down a few millivolts  though. Not sure if this is the issue. I need to sit down and do a little math and see if millivolt variations are enough to affect my speed by that much.
Title: Re: Spindle Index Pulse Problem
Post by: GytarrMann19 on November 27, 2012, 11:28:56 AM
Don't think it's the DigiSpeed board that's causing my trouble. I'm seeing output fluctuations of maybe .001-.002 volts. This shouldn't affect my spindle speed by more than 1rpm, if even that much.

Possibly something with how the drive reacts to analog input commands. I'll be contacting tech support to see if I can work something out there.

I know my drive has a ModBus interface. Is it possible to command VFD speed and direction from Mach via ModBus?

One issue I'm seeing, although slightly unrelated, is the linearity between the S command and Mach's PWM signal. Although I'm sure using a voltmeter to test that signal isn't perfect, at 2Khz base frequency, I should be able to read a fairly clean voltage represented by the PWM signal. And it isn't very linear. Which shows up in the fact that at low RPMS, S actual reads higher than S commanded, and at higher RPMS, S actual reads lower than S actual.
Title: Re: Spindle Index Pulse Problem
Post by: spencyg on January 02, 2013, 09:50:37 AM
 Did you ever get resolution to this issue? I'm experiencing similar issues.

SG