So, to be clear, you are using a pneumatic cilinder with compressed air? and an elecrtic valve to drive the cilinder up and down?
You also have an electric double way switch to do that i guess? To drive the selenoid?
This is an example of a custom switch (you can add as much switch you want according to the pins you can use)
- Switch module for PROBE control
switch.probe.enable true #enable this switch
switch.probe.input_on_command M106 # or M280 S—if you use a servo
switch.probe.input_off_command M107 # same as M280 S0 0% duty cycle, effectively off
switch.probe.output_pin 1.23 #(or the on/off pin you actually use)
switch.probe.output_type digital # Just an on/off signal if you are not using a servo
#switch.probe.pwm_period_ms 20 # leave this commented, you do not need this unless is a servo with pwm signal
So to control the switch, you can use the following G codes.
M106-turn servo on
M107-turn servo off
- Z probe
zprobe.enable true # set to true to enable a zprobe
zprobe.probe_pin 1.28^ # pin probe is attached to if NC remove the !
zprobe.slow_feedrate 1.8 # mm/sec probe feed rate
#zprobe.debounce_count 100 # set if noisy
zprobe.fast_feedrate 75 # move feedrate mm/sec
zprobe.probe_height 4.96 # how much above bed to start/finish probe, adjust this figure to tweak final Z height
- associated with zprobe the leveling strategy to use
leveling-strategy.three-point-leveling.enable true # a leveling strategy that probes three points to define a plane and keeps the Z parallel to that plane
leveling-strategy.three-point-leveling.point1 89,184 # the first probe point (x,y) optional may be defined with M557
leveling-strategy.three-point-leveling.point2 3,5 # the second probe point (x,y)
leveling-strategy.three-point-leveling.point3 162,5 # the third probe point (x,y)
leveling-strategy.three-point-leveling.home_first true # home the XY axis before probing
leveling-strategy.three-point-leveling.tolerance 0.03 # the probe tolerance in mm, anything less that this will be ignored, default is 0.03mm
leveling-strategy.three-point-leveling.probe_offsets -43.25,12.7,0 # the probe offsets from nozzle, must be x,y,z, (sign is opposite of what you would expect, and don't enter a Z offset here))
leveling-strategy.three-point-leveling.save_plane false # set to true to allow the bed plane to be saved with M500 default is false
(see bottom of this post for explanation of zprobe.probe_height)
The 3 probe points ideally are the 3 corners of an equilateral triangle (the largest you can comfortably fit on your print bed).
A manual procedure could be like this:
move print head to a suitable Z height (to leave clearance for the probe)
M106 – probe down
G32 – run the Z probe procedure
M107 – probe up
At this point your Z plane is set, you just need to home to Z, then you’re good to print, however this needs to be Z height relative to the first probe point. You can do that like this:
G1 X89 Y184 – moves head to X,Y coordinates of first probe point
manually drop nozzle to Z = 0 (use a sheet of paper, or your normal method to get the gap correct)
M306 Z0 – sets the current height to Z = 0
These settings will stay in force until your printer is reset (or you can save the plane to EEPROM with M500).
Now try to automate to this in your start G code, and probe before every print , The following is an example start G code
M80 ; PSU on
G4 P2000 ; wait 2 seconds for power to stabilise
M104 S60 ; set bed temperature and no wait
M109 S205; set bed temp and wait ;(you need to calibrate the zprobe with the nozzle in working conditions)
G1 Z25 ; move up 25mm to ensure room to drop probe
M106 ; probe down
G32 ; run Z probe (finish height is set in config file)
M107 ; probe up
G92 Z16.2 ; set Z (probe offset (11.2) plus probe finish height)
G4 P1000 ; wait 1 second
M190 S60 ; set bed temp and wait
M109 S200 ; set extruder temp, and wait
G1 X150 Y0 ; move 150mm along the front edge
G1 Z0 ; drop nozzle to prevent ooze
G1 Z[first_layer_height] ; move nozzle to print height
G1 X10 F8000 E6 ; Wipe (move toward origin fast, extruding 6mm)
THOSE ARE JUST EXAMPLES!!! Please be careful and always try them with your Z axis up and ready to turn off power if needed!!
Is just to show you what you can do to automate your bed level procedure.
Even if it looks as a time wasting, is always a good idea to do an accurate bed leveling procedure, is not just the first layer, all the print can be affected by a bad first layer.
And please you will forgive some errors, just take this like an example, just to have an idea.