Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: native34 on March 16, 2016, 10:29:48 AM

Title: Mach4 Spindle setup
Post by: native34 on March 16, 2016, 10:29:48 AM
Good morning, I have a question for the Mach 4 gurus on this site, as i'm trying to wrap my head around this and not getting anywhere fast, LOL. How does the system use the max spindle and Max motor speed. Does it use it to as a gear ratio then male the adjustment to the vfd 0-10v signal? Also is the Feedback ratio only used for closed loop functionality? I'm going to layout a scenario and could someone please tell me if i am on to something or hanging out in the breeze somewhere?

Example Scenario: If i set min spindle speed to 0, and Max spindle speed to 5000, and the Max Motor Speed to 3600. will mach figure out how much voltage (between 0-10V) to send the vfd using some formula and the 5000 and 3600 values from the Max Spindle and Max Motor Speed, if i command an m3 s2500, or m3 s950


MinRPM The minimum RPM the spindle in the selected range
MaxRPM The maximum RPM the spindle in the selected range

Feedback Ratio
By default the Feedback ratio is 1, a value of one is used in an application
where the feed back device is mounted on the spindle. If the feedback device is
mounted on the motor or some other part of th gear train the feedback ratio
can be used to get the correct speed.

Max Motor RPM
The maximum RPM of the spindle motor. The reason for the maximum RPM is to allow for proper
scalling of the motors RPM on all ranges. The motor RPM is used by motion devices, plugins, VFD's, Lua
etc for planning the proper motor RPM to get the requested spindle RPM.
Title: Re: Mach4 Spindle setup
Post by: Tweakie.CNC on March 16, 2016, 12:43:30 PM
As you have started a new thread I have closed the previous thread to avoid duplication of answers.

Quote
Example Scenario: If i set min spindle speed to 0, and Max spindle speed to 5000, and the Max Motor Speed to 3600. will mach figure out how much voltage (between 0-10V) to send the vfd using some formula and the 5000 and 3600 values from the Max Spindle and Max Motor Speed, if i command an m3 s2500, or m3 s950

Mach4 does not in itself send a voltage (between 0-10V) to the VFD.

The frequency output of your VFD and thus spindle speed, is determined by a 0-10Volts input. This 0-10Volts is generated by a digital to analogue converter which is part of your C32 BoB. This voltage is in turn derived from the PWM signal that is produced by your ESS. The range and scale of this PWM signal is determined by your Mach4 spindle settings and the appropriate S#### command which are then sent to the ESS.

Tweakie.
Title: Re: Mach4 Spindle setup
Post by: bob_at_pmdx on March 16, 2016, 02:40:39 PM
caveat: I do not know how the ESS calculates the PWM value, and I don't know how the C32 board converts that PWM into an analog voltage.  But in general:

For PWM generation, the plug-in *should* only use the min and max spindle RPM fields, along with the currently requested RPM.  The "Max Motor Speed" can be ignored for PWM and is (probably) only used for step pulse rate spindle control where the plug-in needs to know the actual spindle *MOTOR* RPM as well as the spindle RPM itself.

Feedback ratio is only used when you have a sensor or encoder on the spindle to measure actual spindle (or spindle motor) RPM.  This gives the ratio between # of pulses (or encoder counts) and one spindle revolution.

Generally, for PWM the formula could be one of two equations, depending on how the plug-in treats the "min RPM" setting:

If "min RPM" is the RPM that results from 0V (or 0% PWM duty cycle), then:

PWM duty cycle in percent = ((RequesedRPM - minRPM) / (MaxRPM - minRPM)) * 100
     or, to calculate voltage (0 to 10V):
Voltage = ((RequesedRPM - minRPM) / (MaxRPM - minRPM)) * 10

If "min RPM" is interpreted as the minimum that this particular pulley configuration can support, but 0V (or 0% PWM) still means 0 RPM( usually the case):

PWM duty cycle in percent = (RequesedRPM / MaxRPM) * 100
     or, to calculate voltage (0 to 10V):
Voltage = (RequestedRPM / MaxRPM) * 10
and the "min PWM" setting is only used to restrict allowable values in the "S" command.

And for "min RPM" == 0, these two equations become the same.

