Hello Guest it is May 10, 2021, 09:44:19 PM

Author Topic: Controling pneumatic Z-axis?  (Read 2348 times)

0 Members and 1 Guest are viewing this topic.

Controling pneumatic Z-axis?
« on: May 02, 2016, 11:54:09 AM »
I am in the process of re-retrofitting a Jig grinding machine I did a long time ago.  The machine is sort of a hybrid between the old control and Mach3.  Mach3 controls the X,Y and U (wheel outfeed) Axis.  The old control still handles the Z axis which is pneumatically driven with glass scale feedback.  I would like to take control of the Z in Mach.  This axis does not need to be precision controlled, I just need to be able to set and upper and lower limit so the Z axis will reciprocate between those limits.  I have done something similar in LinuxCNC using a Moog hydraulic servo valve with glass scale feedback to control the position of a hydraulic cylinder, but I have not done this in Mach3 or Mach4.

I am thinking I should take control of the relays that operate the pneumatic solenoid and use a script to monitor the position of the axis.  Once the position hits the upper or lower limit it would activate the relay to change direction.  Does this sound feasible? Is there a better way to do this?
Re: Controling pneumatic Z-axis?
« Reply #1 on: May 02, 2016, 03:04:24 PM »
The only problem is how fast do you want the z axis to travel?

Scripts and brains in Mach3 run at 10hz loop speed... So would it be possible the z would fly right past the limit switches before they saw a change of state?
Rob

Albert Einstein ― “If you can't explain it to a six year old, you don't understand it yourself.”
Re: Controling pneumatic Z-axis?
« Reply #2 on: May 03, 2016, 11:45:47 AM »
Well I just measured the speed of the Z-axis cranked all the way up and it goes about 250ipm.  There is a hard stop we use for grinding up to a shoulder of a c'bore to prevent the wheel from crashing into it. 

Here is a picture of the current control.  It has an upper limit and lower limit setting for the stroke.  It works fine, but I would like to be able to program the machine to rough multiple holes if I have a bolt pattern to grind.  I would need the Z to return home for the move from hole to hole.
Re: Controling pneumatic Z-axis?
« Reply #3 on: May 04, 2016, 08:31:56 PM »
250ipm = 4.16r"/sec

For mach3, that means 0.416" / macropump, script or brain loop..... there is a chance that it may fly right past a switch. (10hz loop frequency)

Mach4 has an adjustable (you can change it) loop frequency which is set within the screenset by editing the screenset, and its 50hz (note this does require a motion controller to pass information back to mach4 at the desired speed, default data transfer loop on the Ethernet Smooth Stepper is 40Hz (adjustable) for processing / action.  I don't know what the parallel port speed is in Mach4 at passing info back and forth, and the other motion controllers would require some exploration from their respective manufacturers that are supporting Mach4 (PMDX, Vital Systems & CSLabs and PoLabs are the only others I know of, but may not be up to speed)

hence your z could travel 0.083r"/loop before being detected by the loop (which is good) as I'd suggest you really want some sort of debounce to confirm that the switch has changed state to prevent potential noise or false triggering), ie you need the loop to pass twice to confirm that the switch has changed state (or internal filtering in the motion controller)

Not sure about the use of the glass encoder and how you would set limits, they would be better than a switch as it may be possible via algorithm (code or equation) to write a predictive script that would not only say where the z axis is at this time, but where its likely to be on the next loop, hence prepare to stop the z axis at just the right moment (you also need to allow for some amount of deceleration).  The equation that would work best would be a Kalman controls equation, although its rather complex (to me) and its used in many avenues such as radar and other interesting things (quadcopters / gyroscopes is another on occasion), it allows the equation to use the last position to calculate for the next expected position and a degree of noise it is self correcting (hence think about a plane or missile) and providing the velocity remains the same (whether constant, accelerating or decelerating) it allows for state.  It would be interesting to try to implement in cnc, but is probably not required as all that tends to happen in cnc is the limit switch is tripped, the device is stopped, either allowing for some deceleration and the position is estimated, or its backed up off the switch and then the position is also estimated with a smaller error.

If someone is interested there is info on the Kalman equation here which is well written.
http://bilgin.esme.org/BitsAndBytes/KalmanFilterforDummies
http://www.bzarg.com/p/how-a-kalman-filter-works-in-pictures/

There appears to also be some lua script that may be able to be Mach4 adapted maybe...
https://www.google.co.uk/search?q=kalman+lua&ie=utf-8&oe=utf-8&gws_rd=cr&ei=X4oqV9f3EYzNgAaguI7YDA


An alternative which is sometimes used is complementary filter which is a little easier to understand.

Note this is looking at the use of glass encoders, given they can provide you with the current position, velocity and change in velocity all of which is way more useful information (that is not utilised in cnc other than position) than just a limit switch which would probably work just fine for whatever accuracy you are looking for.

Mach4 is motion controller dependant, hence you need a clear understanding of what you require and what functions the manufacturers support.  A suggestion would be, maybe gather a list of the mach4 gcodes and mcodes together in an excel spreadsheet, with a tick box next to each, along with some background questions such as how frequently does the motion controller send information back and forth to Mach4 (as if its preset and non adjustable at 10hz.... its no benefit over Mach3), number of inputs and outputs, any analogue inputs (or outputs).... not that they are common place / used much, and confirmation of the use of M62 & M63 (not in the M4 manual last I checked) as they may be useful to trigger things later without hesitation, along with homing and probing functions (as they are internal to the motion controller and are not done in the PC / Mach4)

Personal experience.... product manufacturers are not very good at stating what a product cannot do (negative aspects are not perceived as product merits), hence saying it works with M4 is very common.... but asking what doesn't work is sometimes met with silence.... hence a direct question "does this function work or not?" will then require them to explicitly lie which is harder to do than a cover all statement "its M4 compatible" / "works with M4".

Buying an M4 motion controller to later find that it does not do what you want it to (or some specific function) can be disappointing if the product is not being supported by timely updates to correct deficiencies or follow the improving development cycle of new M4 updates being released (where occasional updates have reported working functions in motion controllers to now stop working for whatever reason).
Rob

Albert Einstein ― “If you can't explain it to a six year old, you don't understand it yourself.”
Re: Controling pneumatic Z-axis?
« Reply #4 on: May 06, 2016, 10:51:18 AM »
Thank you for the usefull info.  I am using a PMDX424 motion controller for this project.  Perhaps I will post something on their forum and see what they suggest.