Hello Guest it is May 07, 2026, 02:31:26 AM

Author Topic: mach3 pneumatic z axis setup  (Read 138 times)

0 Members and 1 Guest are viewing this topic.

mach3 pneumatic z axis setup
« on: May 04, 2026, 11:52:42 AM »
hey everyone,

ive been building a CNC machine purely for drilling so accuracy doesnt need to be 1/100th of a milimeter perfect.

for reasons ive been instructed to move forward with using a pneumatic cylinder to control the Z axis.

im planning on having 2 physical stops and a 24v 2 possition solenoid to control this. im just in need of help in setting up mach3 to be able to control this. i know it will need a signal pin assigning to the solenoid but im concerned about timing. i dont want mach 3 to start moving the X or Y while the cylinder still has the spindle below the top of the working surface.

any and all advice will be greatly appreciated.
Re: mach3 pneumatic z axis setup
« Reply #1 on: May 04, 2026, 07:07:39 PM »
Hey,

Simplest way is to add a small delay after activating the solenoid. In Mach3 you can use a G04 (dwell) so it waits before moving X/Y.

Example:

M7 (turn on solenoid)
G04 P0.5 (wait half a second)

Better option (more reliable) is to add a switch/sensor at the top so Mach3 knows the Z is fully up before moving.

If it’s a simple drilling setup, the delay usually works fine.

« Last Edit: May 05, 2026, 12:29:36 AM by Tweakie.CNC »
Re: mach3 pneumatic z axis setup
« Reply #2 on: May 04, 2026, 11:03:27 PM »
ok thats cool, the dwell can be written into the gcode software too as a standard implementation.

is there any configuration to tell mach3 that its not using a stepper motor for z anymore?
Re: mach3 pneumatic z axis setup
« Reply #3 on: May 05, 2026, 01:01:43 PM »
wait, the dwell would only work at the bottom of the plunge, the concern is the return.

im going to go about installing an upper and lower sensor but how would i configure mach3 to read these sensors and know that one is activated when the axis is at its lowest, trigger the vertically upward movement then read the upper sensor and know its then safe to move the X and Y?

Offline ZASto

*
  •  431 431
Re: mach3 pneumatic z axis setup
« Reply #4 on: May 05, 2026, 11:37:51 PM »
Or, you can use DIR signal for Z axis to control your cylinder.

eg.

G0 X100 Y100 // gantry moves to coordinate for drilling
G1 Z-10 // your cylinder gets energized and your drill goes down
G0 Z0 // your cylinder gets deenergized and your drill goes up
G4 P1.0 // wait a certain amount of time for the drill to clear the material surface

proceed to next hole
...

You can easily implement it in your postprocessor of your CAM software, or whatever you use to generate G-code

No switches, no aditional M codes, no extra configuration in Mach3
Make no mistake between my personality and my attitude.
My personality is who I am.
My attitude depends on who you are.
Re: mach3 pneumatic z axis setup
« Reply #5 on: May 06, 2026, 11:38:24 AM »
Or, you can use DIR signal for Z axis to control your cylinder.

eg.

G0 X100 Y100 // gantry moves to coordinate for drilling
G1 Z-10 // your cylinder gets energized and your drill goes down
G0 Z0 // your cylinder gets deenergized and your drill goes up
G4 P1.0 // wait a certain amount of time for the drill to clear the material surface

proceed to next hole
...

You can easily implement it in your postprocessor of your CAM software, or whatever you use to generate G-code

No switches, no aditional M codes, no extra configuration in Mach3


hey, this is an interesting approach however i dont really know a great deal about editing the post porcessor, i've got it here and i'll post it below, im wondering how i would go about implimenting this method into the post processor?

Code: [Select]
+================================================
+                                               
+ Mach2/3 - Vectric machine output configuration file   
+                                               
+================================================
+                                               
+ History                                       
+                                               
+ Who      When       What                         
+ ======== ========== ===========================
+ Tony     15/11/2005 Written for metric
+ Tony     06/01/2006 Added ATC option     
+ Tony     14/05/2006 Fixed G21 mm in header   
+ Tony     24/07/2006 Added G2 & G3 Arc support + removed (( ))
+ Tony     18/06/2007 Replaced the Tool comment     
+ Mark     14/08/2008 Added G1 to Feed moves,
+ Mark     28/08/2009 Added G91.1 to force use of incremental arcs
+ Mark     30/11/2009 Added TOOLPATHS_OUTPUT.
+ Brian    15/12/2009 Remove M05 from NEW_SEGMENT
+ Mark     18/01/2014 Added Dwell
+ Mark     24/10/2018 Added Helical arcs.
+================================================

POST_NAME = "Mach2/3 Arcs (mm) (*.txt)"

FILE_EXTENSION = "txt"

UNITS = "MM"

DIRECT_OUTPUT = "Mach|Mach4.Document"

SUBSTITUTE = "({)}"

+------------------------------------------------
+    Line terminating characters                 
+------------------------------------------------

LINE_ENDING = "[13][10]"

+------------------------------------------------
+    Block numbering                             
+------------------------------------------------

LINE_NUMBER_START     = 0
LINE_NUMBER_INCREMENT = 10
LINE_NUMBER_MAXIMUM = 999999

+================================================
+                                               
+    Formating for variables                     
+                                               
+================================================

