Auto-levelling and Z-endstop problem

I am stumped and hope that someone can help please.

I have changed the X-carriage and extruders on my Prusa i3 steel derivative printer and have added Z-probe capabilities using one of David Crockers optical boards connected to the X-max endstop channel. It works when I test it with a G30 P0 command, doing the three checks and then providing a response.

I also have Z-endstops on maximum and minimum channels. I have set the Z-probe offset (2.5mm) and the heatbed has three manual height adjustment screws.

I am using Repetier firmware (0.92.9), host (2.0.1) and server (0.80.3).

I have run through this page and think I have done everything correctly.


1. When I home the Z axis with no Z-probing, the endstop triggers and the nozzles is about where it should be to print but the nozzles then raise a few millimetres. If I start a print it prints those same few millimetres above the bed

2. When I do a G30 P0 it works fine and returns results that make sense for the Z axis

3. Executing a G29 when the head is at the centre of the heatbed causes the Z-height to decrease to about 10mm then the X-axis goes to home and the Y axis goes to maximum (my Y-home is minimum) followed by a critical error reported by Repetier Host (G29 fialed, clear problem then run M999). Why does it try to home on Y Max, not Min and why does it error on G29?

4. G32 causes the Y axis to go to minimum again, the X to home and the Z to go to maximum where it hits the endstop and I get the error message from Repetier again.