Now depending on how your hardware converts the PWM into the 0-10V output, there could be, and likely WILL be, some non-linearity in the analog transfer function.  You can test the linearity if you have a digital volt meter.  For various commanded RPM, measure the voltage on the PWM output pin from the ESS (or at the input to your C32 board).  It should be 0 to 5V (or pretty close) and *should* be linear with PWM duty cycle.  Then measure the 0-10V analog output.  If the analog conversion is linear, then the analog output should be exactly twice the voltage measured on the ESS PWM output.  Now this presumes that your PWM frequency is high enough that the digital meter is able to average a good number of cycles per meter reading.  If you put the meter on the ESS PWM output and you see the voltage changing more than a few millivolts (or whatever "noise" you usually see on DC voltage measurements), then the PWM frequency is low enough that the meter is not able to average enough cycles for a stable reading.

Bob
Title: Re: Mach4 Spindle setup
Post by: native34 on March 16, 2016, 04:12:49 PM
Thanks for the replies. I have tried changing the frequency in machine.ini, using numerous values and nothing seemed to change the voltage readings on the 0-10v analog. if I commanded m3 s3600, which is what I have set as max spindle speed, I get 10.01v. If I command m3 s1800 my voltage reading is 5.1v, and if I command m3 s900 my voltage reading is 2.93v. Obviously I have a problem with linearity but am having a B#@%$ of a time tracking down the problem, as I am not that well versed in the electrical engineering process of machine building. I am good with the Mechanical and am trying to learn more about the electrical side of things, but am just not there yet. Would anyone point me in the right direction on where to start to get this thing resolved? I am currently using a C32 BOB with ESS, but I just purchased a Pokeys57E and Pokeys motherboard from Arturo, as he tells me that the ESS is not up to snuff with Mach 4 yet and that Pokeys has a good motion controller that is working well with Mach4.
Title: Re: Mach4 Spindle setup
Post by: Steve Stallings on March 16, 2016, 05:00:58 PM
The fact that the output for S3600 is 10.1 volts, the output for S1800 is 5.1 volts,
and the output for S900 is 2.93 volts points to increasing error as you approach
the lower end. My best guess is that the Mach configuration and the ESS are doing
what they are supposed to do, and the analog circuitry on the C32 is not linear.

You could confirm this by taking a few more data points and graphing the result.
Mach or ESS problems could result in a graph with the line shifted, but it should
still be straight. If you get a line with a gradual curve near the low end, then it
is most likely a linearity problem with the PWM to analog conversion circuits.

