Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: panaceabeachbum on December 17, 2007, 07:56:48 AM

Title: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 17, 2007, 07:56:48 AM
I received the nice spindle encoder board from cnc4pc and have it wired to pin 15 on the cll cnc4pc breakout board.  I have a single slot .2" wide in a disk 3.7" in diameter.

I am getting steady but inccorect spindle spead readings, no matter what the actual spindle speed I get a reading from 200-280 rpms  , often the reading goes up when the actual spindle speed drops .  If I change the spindle speed from 300 to 800 rpms while the spindle is running by typing the new value in the rpm readout is very eratic djumping from the normal mid 200 rpm reading to as high as 1400 rms and then settleing back down to the mid 200's again.

Hopefuly this is just a wiring or configuration issue , the disk is as small as I can make it due to the diam of my spindle, right at 3" . It doesnt seem to matter if I set the input to high or low .

I did cut a test thread of 20tpi and it came out almost perfectly at 13 tpi

Any thoughts greatly appreciated
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 17, 2007, 11:16:39 AM
Have you got Index pulse debounce (general config) set to something sensible? Say 4 ( 4x40us)


Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 17, 2007, 01:09:55 PM
It seems to set at 100, I assume the default, I changed it 4 and it now varies wildly from 300-1500, set it at 8 and it seems to have leveled out  fairly close to actual rpms. Now if I could just figure out excactly how to set up mach for my VFD
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 17, 2007, 01:22:47 PM
From what you said earlier you have control of the speed from Mach I think. Have you set 'use feed back etc' . in spindle config? Sounds as though you've got control, but haven't closed the loop.

Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 17, 2007, 02:39:30 PM
I have some minor control over speed, an m3 s200 command gives about 600 rpms at the output shaft of the motor, a change to m3 s2000 bumps the motor shaft speed up to aprox 630 rpms . No great increase or decrease in actual rpm even with a huge change in s value.

The settings under the spindle tab are currently have use spindle feedback checked, closed loop spindle checked, spindle speed averaging unchecked
Use pwm is checked , pwm base 100, min PWM 10%
On the motor setup , spindle  the pulse width is set at 1

When I type in m3 s200 (or any speed value) I get a message stating "PWM Bumped to Minimum"

On the spindle encoder issue , I changed the index pulse debounce to 8 and it seemed to level out. I choose the save config option on the pull down, shut mach down , rebooted the computer and the rpm readout now varries wildly from 50 rpm to 10k+ , it seems to change randomly while the spindle is off as long as the beam is broken, when its aligned with the slot in my disk and at rest for a minute or so it settles at zero.

I apreciate all the help, I am so close its driving me nuts
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 17, 2007, 03:28:01 PM
Hmm,

I think there are two different problems.
 One: you don't seem to have a reasonable control of the motor speed.
Two: The index seems to give the wrong results.
I think it would be wise to separate the problems by not using the feedback etc. until you have  positive control of the spindle.
I assume the PWM signal is fed direct to the drive & not converted to a variable DC? On my system I use the step signal and convert it into a variable DC, which is what my drive needs.
Do you know what range of input your drive needs? ( either DC or PWM)

Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 17, 2007, 04:27:45 PM
my vfd is looking for 0-10vdc , I am using the c11 breakout board from cnc4pc
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 17, 2007, 04:47:55 PM
I set the spindle motor back to step and I can now vary the speed over a pretty broad range  although the speed values I plug in have to be much greater than the actual speed of the output shaft of the motor. input speed of s3000 results in aprox 800 rpms actual . I have tried varying the steps and step pulse width on the spindle motor config page, what variables do I need to adjust to get my output shaft of the motor to match the value I call out . I seem to be able to get the highest speeds with the steps set to 40k and pulse width4 but still no where near the speeds called out
Title: Re: Need a little spindle encoder timing help
Post by: Chaoticone on December 17, 2007, 06:37:12 PM
Have you set up your Pulley ratio in Mach?

Brett
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 17, 2007, 08:05:55 PM
yes to some extent but initialy I am just trying to get my speed call outs (m3s****) to match the shaft speed of the motor  out put shaft . I cant get the shaft speed anywhere close to whats called out
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 17, 2007, 10:14:55 PM
Got the speed control issue under control , a simple jumper in the vfd to choose how the incoming signal is handled, Set it for 0-10 volts and I can now get the shaft rpm to closely match the speed I type in . WIll fine tune it tommorw.