What am I doing wrong, please?




  • After issuing G32, I find following errors in the log:
    1. Unknown command:M340 S550 P0
    2. Error:Z-probe failed
    3. Error:Probing had returned errors - autoleveling canceled.
    4. fatal:G32 leveling failed! Printer stopped and heaters disabled due to this error. Fix error and restart with M999. (2)

    I guess that part of my challenge is that I don't know what G32 should do (what set of commands should it run)? 


  • M340 is servo position. If you have no servo do not add that into z probe activation.

    Since your z probe is not z min endstop you need to home to z max and disable z min completely. You can not have autoleveling and a fixed z min pin. All you can do is having z min pin identical with z probe pin, but then you have additional problems you need to take care off. z max homing is the best solution anyway, and yes I know it takes longer to home and start print. Set you end gcode to move up after printer and it only hals as painfull:-)

    You need only G32 S2 once you have inserted bed or changed something on bed calibration. Forget G29.
    Home to z max, go to Z = 10, x,y = 100,100 and run G32 S2. Make sure you have set in eeprom the correct points for measurement. G32 will either measure these 3 points with activated z probe offset or a parallelgram spanned by the points like in config tool image. If it fails, normally from using wrong coordinates there that can not be reached.
  • Thank you for the explanation - I also found a setting in the menu on the printer LCD display that was set to auto-level off - I changed that to on and then did as you outlined above and it now works much better. I still have some tuning to do but I'm getting there!

    Thanks again!

  • That function should only be turned on when you had a successfull G32 S2. In fact G32 will turn it on anyway if successfull.
  • I'm still working on the adjustments but am intrigued by the logic employed.

    Why does it home to Z Max before a print starts? I would have thought that homing to Z Max
    to get the maximum height then probe at the print origin (bed centre) and apply the probe offset and levelling  from there would minimise any errors caused by the Z-limit switch. Surely the probe should be more accurate than the limit switch which is a few hundred millimetres up?

    Or am I missing something obvious?


  • Precision depends not on height of limit switch. at z = 0 it has same precision as ob Z = 1000.

    The only real constrains is that you can not have z min limit switch and z probe. limit switch limits moves so for z min it MUST be at lowest position. Since you assume bed is rotated which is why you have a z probe at all, means you would drive extruder in the bed for all positions except the lowest (which you not know of where it is). A mobile z probe doe snot have the problem as it measures surface distance. Also z max has no such problems, also you need to go back down after z max homing  a bit so firmware can compensate z also at z max without hitting z endstop which would cause an error in height.
  • Your slicer is probably adding a G28 in the start gcode this will home all axes at the start of each print
  • Thanks, both. Yes, Martin, it did add a G28 - removed now.

    Repetier, could I explore this a little further please?

    What I meant was - once it has homed to Z-max, and then done the G32 to determine tilt, why could it not Z-probe in one known spot (perhaps one of the spots use to determine tilt) to give the final height above the bed to use to position for printing? It could do this quickly at the beginning of each print?

    I'd also like to enable the Z-min as a safety stop. In my case:
    1. the Z-probe triggers with the nozzle 2.5mm above the bed
    2. I manually correct the bed to perhaps 0.1 or 0.2 mm and want to use the auto level feature to manage the final small variations
    3. my bed has some give as it is mounted on springs

    Therefore, if I set the Z-min to about 0.5mm below the bed, this would prevent any issues that could occur if the Z-probe malfunctions or similar as the springs would absorb the excess and the Z-carriage would stop before any damage occurs. I can't see any way to do this at present.


  • You can have z min as safety below bed level as long as you home to z max. As long as you make sure that it is lower then every point so it never triggers early stopping a move.

    Your "fast" G32 is homing. G32 is autoleveling. That is a different operation. As I already said, if z min is z probe pin you can home to z min using the z probe. That would be exactly what you said. You just have to make sure that you go up befor ehoming to untrigger, to home xy before and then go to position where activating z probe is possible. Any of the home XYT homign orders offer the matiching settings for this, just set temperature to 0 to not change heating.
  • Thanks, Repetier, and apologies for the 'stupid' questions! This is way out of my comfort zone! 

    Your response makes perfect sense but as a safeguard I added a G1 X100 Y100 command to the probe start script to ensure that the Z-probe starts off over the bed. This may not be necessary but I'm a 'belt and braces' kind of guy!

    Thanks again for your help - it is much appreciated!


  • I have run into a problem that I can't figure out with the Z-probing.

    Using the Z-max endstop, I set Z-height (189.827mm), then set the Z-probe Height (2.4mm) and executed a G32 Z2. did this but about 3mm higher than the bed and the probe did not trigger yet it returned readings for the bed height.

    I'm stumped - what is happening, please?


  • G32 S2 not Z2 please.

    What exactly id it do when it did not trigger? No moves at all? Please give more details if you need help. Log output is always helpfull and used firmware version.

  • Yes, sorry, Z2 was a typo.

    It did exactly as it would when the Z-probe triggers except that the LED did not light thus indicating that it did not go close enough to the bed to detect it.

    This log extract follows a G32 S2 command.

    12:36:01.070 : X:100.00 Y:100.00 Z:189.100 E:0.0000
    12:36:05.055 : X:-5.50 Y:100.00 Z:189.100 E:0.0000
    12:36:05.071 : Info:Autoleveling disabled
    12:36:36.010 : Z-probe:4.44 X:6.00 Y:5.00
    12:36:38.073 : Z-probe:4.37 X:6.00 Y:69.32
    12:36:40.120 : Z-probe:4.33 X:6.00 Y:133.66
    12:36:42.175 : Z-probe:4.48 X:6.00 Y:198.00
    12:36:44.941 : Z-probe:4.44 X:69.00 Y:5.00
    12:36:46.986 : Z-probe:4.28 X:69.00 Y:69.32
    12:36:49.018 : Z-probe:4.37 X:69.00 Y:133.66
    12:36:51.080 : Z-probe:4.41 X:69.00 Y:198.00
    12:36:53.851 : Z-probe:4.52 X:132.00 Y:5.00
    12:36:55.930 : Z-probe:4.38 X:132.00 Y:69.32
    12:36:58.006 : Z-probe:4.49 X:132.00 Y:133.66
    12:37:00.116 : Z-probe:4.51 X:132.00 Y:198.00
    12:37:02.941 : Z-probe:4.67 X:195.00 Y:5.00
    12:37:05.103 : Z-probe:4.62 X:195.00 Y:69.32
    12:37:07.229 : Z-probe:4.59 X:195.00 Y:133.66
    12:37:09.401 : Z-probe:4.69 X:195.00 Y:198.00
    12:37:09.869 : plane: a = 0.0013 b = 0.0001 c = 4.3368
    12:37:09.885 : Transformation matrix: 0.999999 0.000000 -0.001281 -0.000000 1.000000 -0.000076 0.001281 0.000076 0.999999
    12:37:09.885 : CurrentZ:4.60 atZ:5.00
    12:37:09.885 : Z after rotation:5.00
    12:37:09.885 : Printer height:188.70
    12:37:10.041 : Info:Autoleveling enabled
    12:37:11.041 : X:194.99 Y:198.00 Z:4.865 E:0.0000

    At no time did the LED on the Z-probe detection board trigger. 

    Immediately prior to this command, I had enabled the Auto-level function in the EEPROM, but made no other changes. 

    Before this it had been printing successfully in a manual mode, with auto-level turned off but everything else exactly the same.


  • This looks fine to me. Consider that the led is only on very short as it retracts immediately when triggered. Since all values seem to make sense I would bet on this rather then crosstalk making a signal and getting such a good z pattern.
  • I'm embarrassed to say that I think you were correct on this - the sunlight was strong and must have been hiding the flashes! 

    It seems to be working fine now, thanks.

  • No unfortunately it is something else. The probe is not triggering and something else is causing this. 

    I thought the auto levelling was working OK but the Z0 position was varying with no reason. One print would be fine but the next would be up to 0.5mm out - either too high or too low. G32 S2 was - and is - completing normally except that the LED on the Z-probe does not flash. I proved this by holding a sheet of paper above the bed and under the Z-probe while it was doing a Z-probe - the flash was very noticeable and there is no way I could miss it.

    The printer is a steel i3 clone. It is very stiff had been printing just fine until I did this auto-level upgrade. I use 3-point bed mounting and the levelling was good so I really don't think it is a mechanical problem.

    The Z-probe sensor is one of David Crocker's excellent little optical boards, the endstops are all mechanical and I have Z-max, Z-min, X-min, Y-max and y-min fitted. Z-min is mechanically adjustable and has about 15mm clearance at Z0. I have LEDs on all endstops so I can see when they close. The Z-probe has an LED that has a very bright flash. M119 shows that the probe is working. 

    What could be causing this? Is it something I'm doing wrong?

    To set it up, I:
    1. Set the Z-height in EEPROM about 5mm over the mechanical amount (set to 195mm). I also set this 195mm in Repetier host (Home Z and Print area height)
    2. home the Z-axis, Repetier Host shows the Z position as 195mm
    3. Issue G1 Z10 to bring the head down then slowly lower the nozzle using the Repetier Host control panel until it just contacts a sheet of paper on the bed. It now shows Z-position as 6.85 and M114 confirms this.
    4. The travel is therefore 188.15mm (195 - 6.85mm) so I set this into firmware and the two Host settings as in 1. above
    5. I home the Z-axis again and the console shows 188.15 as the height (M114 confirms this)
    6. Issue G32 S2 - it does what you'd expect except that the Z-probe is not triggering. See log below. 
    20:46:02.790 : X:99.99 Y:100.00 Z:188.150 E:0.0000
    20:46:16.415 : Info:Autoleveling disabled
    20:46:44.786 : Z-probe:5.74 X:6.00 Y:5.00
    20:46:47.030 : Z-probe:5.65 X:6.00 Y:69.32
    20:46:49.242 : Z-probe:5.67 X:6.00 Y:133.66
    20:46:51.455 : Z-probe:5.60 X:6.00 Y:198.00
    20:46:54.377 : Z-probe:5.74 X:69.00 Y:5.00
    20:46:56.620 : Z-probe:5.63 X:69.00 Y:69.32
    20:46:58.840 : Z-probe:5.65 X:69.00 Y:133.66
    20:47:01.061 : Z-probe:5.68 X:69.00 Y:198.00
    20:47:03.993 : Z-probe:5.72 X:132.00 Y:5.00
    20:47:06.233 : Z-probe:5.69 X:132.00 Y:69.32
    20:47:08.493 : Z-probe:5.80 X:132.00 Y:133.66
    20:47:10.751 : Z-probe:5.73 X:132.00 Y:198.00
    20:47:13.701 : Z-probe:5.75 X:195.00 Y:5.00
    20:47:15.960 : Z-probe:5.72 X:195.00 Y:69.32
    20:47:18.223 : Z-probe:5.80 X:195.00 Y:133.66
    20:47:20.521 : Z-probe:5.93 X:195.00 Y:198.00
    20:47:21.135 : plane: a = 0.0008 b = 0.0001 c = 5.6337
    20:47:21.143 : Transformation matrix: 1.000000 0.000000 -0.000759 -0.000000 1.000000 -0.000083 0.000759 0.000083 1.000000
    20:47:21.143 : CurrentZ:5.80 atZ:5.50
    20:47:21.143 : Z after rotation:5.50
    20:47:21.147 : Printer height:188.45
    20:47:21.311 : Info:Autoleveling enabled
    20:47:22.296 : X:195.00 Y:198.00 Z:5.961 E:0.0000
    This is where something weird happens - console shows the height as 188.15, but M114 shows 5.961mm - shouldn't these be the same?
    7. In the EEPROM the Z-height has changed to 188.446 but it is still 188.15 in the two places in Repetier Host settings.
    8. Starting a print with initial layer thickness of 0.2mm starts printing at an indicated 0.2mm but the nozzle is far too high to print successfully (I estimate that it is 0.4 or 0.5mm above the bed) If I pause the print but keep the Z-height I can get 6 sheets of paper under the nozzle but the height indicator on the console still shows 0.2mm and M114 shows the same.

    I attach my EEPROM export (as a txt file)

    What am I doing wrong, please? I'm stumped. I also wonder if it is perhaps a mismatch between the settings in firmware and Repetier Host?

  • 1. Host does not read positions from firmware output. Also firmware is always right host might have already send commands making the position wrong, so we can not safely copy them. If you do a G1 Z100 you always have both in sync as you made a absolute move and not relative moves.
    2. Your z probe height is wrong. Increase z probe height by 0.4mm and it should be better.
    3. I guess it disables led too fast to see. YOu can not test manually a flash as fast as probing does. The pattern is just too regular to be an error.
    4. This is the IR based sensor, right? Results can change a bit if optical characteristics of bed change.

  • Thanks for your response. The weird thing is that the Z-probe was triggering when the nozzle was about 5 - 6mm above the bed, the range of the sensor (yes, it is an IR sensor), is about 1.5 - 2.5mm so maximum range is only a few tenths of a millimeter below the nozzle. I also lowered the Z-probe 1mm and it made no difference.

    As you said, the 'bogus' Z-probe readings returned are too good for this to be noise so I tested the sensor out of the printer and it was working fine. A lot of diagnosis eventually led me to the problem - the pull-up resistor on that input wasn't enough and this caused the sensor to act in an analogue, not digital mode. Adding a 10k pull-up resistor seems to have sorted the problem!

    Thanks for your help.


  • Good to know. We do in deed need a digital signal so analog modus is a bit unpredictable here.
Sign In or Register to comment.