Hello Guest it is March 28, 2024, 08:07:34 AM

Author Topic: Mach4 Spindle setup  (Read 14522 times)

0 Members and 1 Guest are viewing this topic.

Mach4 Spindle setup
« 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.

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Mach4 Spindle setup
« Reply #1 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.
PEACE
Re: Mach4 Spindle setup
« Reply #2 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
Re: Mach4 Spindle setup
« Reply #3 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.
Re: Mach4 Spindle setup
« Reply #4 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
« Last Edit: March 16, 2016, 05:05:11 PM by Steve Stallings »
Steve Stallings
www.PMDX.com
Re: Mach4 Spindle setup
« Reply #5 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.
Re: Mach4 Spindle setup
« Reply #6 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
Steve Stallings
www.PMDX.com
Re: Mach4 Spindle setup
« Reply #7 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.
Re: Mach4 Spindle setup
« Reply #8 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.

Re: Mach4 Spindle setup
« Reply #9 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
Steve Stallings
www.PMDX.com