Now just to figure out the erratic rpm readings from the encoder, The instructions for the encoder board on the cnc4pc site show two term (+and-) 5v power in to the board , the three term the optical imterupter hooks to , and then two term for the signal, one labled ground , the other labled signal. I have the 5v in tied to the same regulated 5v power supply I am powering the break out board with, the interuptor was pre wired , the signal term is tied to pin 15 on the breakout board and the grnd which is right beside the signal terminal is tied to one of the ground terminals on the breakout board .
he light on the spindle encoder board is lit when ever the disk is interupting the beam and goes out for just a brief second when the gap in the disk aligns with the optical semsor. I was thinking(guessing) since a ground terminal is on the encoder board right beside the signal terminal that it must be grounding pin 15 each time a pulse is generated. The encoder seems to work the same wether the gnd is hooked to that term or not, erratic readings that jump anywhere from 30 rpms to 10000.  When the slot is aligned with the pickup and the light is out on the encoder board the DRO reads zero with the spindle off, at any other point (optical signal interupted) it displays random speeds with the spindle off.
Apologies for the long winded description just want to be thorough in my description . As with most things I am sure I have something hooked up wrong or am overlooking something simple, just so much info to go thru
Title: Re: Need a little spindle encoder timing help
Post by: DAlgie on December 18, 2007, 01:32:46 AM
Make sure your encoder signal wires are far away from your power transformer windings if possible, the AC in the transformer will induce wild RPM readings.
       DaveA.
Title: Re: Need a little spindle encoder timing help
Post by: jimpinder on December 18, 2007, 04:01:20 AM
This is a bit simple when you have spent all this time on it - have you tried changing the input terminal number.

Maybe that particular input is a bit duff (15 WAS the ERROR signal on the printer port). I would try one of the others and see if you are still getting the fault.(10 - 13).

At least then you will have eliminated one possible fault. The other possibility is that the input has internal pull up resistors. Get a meter on pin 15 and make sure the voltage changes cleanly from 0v to 5v - not the terminal on the breakout board, but the lead to the computer (unless, like mine there are no electronics on the BOB).

The only other thing is widen the slot. The input only needs one change of pulse every rev. so give it a good pulse. Your slot is less than 50th of the diameter. Spinning at say 3000 rpm - 50 revs/sec thats less than 1/2500 of a sec.

The only other thing I can think of - is there any stray light getting to the pickup by reflection.
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 04:30:47 AM
If you have a pulley set with anything other than a ratio of 1. Mach will use that ratio. Make sure that you havent selected a strange pulley. 
If you call the max speed of your drive does the DC level on the control output reach 10v? I believe there is an adjustment for that on the board.

Tony
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 04:34:54 AM
Forget the last post _ your'e obviously getting on ok on that problem!

Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 18, 2007, 08:21:13 AM
this does raise a question I had about setting the pulley ratios, the screen where this is set looks different than the screen shot in the pdf file
When I bring up the pulley ratio window if 1 is entered in the ratio box I assume this means 1 to 1 or do I need to enter 1:1 . I currently have it set at 1 just to eliminate that variable
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 12:00:59 PM
Right, the number 2 assumes a 2:1 step down to the spindle. In closed loop with S=500 say and ratio set to 1, the spindle will run up to 500 and the true speed will read 500. With a ratio of 2 the motor will run up to 1000, but the true speed reading will be 500. This is to take account of sensors that are not on the spindle, but on the motor. If your sensor is on the spindle, the ratio should always be 1.

Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 18, 2007, 12:05:11 PM
well I am no farther along than I have been the past few days, last night I was able to get the motor to spin up within 50 rpms of what was called out , chose save settings , shut the computer down, when I restated this morning all the settings are the same but I have to put in speed values way higher than the actual speed the shaft turns at.

I currently have everything configured axactly like the pdf file at this url http://cnc4pc.com/Tech_Docs/C11-Multifunction_CNC_Board_Manual_Rev3.pdf
spindle step pin set to 14 , ports and pins/spindle setup use spindle motor is checked and step and direction motor is checked.
On motor config/spindle I have steps per set at 1000 , velocity at max and have tried pulse width between 1 and 5 .
With the volt meter attached to the analog out put on the c11 board going to my vfd I cant get anywhere near 10v max , with a speed callout of s3000 I am getting aprox 0.5 volts , with a speed callout of s50000 I can get 2.9 volts
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 12:36:37 PM
What happens if you disconnect the feed to the VFD & measure the voltage? I would expect it to rise a little, but not very much. (showing that the VFD is not loading the analogue output)
I suppose you haven't played with the spindle calibration function. That can produce weird results, I don't think it works very well, myself. Click on defaults just in case. It doesn't tell you its done anything, but I think it removes any 'calibration' corrections that are applied. I haven't been able to find where the corrections are stored so that I can verify it. I suppose they should be in the xml file, but I can't see them.
There is a readout just below true speed on the manual screen, make sue that this reads 100% by pressing the adjacent reset button. This gets set to some odd values sometimes and will give you an incorrect speed.