VAR LINE_NUMBER = [N|A|N|1.0]
VAR SPINDLE_SPEED = [S|A|S|1.0]
VAR FEED_RATE = [F|C|F|1.1]
VAR X_POSITION = [X|C|X|1.3]
VAR Y_POSITION = [Y|C|Y|1.3]
VAR Z_POSITION = [Z|C|Z|1.3]
VAR ARC_CENTRE_I_INC_POSITION = [I|A|I|1.3]
VAR ARC_CENTRE_J_INC_POSITION = [J|A|J|1.3]
VAR X_HOME_POSITION = [XH|A|X|1.3]
VAR Y_HOME_POSITION = [YH|A|Y|1.3]
VAR Z_HOME_POSITION = [ZH|A|Z|1.3]
VAR SAFE_Z_HEIGHT = [SAFEZ|A|Z|1.3]
VAR DWELL_TIME = [DWELL|A|P|1.2]
+================================================
+                                               
+    Block definitions for toolpath output       
+                                               
+================================================

+---------------------------------------------------
+  Commands output at the start of the file
+---------------------------------------------------

begin HEADER

"( [TP_FILENAME] )"
"( File created: [DATE] - [TIME])"
"( for Mach2/3 from Vectric )"
"( Material Size)"
"( X= [XLENGTH], Y= [YLENGTH], Z= [ZLENGTH])"
"([FILE_NOTES])"
"(Toolpaths used in this file:)"
"([TOOLPATHS_OUTPUT])"
"(Tools used in this file: )"
"([TOOLS_USED])"
"[N]G00G21G17G90G40G49G80"
"[N]G71G91.1"
"[N]T[T]M06"
"[N] ([TOOLNAME])"

"[N][S]M03"
"[N](Toolpath:- [TOOLPATH_NAME])"
"[N]([TOOLPATH_NOTES])"
"[N]G94"
"[N][XH][YH][F]"


+---------------------------------------------------
+  Commands output for rapid moves
+---------------------------------------------------

begin RAPID_MOVE

"[N]G00[X][Y][Z]"


+---------------------------------------------------
+  Commands output for the first feed rate move
+---------------------------------------------------

begin FIRST_FEED_MOVE

"[N]G1[X][Y][Z][F]"


+---------------------------------------------------
+  Commands output for feed rate moves
+---------------------------------------------------

begin FEED_MOVE

"[N]G1[X][Y][Z]"

+---------------------------------------------------
+  Commands output for the first clockwise arc move
+---------------------------------------------------

begin FIRST_CW_ARC_MOVE

"[N]G2[X][Y][I][J][F]"

+---------------------------------------------------
+  Commands output for clockwise arc  move
+---------------------------------------------------

begin CW_ARC_MOVE

"[N]G2[X][Y][I][J]"

+---------------------------------------------------
+  Commands output for the first counterclockwise arc move
+---------------------------------------------------

begin FIRST_CCW_ARC_MOVE

"[N]G3[X][Y][I][J][F]"

+---------------------------------------------------
+  Commands output for counterclockwise arc  move
+---------------------------------------------------

begin CCW_ARC_MOVE

"[N]G3[X][Y][I][J]"

+---------------------------------------------------
+  Commands output for first clockwise helical arc  moves
+---------------------------------------------------

begin FIRST_CW_HELICAL_ARC_MOVE

"[N]G2[X][Y][Z][I][J][F]"

+---------------------------------------------------
+  Commands output for clockwise helical arc  moves
+---------------------------------------------------

begin CW_HELICAL_ARC_MOVE

"[N]G2[X][Y][Z][I][J]"

+---------------------------------------------------
+  Commands output for first counterclockwise helical arc  moves
+---------------------------------------------------

begin FIRST_CCW_HELICAL_ARC_MOVE

"[N]G3[X][Y][Z][I][J][F]"

+---------------------------------------------------
+  Commands output for counterclockwise helical arc  moves
+---------------------------------------------------

begin CCW_HELICAL_ARC_MOVE

"[N]G3[X][Y][Z][I][J]"

+---------------------------------------------------
+  Commands output for first clockwise helical arc plunge moves
+---------------------------------------------------

begin FIRST_CW_HELICAL_ARC_PLUNGE_MOVE

"[N]G2[X][Y][Z][I][J][F]"

+---------------------------------------------------
+  Commands output for clockwise helical arc plunge moves
+---------------------------------------------------

begin CW_HELICAL_ARC_PLUNGE_MOVE

"[N]G2[X][Y][Z][I][J]"

+---------------------------------------------------
+  Commands output for first counter clockwise helical arc plunge moves
+---------------------------------------------------

begin FIRST_CCW_HELICAL_ARC_PLUNGE_MOVE

"[N]G3[X][Y][Z][I][J][F]"

+---------------------------------------------------
+  Commands output for counter clockwise helical arc plunge moves
+---------------------------------------------------

begin CCW_HELICAL_ARC_PLUNGE_MOVE

"[N]G3[X][Y][Z][I][J]"

+---------------------------------------------------
+  Commands output for a new segment - toolpath
+  with same toolnumber but maybe different feedrates
+---------------------------------------------------

begin NEW_SEGMENT

"[N][S]M03"
"([TOOLPATH_NAME])"
"([TOOLPATH_NOTES])"

+---------------------------------------------
+  Commands output for a dwell move
+---------------------------------------------

begin DWELL_MOVE

"G04 [DWELL]"

+---------------------------------------------------
+  Commands output at the end of the file
+---------------------------------------------------

begin FOOTER

"[N]G00[ZH]"
"[N]G00[XH][YH]"
"[N]M09"
"[N]M30"
%




thank you for any help.