Steve Stallings
www.PMDX.com
Title: Re: Mach4 Spindle setup
Post by: bob_at_pmdx on March 16, 2016, 06:02:34 PM
if I commanded m3 s3600, which is what I have set as max spindle speed, I get 10.01v. If I command m3 s1800 my voltage reading is 5.1v, and if I command m3 s900 my voltage reading is 2.93v. Obviously I have a problem with linearity but am having a B#@%$ of a time tracking down the problem, as I am not that well versed in the electrical engineering process of machine building.
If you can (I don't know the C32 board), see if you can measure the voltage on the PWM signal as it comes into the C32 board from the ESS.  You can (carefully) probe the pins on the bottom of the board on whatever connector the C32 has for the ESS (DB25 or 26-pin ribbon header).  That will tell you if the issue is the ESS or the C32 board.  The voltage should be linear 0 to 5V if the PWM signal is correct.
Title: Re: Mach4 Spindle setup
Post by: Steve Stallings on March 16, 2016, 06:18:29 PM
Bob is going out on limb just a bit. If the meter is a True RMS reading meter
it should work well. If it is like most ordinary meters, it may not be accurate
when reading a PWM signal on the DC volts scales.

Also, the logic signal from the SmoothStepper may not be a full 5.0 volts
even with 100% PWM, so scale your readings accordingly.

Steve Stallings
www.PMDX.com
Title: Re: Mach4 Spindle setup
Post by: native34 on March 16, 2016, 06:41:54 PM
Steve I spoke to you the other day, about another issue I'm having with my machine, regarding outter profile being to large by .005". If I can get these two issues fixed with my machine, it will be quite usable. At this point it is partially crippled. I can get the job done but I have to jump through a lot of hoops to get it accomplished. I'm starting to think the bulk of my problems are a result of the Ethernet smoothstepper. I have built other machines with cnc4pc breakout  boards and did not have these issues. I appreciate you not taking advantage of me when I called about your 424 board. After talking with Arturo I am replacing the ess, with a pokeys motion controller, which he tells me is a better fit with mach4.
Title: Re: Mach4 Spindle setup
Post by: native34 on March 17, 2016, 11:06:46 AM
Ok, I did some testing of the linearity for the PWM between the ESS and C32 BOB. I'm not sure what this means. So i was hoping that Bob or Steve would help me decipher it. To me it looks linear but not even, there is a rise to the line.

Title: Re: Mach4 Spindle setup
Post by: Steve Stallings on March 17, 2016, 11:48:46 AM
OK, the data that you collected confirms what I though was going on, i.e. the low
end of the range has an error where it outputs too much voltage and it gets worse
as you go lower.

Unfortunately your graph does not look like it shows this, BUT that is because the
horizontal axis of the graph is plotted with square law spacing NOT linear. If you
re-plot the graph with both axes linear the error will be very apparent.

Regards,
Steve Stallings
www.PMDX.com
Title: Re: Mach4 Spindle setup
Post by: bob_at_pmdx on March 17, 2016, 11:55:34 AM
On that scale the error is difficult to see (as Steve pointed out while I was typing this).  Yes, there is a little up-tick at the left side of the graph.

WARNING: the plots I suggest below PRESUME IDEAL RESPONSE OF THE VFD TO INPUT VOLTAGE!!!
That may or may not be the case.  They also presume that your volt meter is correctly averaging the PWM signal to give you the DC voltage reading.  As Steve politely corrected me above, that is not always the case.  Some of the error may be due to the volt meter, specially at the lower RPM settings (and this lower PWM duty cycle).

That said, here are some hints for other ways to look at the data:

(1) calculate voltage error for both the 10V and 5V measurements:
Voltage error = measured - ideal

(2) Then calculate and graph voltage error as a percentage of ideal voltage:
percent voltage error = ((voltage error) / (ideal voltage)) * 100

(3) Calculate what the actual RPM should be for the measured voltages (again PRESUMING IDEAL RESPONSE IN THE VFD):
calculated actual RPM = ((measured voltage) / (10)) * 3600
or divided by "5" for the 5V scale

(4) Calculate and graph the RPM error:
rpm error = (calculated actual RPM) - (commanded RPM)

As a curiosity, how does the VFD reported RPM match up with the calculated RPM in step (3) above?

Bob
Title: Re: Mach4 Spindle setup
Post by: arturod on March 18, 2016, 07:32:34 AM
Rodney,
Thanks for pointing me to this thread.  Here is a curve showing the linearity we get out of the C32:
 
As you can see the curve is a little higher than it is supposed to on the lower end (usually when accuracy counts more).  I think this circuit may be improved. I will take a second look at it.
In your case, you think you may be just fine by moving the curve just a little bit down.  You can do that by lowering the max speed or y playing with the on-board potentiometer.
Other solutions could be:
-   Closed Loop Spindle:  This used to work in Mach3, but the latest I know it is not working on the current versions of Mach3.  It is not currently supported on the PoKeys or ESS, but I am sure it will get implemented soon.  You can also implement it on the pokeys using brain, macro or LUA script by writing a script that would do the PID to correct the PWM to reach the commanded spindle speed.
-   Another solution would be to implement spindle speed control via Modbus.
Arturo Duncan
http://cnc4pc.com
Title: Re: Mach4 Spindle setup
Post by: native34 on March 19, 2016, 01:44:55 PM
Ok, i have a new problem. I got the Pokeys Motion controller and Pokeys motherboard from Arturo, Now when i set it up i can't jog any axis or start the spindle without getting error message "Mach4 motion steps overflow (-*********x) - check motor speed." Can anyone who has mach4 tell me what this means?
Title: Re: Mach4 Spindle setup
Post by: native34 on March 19, 2016, 03:48:57 PM
I figured out why i'm getting the step overflow error. It has to do with the resolution of steps on my vistacnc PA1-S pendant. It appears i can add this to the list of things that works spotty in Mach4. The vendor said that everything should work but i can't access the configuration screen in mach4 as that is not programmed in this version of the plugin. It seems to me that these hardware and software manufacturers need to stop selling stuff that works half assed and spend more time debugging before coming out with a product that only works partially, but hey we will have an update maybe for you someday. Sorry for the rant, just a little frustratedc with how my luck with my current hardware and software vendors has been going. I wish i knew then what i know now. I would have went with someone who cares about customer support like the guys at PMDX. These guys don't have a horse in this race but have been more than willing to help me get this sorted out as much as they can. For that fellas you have earned my future business.