Keep at it, we'll get there in the end!

Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 18, 2007, 01:15:24 PM
I have that value on the screen set at 100%
I just hooked the meter to the analog out put and the voltages present are .02 volt higher when the VFD is disconnected . I changed the pulse width to 5 in motor/ spindle config , left # of steps set at 1000 as reccomended in the cnc4pc setup document . With the meter attached to the analog out put on the board I get .1 v at s500, .2 volts at s1000 , 1.9v at s5000 , 3. volts at s10000 which rises to 10.7 volts over 20 seconds , 5.9 volts at s20000 which rises to 10.7 over 10 seconds.  The motor wont start with a speed input of anything less than s2500 which outputs 1.02 volts to the vfd
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 01:26:17 PM
Here's a strange thing. I've been sitting here playing with my machine & trying different things in the spindle setup. I eventually got into a mode where I couldn't get the speed up to normal. I tried all the various tricks we've been discussing but no change. I eventually copied yesterday's latest xml file from the xmlbackups directory (MacTurn.xb99 in my case), renamed  the current one in the root, and replaced it with the copy (suitably renamed). Ran up Mach again & all ok. No visible changes in the settings.

It's a useful thing to remember that when you save a setup, the old one goes into the backup directory.
I'm a bit concerned that things that I can't see are being stored. I suspect the spindle calibration data.

Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 18, 2007, 02:09:22 PM
I moved the encoder as reccomended earlier from pin 15 to 13, no change , decided to try it on pin 12 and its working perfectly now, reading dead on with my handheld optical tach so thats now working properly . Now just to figure out this spindle speed issue
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 02:28:28 PM
Oh that's good. It may be worth putting a switch or something on the  inputs that didn't work to check if they work ok as straight on/off controls. Is the PC port a built-in one or a PCI card?
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 18, 2007, 03:09:50 PM
the port is built in the motherboard, when I put the encoder on pin 12 I  moved my optical home for x axis to 13 and it seems to work fine, tried it on 15 , works there also. Now just the spindle speed issue. I dont mind entering huge speed values like s7000 to turn at 300 rpms as long as the threading feature will work properly. I assume the z axis advances a a set distance per revolution based on the actual spindle reading and P.** setting in G76 and I can generate my threading files and then edit the S*** to what ever value I need to get my spindle turning at 150-200 rpms

I also notice that settings change randomly when I exit mach, reboot and restart the software , I choose the setting for mach to zero x and z axis automaticly when I home the machine but this feature is turned off everytime I restart the software. Also  If I set the pulse width to 5 in motor setup, save settings when I re-open the motor config window the pulse width has changed to 4, click OK, open it again and its reset to 3 , drops one everytime the motor settings window is opened then closed
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 03:18:28 PM
What version are you using? I happen to have V2.52 on the lathe PC and V2.61 on this one. It all sounds a bit strange if the setup is changing. I've not seen that before.

Have you tried closing the loop now the index is working? My spindle runs a bit slow for most of its range but comes up to speed ok with closed loop.
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 18, 2007, 03:47:58 PM
There is something odd going on in the Motor tuning screen. On V2.61 if I put in a step pulse of 4 & save the axes, come out of that screen then go back in, the value changes to 3. It does the same for a value of 2 ( changes to 1), but not for 6 or any other number I've tried. V2.52 doesn't do this. Another thing that is strange is that you are not offered the choice of saving if you just alter the dir width. It seems to save anyway, but it's odd.
 It's possible to put in values up to 25us for step & 15us for dir if you need to. My steppers won't operate with anything less than 6.
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 18, 2007, 04:50:29 PM
I will try that in just a minute, I did not know it was possible to go that high, the documentation says 1-5 so I had not tried a higher value, that might solve my problem. I am using v2.61

I do have both spindle feed back and closed loop checked . Does g76 base the z axis feed rate on the actual spindle speed or the value entered in the wizard when generating the g-code?  Reason I ask is I generated a file at S100 , deleted the spindle speed line in the gcode and ran the spindle up to 200 rpm then ran the code , it cut a nice set of threads at aprox 19tpi, I ran the same file at 400 rpms and it cut decent threads at 9.5 tpi
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 18, 2007, 06:13:01 PM
the spindle speed creaping up slowly seems to only happen when I have the closed loop spindle control box checked, since S2000 yeilds about 180 actual rpms it makes sense that it just gradualy increasing the speed trying to get the actual speed to match the specified speed.

