Z Sensors

Hello,
Usually when I use my printer3D, I have a capacitive sensor set on the heated bed, it is declared on the ENDSTOP_PULLUP_Z_MIN.
I would like to use a other sensor (just a switch) when I use CN as CNC Milling, is't possible without deconnect the capacitive sensor ?
and how to declare in firmware on a other pin?
This sensor will always be higher (placed on the part) and used with G30 H (xx) R (xx).

Best regards 

«1

Comments

  • That way it is not possible. You must use the same pin and both must have the same high signal settings. Then you must deactivate the unused pin.
    Alternatively you need to find all usages of the pin (there are not so many) and switch based on the printer mode.
  • Thank you for your reply
    I will do otherwise, (use a gate 'OR' or an inverter switch)
  • G21                  ; metric values
    G28                  ; home
    G1 F2400 Z100  ; Z degagement
    G30 H20 R0      ; Probing
    G1 F200 Z90

    Hello,
    I must have a problem, but without knowing where ...
    In the example:
    G30 H(stock height) R0
    the probe comes to palpate the top of the stock and goes back to its previous position,
    the display on the LCD shows Z0, in Repetier Host the displayed value remains Z100.

    At the next command G1, the Z axis goes down completely and the probe hits the bed without stopping.
    While the Z value is 90 and the original Z has been redefined, the axis should go up.

    But probably I misunderstood of G30 H <> R <> or a bad firmware setting ....

    // #################### Z-Probing #####################

    #define Z_PROBE_Z_OFFSET 0
    #define Z_PROBE_Z_OFFSET_MODE 0
    #define UI_BED_COATING 1
    #define FEATURE_Z_PROBE 1
    #define EXTRUDER_IS_Z_PROBE 0
    #define Z_PROBE_DISABLE_HEATERS 0
    #define Z_PROBE_BED_DISTANCE 0
    #define Z_PROBE_PIN ORIG_Z_MIN_PIN
    #define Z_PROBE_PULLUP 0
    #define Z_PROBE_ON_HIGH 0
    #define Z_PROBE_X_OFFSET 0
    #define Z_PROBE_Y_OFFSET 0
    #define Z_PROBE_WAIT_BEFORE_TEST 0
    #define Z_PROBE_SPEED 20
    #define Z_PROBE_XY_SPEED 150
    #define Z_PROBE_SWITCHING_DISTANCE 1
    #define Z_PROBE_REPETITIONS 1
    #define Z_PROBE_USE_MEDIAN 0
    #define Z_PROBE_HEIGHT 0
    #define Z_PROBE_DELAY 0
    #define Z_PROBE_START_SCRIPT ""
    #define Z_PROBE_FINISHED_SCRIPT ""
    #define Z_PROBE_RUN_AFTER_EVERY_PROBE ""
    #define Z_PROBE_REQUIRES_HEATING 0
    #define Z_PROBE_MIN_TEMPERATURE 150
    #define FEATURE_AUTOLEVEL 1
    #define FEATURE_SOFTWARE_LEVELING 0

    Regards
  • Forget host in this context, Host does not know about this and will show real global coordinates as it assumes you have set. It does not know about the G30 offset change. Important is what M114 returns and what printer lcd shows.

    - G30 H<height> R<offset> Make probe define new Z and z offset (R) at trigger point assuming z-probe measured an object of H height.

    Usage seems correct. You say object hit by z probe is H=20mm height and there it should assume z=0 so that you can go down until Z=-20. Being back I'd expect to see a value around 80mm on lcd.

    So starting from that what does lcd show for Z after G30?

    G28                  ; home
    G1 F2400 Z100  ; Z degagement
    G30 H20 R0      ; Probing

    How does this work? I mean where do you home as I do not see the move to the object. If you do not hit the object with height 20mm you can go through the bed.
  • Yes, you're right, the display on the LCD should indicate 80 but after the G30, it says 0 ...
    the log after the G30:
    Z-probe : NAN X:0 Y:0
    After the M114: 
    X:0 Y:0 Z:NAN E:0
    So even though it's perfectly detecting the piece, Z does not seem to have memorized the value...
    I'm using firmware 1.0.3, do you want the full Configuration.h?
  • The problem here is surely the NAN. So question is where this comes from. Computing with this number never makes sense and only adds problems. So I'd say there is something wrong.

    Can you show log for simple G30 and your G30 including all ack/command messages. Maybe I get an idea where it comes from. Also check eeprom - I guess one of the z probe related variables is not defined good and has NaN in eeprom causing this.
  • edited April 2019

    seems it doesn´t set correct G92 Offset , same situation in V2.

    unfortunately too busy today, will search on weekend
  • edited April 2019
    Think i found the problem:

    in the g30 section

               
    V2 actual:
               
                Motion1::g92Offsets[Z_AXIS] = o - h;
                Motion1::currentPosition[Z_AXIS] = z + h + Motion1::minPos[Z_AXIS];
                Motion1::updatePositionsFromCurrent();
                Motion1::setAxisHomed(Z_AXIS, true);
               
               
    V2 NEW           
                    Motion1::g92Offsets[Z_AXIS] = z + o - h;
                    Motion1::g92Offsets[Z_AXIS] -= Motion1::currentPosition[Z_AXIS] ;
                    Motion1::updatePositionsFromCurrent();
                    Motion1::setAxisHomed(Z_AXIS, true);

    this calculates the correct g92 offset and z position.

    Motion1::minPos[Z_AXIS] is not necessary as we refer to workpiece not to zmin of machine

    for V1 that should match:

    actual:      Printer::coordinateOffset[Z_AXIS] = o - h;
                    Printer::currentPosition[Z_AXIS] = Printer::lastCmdPos[Z_AXIS] = z + h + Printer::zMin;
                    Printer::updateCurrentPositionSteps();
                    Printer::setZHomed(true);
                   
                   
     new:              
                    Printer::coordinateOffset[Z_AXIS] = z + o - h;
                    Printer::coordinateOffset[Z_AXIS] -= Printer::currentPosition[Z_AXIS];
                    Printer::updateCurrentPositionSteps();
                    Printer::setZHomed(true);
                   

    i tested the code only on V2 as i have no V1 running

    @Tanuki44 : can you check it on your system? at least it´s just 2 lines to change

    I´ll send an e-mail with the actual state mods on V2 ( the Typo on axis setup , the bluetooth fix and this one)
    maybe you´ll find the time to update gihub branch

  • Ok no problem, I test this and return feedback
  • With the modification of the 2 lines, the operation of G92 seems correct 
    G21
    G28
    G1 F2400 Z100
    G92 Z0                             ; redefined Z0                  but display LCD = Z:100
    G1 F1000 Z-50                  ; the Z axis goes down 50mm   display LCD = Z:50
    G1 F1000 Z5                     ; the axis goes to the new Z5    display LCD = Z:105

    About  G30:
    G21
    G28
    G1 F2400 Z100
    G30 H20 R0

    After G30 H20 R0, now the display LCD no longer shows Z0, but Z100 and still not 80.
    and always Z: NAN X: 0 Y: 0 
    G0 or G1 has no action

    The Eeprom:
    <?xml version="1.0" encoding="utf-8"?><Repetier-Firmware-EEPROM><epr pos="1028" type="0" value="7">Language</epr>
    <epr pos="75" type="2" value="115200">Baudrate</epr>
    <epr pos="129" type="3" value="191.541">Filament printed</epr>
    <epr pos="125" type="2" value="395802">Printer active</epr>
    <epr pos="79" type="2" value="0">Max. inactive time</epr>
    <epr pos="83" type="2" value="360000">Stop stepper after inactivity</epr>
    <epr pos="3" type="3" value="200.0000">X-axis steps per mm</epr>
    <epr pos="7" type="3" value="200.0000">Y-axis steps per mm</epr>
    <epr pos="11" type="3" value="400.0000">Z-axis steps per mm</epr>
    <epr pos="15" type="3" value="100.000">X-axis max. feedrate</epr>
    <epr pos="19" type="3" value="100.000">Y-axis max. feedrate</epr>
    <epr pos="23" type="3" value="40.000">Z-axis max. feedrate</epr>
    <epr pos="27" type="3" value="40.000">X-axis homing feedrate</epr>
    <epr pos="31" type="3" value="40.000">Y-axis homing feedrate</epr>
    <epr pos="35" type="3" value="10.000">Z-axis homing feedrate</epr>
    <epr pos="39" type="3" value="20.000">Max. jerk</epr>
    <epr pos="47" type="3" value="1.000">Max. Z-jerk</epr>
    <epr pos="133" type="3" value="-140.000">X min pos</epr>
    <epr pos="137" type="3" value="-150.000">Y min pos</epr>
    <epr pos="141" type="3" value="-0.500">Z min pos</epr>
    <epr pos="145" type="3" value="280.000">X max length</epr>
    <epr pos="149" type="3" value="290.000">Y max length</epr>
    <epr pos="153" type="3" value="190.000">Z max length</epr>
    <epr pos="1056" type="3" value="-100.000">Park position X</epr>
    <epr pos="1060" type="3" value="20.000">Park position Y</epr>
    <epr pos="1064" type="3" value="20.000">Park position Z raise</epr>
    <epr pos="51" type="3" value="200.000">X-axis acceleration</epr>
    <epr pos="55" type="3" value="200.000">Y-axis acceleration</epr>
    <epr pos="59" type="3" value="10.000">Z-axis acceleration</epr>
    <epr pos="63" type="3" value="200.000">X-axis travel acceleration</epr>
    <epr pos="67" type="3" value="200.000">Y-axis travel acceleration</epr>
    <epr pos="71" type="3" value="200.000">Z-axis travel acceleration</epr>
    <epr pos="1032" type="3" value="100.000">Acceleration factor at top</epr>
    <epr pos="1024" type="3" value="0.000">Coating thickness</epr>
    <epr pos="808" type="3" value="0.000">Z-probe height</epr>
    <epr pos="929" type="3" value="0.000">Max. z-probe - bed dist.</epr>
    <epr pos="812" type="3" value="2.000">Z-probe speed</epr>
    <epr pos="840" type="3" value="150.000">Z-probe x-y-speed</epr>
    <epr pos="800" type="3" value="0.000">Z-probe offset x</epr>
    <epr pos="804" type="3" value="0.000">Z-probe offset y</epr>
    <epr pos="816" type="3" value="130.000">Z-probe X1</epr>
    <epr pos="820" type="3" value="0.000">Z-probe Y1</epr>
    <epr pos="824" type="3" value="130.000">Z-probe X2</epr>
    <epr pos="828" type="3" value="0.000">Z-probe Y2</epr>
    <epr pos="832" type="3" value="130.000">Z-probe X3</epr>
    <epr pos="836" type="3" value="0.000">Z-probe Y3</epr>
    <epr pos="1036" type="3" value="0.000">Z-probe bending correction A</epr>
    <epr pos="1040" type="3" value="0.000">Z-probe bending correction B</epr>
    <epr pos="1044" type="3" value="0.000">Z-probe bending correction C</epr>
    <epr pos="1048" type="1" value="85">Bed Preheat temp.</epr>
    <epr pos="106" type="0" value="3">Bed Heat Manager</epr>
    <epr pos="107" type="0" value="230">Bed PID drive max</epr>
    <epr pos="124" type="0" value="80">Bed PID drive min</epr>
    <epr pos="108" type="3" value="196.000">Bed PID P-gain</epr>
    <epr pos="112" type="3" value="33.000">Bed PID I-gain</epr>
    <epr pos="116" type="3" value="290.000">Bed PID D-gain</epr>
    <epr pos="120" type="0" value="255">Bed PID max value</epr>
    <epr pos="200" type="3" value="370.000">Extr.1 steps per mm</epr>
    <epr pos="204" type="3" value="800.000">Extr.1 max. feedrate</epr>
    <epr pos="208" type="3" value="400.000">Extr.1 start feedrate</epr>
    <epr pos="212" type="3" value="400.000">Extr.1 acceleration</epr>
    <epr pos="294" type="1" value="235">Extr.1 Preheat temp.</epr>
    <epr pos="216" type="0" value="1">Extr.1 heat manager</epr>
    <epr pos="217" type="0" value="230">Extr.1 PID drive max</epr>
    <epr pos="245" type="0" value="40">Extr.1 PID drive min</epr>
    <epr pos="218" type="3" value="7.4100">Extr.1 PID P-gain/dead-time</epr>
    <epr pos="222" type="3" value="0.1000">Extr.1 PID I-gain</epr>
    <epr pos="226" type="3" value="40.2900">Extr.1 PID D-gain</epr>
    <epr pos="230" type="0" value="255">Extr.1 PID max value</epr>
    <epr pos="231" type="2" value="0">Extr.1 X-offset</epr>
    <epr pos="235" type="2" value="0">Extr.1 Y-offset</epr>
    <epr pos="290" type="2" value="0">Extr.1 Z-offset</epr>
    <epr pos="239" type="1" value="1">Extr.1 temp. stabilize time</epr>
    <epr pos="250" type="1" value="150">Extr.1 temp. for retraction when heating</epr>
    <epr pos="252" type="1" value="0">Extr.1 distance to retract when heating</epr>
    <epr pos="254" type="0" value="255">Extr.1 extruder cooler speed</epr>
    <epr pos="300" type="3" value="370.000">Extr.2 steps per mm</epr>
    <epr pos="304" type="3" value="800.000">Extr.2 max. feedrate</epr>
    <epr pos="308" type="3" value="400.000">Extr.2 start feedrate</epr>
    <epr pos="312" type="3" value="400.000">Extr.2 acceleration</epr>
    <epr pos="394" type="1" value="235">Extr.2 Preheat temp.</epr>
    <epr pos="316" type="0" value="1">Extr.2 heat manager</epr>
    <epr pos="317" type="0" value="230">Extr.2 PID drive max</epr>
    <epr pos="345" type="0" value="40">Extr.2 PID drive min</epr>
    <epr pos="318" type="3" value="7.4100">Extr.2 PID P-gain/dead-time</epr>
    <epr pos="322" type="3" value="0.1000">Extr.2 PID I-gain</epr>
    <epr pos="326" type="3" value="40.2900">Extr.2 PID D-gain</epr>
    <epr pos="330" type="0" value="255">Extr.2 PID max value</epr>
    <epr pos="331" type="2" value="0">Extr.2 X-offset</epr>
    <epr pos="335" type="2" value="0">Extr.2 Y-offset</epr>
    <epr pos="390" type="2" value="0">Extr.2 Z-offset</epr>
    <epr pos="339" type="1" value="1">Extr.2 temp. stabilize time</epr>
    <epr pos="350" type="1" value="150">Extr.2 temp. for retraction when heating</epr>
    <epr pos="352" type="1" value="0">Extr.2 distance to retract when heating</epr>
    <epr pos="354" type="0" value="255">Extr.2 extruder cooler speed</epr>
    </Repetier-Firmware-EEPROM>

  • For G30 H20 R0 :

    17:36:13.078 : T:16.00 /0 B:16.00 /0 B@:0 @:0 T0:16.00 /0 @0:0 T1:16.00 /0 @1:0
    17:36:13.296 : wait
    17:36:13.718 : N21 G30 R0 H20*1
    17:36:13.718 : ok 21
    17:36:14.203 : T:16.00 /0 B:16.00 /0 B@:0 @:0 T0:16.00 /0 @0:0 T1:15.80 /0 @1:0
    17:36:15.312 : T:15.80 /0 B:16.00 /0 B@:0 @:0 T0:15.80 /0 @0:0 T1:16.00 /0 @1:0
    17:36:15.718 : busy:processing
    17:36:16.375 : T:15.80 /0 B:16.00 /0 B@:0 @:0 T0:15.80 /0 @0:0 T1:16.00 /0 @1:0
    17:36:17.468 : T:16.00 /0 B:16.00 /0 B@:0 @:0 T0:16.00 /0 @0:0 T1:15.80 /0 @1:0
    17:36:17.718 : busy:processing
    17:36:18.578 : T:16.00 /0 B:16.20 /0 B@:0 @:0 T0:16.00 /0 @0:0 T1:16.00 /0 @1:0
    17:36:19.000 : Z-probe:NAN X:-140.00 Y:-150.00
    17:36:19.000 : wait
    17:36:19.671 : T:16.00 /0 B:16.00 /0 B@:0 @:0 T0:16.00 /0 @0:0 T1:16.00 /0 @1:0
    17:36:20.000 : wait
  • For simple G30 : 

    17:33:00.187 : wait
    17:33:00.859 : T:15.80 /0 B:16.00 /0 B@:0 @:0 T0:15.80 /0 @0:0 T1:15.80 /0 @1:0
    17:33:01.078 : N16 G30*45
    17:33:01.078 : ok 16
    17:33:01.968 : T:15.80 /0 B:16.00 /0 B@:0 @:0 T0:15.80 /0 @0:0 T1:15.80 /0 @1:0
    17:33:03.062 : T:15.80 /0 B:16.00 /0 B@:0 @:0 T0:15.80 /0 @0:0 T1:15.80 /0 @1:0
    17:33:03.078 : busy:processing
    17:33:04.156 : T:15.80 /0 B:16.00 /0 B@:0 @:0 T0:15.80 /0 @0:0 T1:15.80 /0 @1:0
    17:33:05.078 : busy:processing
    17:33:05.265 : T:15.80 /0 B:16.00 /0 B@:0 @:0 T0:15.80 /0 @0:0 T1:16.00 /0 @1:0
    17:33:06.312 : Z-probe:NAN X:-140.00 Y:-150.00
    17:33:06.312 : wait
    17:33:06.359 : T:16.00 /0 B:16.00 /0 B@:0 @:0 T0:16.00 /0 @0:0 T1:15.80 /0 @1:0
    17:33:07.312 : wait

    Thanks for your help !
  • think the problem is the NAN but from upper posts i cannot see whats wrong.
    did you look at eeprom contents with repetier host eeprom editor?
    may be the NAN is indicated somewhere.

    regarding LCD : it shows machine coords , not the corrected ones so i guess you are in mode FFF

    which Firmware version do you use?
  • edited April 2019
    I use the 'Firmware EEPROM Configuration' in the 'Config' Menu.
    I exported the content, see post from 5:15Pm ... I'm not see anormal anything...
    I use the 1.0.3 version.
    I have tested in FFF and CNC mode, it's same...
    NAN ... I think like you, the value is either not calculated or not memorized, how to know?
    I use the same sensor for z_min and Z_probe...
  • edited April 2019
    in cnc mode you should have machine coordinates on one side  and g92 corrected coordinates on the other side


    can you post( better upload somewhere) your configuration.h so i´ll try your setup on my machine

    may be the same sensor for z_min and Z_probe makes the difference , i home to z-max , as usual in cnc

    but the unwanted moves (crashing into bed) are fixed , correct?


  • edited April 2019
    look at this, thats not correct :

    <epr pos="816" type="3" value="130.000">Z-probe X1</epr>
    <epr pos="820" type="3" value="0.000">Z-probe Y1</epr>
    <epr pos="824" type="3" value="130.000">Z-probe X2</epr>
    <epr pos="828" type="3" value="0.000">Z-probe Y2</epr>
    <epr pos="832" type="3" value="130.000">Z-probe X3</epr>
    <epr pos="836" type="3" value="0.000">Z-probe Y3</epr>

    you have same coords for all 3 measuring points

    try f.e.  :

    x1 100 y1 20
    x2 150 y2 20
    x3 125 y3 70

    the three points have to define a triangle

  • In fact, I do not really use the FEATURE_AUTOLEVEL, it is activated but I probe only one point, I should rather put FEATURE_AUTOLEVEL = 0, but is this important? ...

    I will look more precisely (display-for-laser-cnc-mode) and I will post the configuration.h

    I'm using the z_min in FFF mode (printer DIY) ... and when I look BedLeveling.cpp, the reference is z_max...

    As I understand my professional CNC work with the sensor in Z_max.

    Is it possible in CNC mode to use the z_max sensor and to keep the z_min in FFF mode or to switch to z_max?

    Thanks for your help

  • "and when I look BedLeveling.cpp, the reference is z_max..."

    you have zmax here:

    <epr pos="153" type="3" value="190.000">Z max length</epr>

    it does not depend on homing direction.

    so may be you give the 3 different points a try , may be it helps isolate the error



  • I looked the CNC mode, the values ​​are well indicated and correct after the G92 Z0.
    Good work  ;)

    Here is the link for the Confiiguration.h file


    The values ​​of EEprom are in the post above.

    If G30 does not work, I can use the G92 to set the probe height offset in the gcode.


  • what happens if you use your script in cnc mode?

    i mean:

    G21
    G28
    G1 F2400 Z100
    G30 H20 R0


    so i think coords are shown correct in cnc mode
  • Even in cnc mode, after G30, the Z axis goes down to the sensor and goes back to Z100

    Z: NAN, then impossible to move the Z axis, only G28 unblocks the axis.
  • "it does not depend on homing direction.
    so may be you give the 3 different points a try , may be it helps isolate the error"
    Ok for z_max, I tested the 3 points as soon as I'm at home.
  • Do you have distortion correction compiled in or not? G33 L0 will show correction values. This gets added so a nan from that would explain it. Bending correction gets added but these are 0 in your eeprom, same as z probe height which you have 0. Last thing is rotation correction matrix that might be used if you have leveled using G32. The NAN problem clearly lies in float Printer::runZProbe in BedLeveling.cpp. Something you have has not a valid value. So last thing I could not see is autoleveling and distortion correction values. You can reset them both to 0 to be sure.
  • edited April 2019
    Usually, I do not use any correction except Z_PROBE_Z_OFFSET and Z_PROBE_HEIGHT
    I'm looking at this more precisely as soon as I'm at home and I'll say

  • I will not be able to report all the tests and all the errors that I had .... BedLeveling's tests were all bad ... 

    Not finding a solution, I executed M500 and I imported a backup of Eeprom, things worked out.

    Finally, I think that's what repaired everything...

    Now, any values ​​displayed in CNC mode are correct with G32, G30 Hxx Rxx

    Everything seems to work for the moment except the G33 L0 and R0 return this:

    17:49:04.468 : N20 G33 L0*119
    17:49:04.468 : Unknown command:N20 G33  L0.00
    17:49:14.593 : N21 G33*42
    17:49:14.593 : Unknown command:N21 G33
    17:58:30.046 : N22 G28 Z0*105
    17:58:36.984 : X:-140.00 Y:-150.00 Z:-0.500 E:0.0000
    17:58:49.390 : N23 G33 R0*106
    17:58:49.390 : Unknown command:N23 G33  R0.00

    Is the syntax incorrect?

    Is there an 'M' command for setting Z_PROBE_Z_OFFSET et Z_PROBE_HEIGHT ?

    I thank you for your help that will allow me to use my machine in FFF et CNC mode...and perhaps in laser a bit later


  • edited April 2019
    G33 needs Distortion correction compiled in

    #define DISTORTION_CORRECTION 1

    you have set that to 0 , that´s why you get "unknown command"

    you can set height and offset of z probe simply in firmware eeprom editor , for supported commands see file
    Repetier.ino ,theres also a short description

  • edited April 2019
    Ok for G33
    I usually use the machine with only the SD.
    I wish I could set these values ​​temporarily via the Gcode file generated by the post pro.
    I was thinking of implementing a custom M code to do it ...

    as such as :

        case 210: // M210 H<xxx>
            if(com->hasH()) {
                Com::tZProbeOffsetZ = com->H;
            }
            break;

    Is't correct and possible ?

  • Don´t think it´s that simple,
    as far as i can see the offset is read from eeprom  , see printer.cpp around line 482
    as zprobe offset is not a variable  i think you have code something writing changed value to eeprom
  • This is unfortunately what I feared too, hence my question  ;)

    But as I want to keep the initial value in Eeprom (corresponding to FFF mode) ...

    Thanks
Sign In or Register to comment.