When I make a change in the pulse width box in motor configuration I can enter a figure as high as 25 but it doesnt seem to help get my actual speed closer to the specified speed, realistic speed callouts ov 100-300 rpms only yeild an output voltage of a few milivolts at the analog out put on the cnc4pc board. Also the value entered in the pulse width box drops by one each time the motor config window is opened and closed.
on the plus side I am getting really good at navigating all the setup windows in mach:)
Title: Re: Need a little spindle encoder timing help
Post by: ART on December 18, 2007, 11:13:39 PM
Hi Guys:

 I havent followed this thread fully, (Im having a very busy day here..) but Brett was kind enough to steer me here.

 The PID loop in Spindle isnt a good thing to use if it shows creeping, its very hard to tune on some systems, so its a cse of it works, or doesnt usually. In normal system,s, you simply command a S100000 and see what you get, then set the pulley max for that pulley to what you actually get. In most systems, your spindle will be accurate pretty much across the board..

Art
Title: Re: Need a little spindle encoder timing help
Post by: docltf on December 19, 2007, 12:42:26 AM
what are you using as a spindle motor.
are you using it with a gear reduction.
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 19, 2007, 04:27:13 AM
The reason I asked about the closed loop was to see if the system really could produce enough volts to bring it up to speed - it obviously can't. There's something basically wrong with either the rate of pulses being produced by Mach, or the conversion to volts. If you have a 'scope you could monitor the incoming step pulses and see if they do correspond with what you're asking for. I would do all this with an open loop.
Regarding the step width, I find that it doesn't make any difference to the speed - but of course I have a different Bob to you.
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 19, 2007, 09:00:55 AM
I am using a 2hp Baldor three phase AC motor and a teco FM100 VFD . My Encoder(pulse generator) is on the spindle. I am currently running it 1 to 1 to avoid any confsion , the pulley ratio in mach is set for 1 to 1 also. Mach is reading the spindle speed from the pulse generator and I am verifying the readings with an optical tach at both the motor output shaft and the spindle. The encoder is giving accurate readings in mach. My problem is the VFD is looking for a signal between 1 and 10 volts to vary the speed from 400 rpms to 2200 rpms as measured at the motor output shaft and I cant get a high enough voltage out of my analog output unless I have some wild speed entered like 10,000 rpms


My only problem currently is getting the speeds called out (s***) to give me a suitable voltage at the analog out put on the cnc4pc breakout board.  Any value under s1000 has an output of less than 1 volt which is not high enough to even get the motor to turn I have to enter values like s20000 or higher to get the full 10 volts from the analog output.
Does anyone have any thoughts on how I might be able to adjust the output voltage to be in the range needed for the speeds I am calling out , I need values more like 2volts when s150  but currently have to enter a value of s3000 to get 2 volts at the analog output terminals on the cnc4pc board. I can do the fine tunning in the vfd if I can just get it in the right range.

I also wonder how to get the pulse width value in motor configuration to remain constant and not drop by 1 each time the motor config window is opened
Title: Re: Need a little spindle encoder timing help
Post by: ART on December 19, 2007, 09:26:39 AM
In your case, Id call an S100000 as previously posted, then measure the result. Lets say you get a real rpm of 3000 , so then select configure pulleys, and set the pulley max to 3000.
 Now select S3000M3, and the spindle will then do 3000RPM, then select S1500 , what RPM do you get? Should be close to 1500 if your vfd is linear. Slowly decrease will the voltage is too low to run it, then set that S speed as the pulley minimum, then check linearity and see what happens.. Is it better?

Art
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 19, 2007, 09:35:52 AM
Don't forget that you do have some adjustment of voltage output on your Bob according to the PDF. I'm a bit surprised though that it isn't much higher already.

Tony
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 19, 2007, 10:56:20 AM
I know you'll have done it, but I'll ask anyway. Have you connected the auxiliary 12v supply to the analogue output stage? I hadn't realised, until I read the pdf in a bit more depth, that the analogue side is powered separately from the rest of the board. If you haven't it will certainly give very low outputs.


Tony
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 19, 2007, 11:20:34 AM
yes I have the 12v power supply attached  to the analog side. 
I set up the spindle pulleys as reccomended and am now getting the values I need, I guess I dont fully understand setting up the pulley ratios. Thanks For all the help
Title: Re: Need a little spindle encoder timing help
Post by: panaceabeachbum on December 19, 2007, 11:48:23 AM
I think I have figured out where my confusion was, I was thinking the max speed value in pulley set up was just a limit on the maximum speed the software would allow but its actualy the speed at which the full 10 volts is avail thru the analog out put. I had the value set at 20k so I had to have s20000 to get a full 10v out, reset it to 3000 and its now in the range I was looking for
Title: Re: Need a little spindle encoder timing help
Post by: TonyP on December 19, 2007, 01:49:56 PM
Ah I see! I thought the same thing. I've had a little play and achieved a rather better linearity in open loop. My numbers were more or less right, but I hadn't looked at it in that way when setting up.

I'm pleased you're finally getting going. What machine are you using? Mine's the Boxford TCL125.

Tony