Setting up Z probe

  • Hi,

    I am trying to set up a Z probe using a single FSR, in a device directly under the nozzle, and JohnSL's FSR board. I am a little confused by the G31 line in the config.g ; G31 X0 Y0 Z4.80 P500 ; Set the zprobe height and threshold (put your own values here) What do the zprobe height and threshold values refer to?

    At the moment the software is not recognising the probe and fails to register when it hits the bed. However, when the probe is triggered manually the LEDs on JohnSL's board and the Duet, wired to E0 end stop, light up. On the Machine Properties page Endstop Hit is reading as 'yes' and switches to 'no' when the FSR is pressed. I am presuming this should be reversed but how do I do it?

    Thanks, Mike

  • administrators

    To reverse the sense, add parameter I1 to your M558 command in config.g.

    The Z parameter in the G31 command is the nozzle height in mm when the probe is triggered. For FSRs and other types of contact probe it will be slightly negative, for example Z-0.1. The P parameter can be used to control debouncing, but as you shouldn't need any debouncing with the JohnSL board, I suggest you use P100 to get a fast response.

  • Hi dc42,

    What is the character in front of the number one, in your reply?

    My current M558 reads: M558 P4 X0 Y0 Z-11.82 where the Z number is the offset from the tip of the probe to the nozzle. Do I just add to the end of the line?

  • Really hitting a brick wall with this one.

    I ended up inverting the signal on the FSR board.

    On starting the auto calibration routine my machine homes, as it should, then the end effector rushes down and hits the bed at full throttle. From there the head goes through the calibration routine but produces errors at each point. The error message is: Error: Z probe already triggered at start of probing move
    Compensation or calibration cancelled due to probing errors
    It's difficult to see but the probe does not seem to raise from the bed between points. Surely it should lift a few mm before moving to the next point?

    At rest, after homing, the probe seems to respond correctly and it goes from zero, in the machine status panel, to 1000 when pressed.

    For the record my printer is an Openbeam Kossel Pro. When upgrading to the Duet WiFi I transferred all the relevant data into config.g i.e. delta radius, rod length etc.

  • administrators

    I misread your original post, i thought you were using under the bed FSRs. You need to use a positive Z parameter in the G31 command for the probe you described because the tip of the nozzle is above the bed when the probe triggers.

    The character before number 1 in the M558 command was letter I for Invert.

  • Okay, thanks for the reply. Is and 1s are easy misread with some fonts but it looked like a special character. I was brought up believing an upper case i should have bars top and bottom!!! Showing my age probably.

    So, because the probe is above the bed, probe heights are positive. I will report back - thanks.

  • Still no joy. Same error message saying Z probe already triggered at start of probing move.

    Here is a copy of my config.g
    ; Configuration file for OpenBeam Kossel Pro kit from OpenBeam USA

    ; Communication and general
    M111 S0 ; Debug off
    M550 Mike's Kossel Pro ; Machine name and Netbios name (can be anything you like)
    M551 Preprap ; Machine password (used for FTP)
    ;*** If you have more than one Duet on your network, they must all have different MAC addresses, so change the last digits
    M540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xED ; MAC Address
    ;*** Wifi Networking
    M552 S1 ; Enable WiFi

    M555 P2 ; Set output to look like Marlin
    M575 P1 B57600 S1 ; Comms parameters for PanelDue

    G21 ; Work in millimetres
    G90 ; Send absolute coordinates…
    M83 ; ...but relative extruder moves

    ; Axis and motor configuration
    M569 P0 S1 ; Drive 0 goes forwards
    M569 P1 S1 ; Drive 1 goes forwards
    M569 P2 S1 ; Drive 2 goes forwards
    M569 P3 S1 ; Drive 3 goes forwards
    M569 P4 S1 ; Drive 4 goes forwards
    M574 X2 Y2 Z2 S1 ; set endstop configuration (all endstops at high end, active high)
    ;*** The homed height is deliberately set too high in the following - you will adjust it during calibration
    M665 R149.1 L303.15 B110 H245 ; set delta radius, diagonal rod length, printable radius and homed height
    M666 X-0.33 Y-0.58 Z-0.27 ; put your endstop adjustments here, or let auto calibration find them
    M350 X32 Y32 Z32 E32 I1 ; Set 32x microstepping with interpolation
    M92 X160 Y160 Z160 ; Set axis steps/mm
    M906 X1000 Y1000 Z1000 E800 I60 ; Set motor currents (mA) and increase idle current to 60%
    M201 X9000 Y9000 Z9000 E4000 ; Accelerations (mm/s^2)
    M203 X10000 Y10000 Z10000 E3600 ; Maximum speeds (mm/min)
    M566 X1200 Y1200 Z1200 E1200 ; Maximum instant speed changes mm/minute

    ; Thermistors
    M305 P0 T100000 B3950 R4700 H30 L0 ; Put your own H and/or L values here to set the bed thermistor ADC correction
    M305 P1 T100000 B3974 R4700 H30 L0 ; Put your own H and/or L values here to set the first nozzle thermistor ADC correction
    M305 P2 T100000 B3974 R4700 H30 L0 ; Put your own H and/or L values here to set the second nozzle thermistor ADC correction
    M570 S180 ; Hot end may be a little slow to heat up so allow it 180 seconds

    ; Fans
    M106 P1 H-1 ; disable thermostatic mode for fan 1

    ; Tool definitions
    M563 P0 D0 H1 ; Define tool 0
    G10 P0 S0 R0 ; Set tool 0 operating and standby temperatures
    ;*** If you have a single-nozzle build, comment the next 2 lines
    ;M563 P1 D1 H2 ; Define tool 1
    ;G10 P1 S0 R0 ; Set tool 1 operating and standby temperatures
    M92 E943.57 ; Set extruder steps per mm

    ; Z probe and compensation definition
    ;*** If you have a switch instead of an IR probe, change P1 to P4 in the following M558 command
    M558 P4 X0 Y0 ;Z-11.82 ; Z probe is an IR probe and is not used for homing any axes
    G31 X0 Y0 Z0.10 P100 ; Set the zprobe height and threshold (put your own values here)

    ;*** If you are using axis compensation, put the figures in the following command
    M556 S78 X0 Y0 Z0 ; Axis compensation here

    M208 S1 Z-0.2 ; set minimum Z
    T0 ; select first hot end

  • administrators

    How high is the nozzle tip above the bed when the probe triggers? That is the value you need in your G31 Z parameter.

  • Solved the problem. The 0.1 value in G31 was too low. I raised it to 10 and calibration worked faultlessly and very quickly.

    Thank you so much for your replies - you must spend an awful lot of time answering these questions and it is really appreciated. This must be one of the best forums for speed of reply.

  • So, if I am getting this right, the value of Z in G31 is equal to the offset between the nozzle and the point of the probe.

  • administrators

    Yes, it's the height of the tip of the nozzle above the bed when the probe triggers.

  • I have run the calibration routine a number of times, just to check everything is working okay, but it does raise a question of whether any changes are made to the config.g. I cannot see any change in the delta radius, rod length, printable radius or homed height in the M665 in config.g

    Does this mean I have to run the calibration every time I print? If so, I will find this very tedious as I need to fit the probe before calibration and then remove it after.

    How can I see any changes that are made so I can place them into config.g?

  • administrators

    The parameters found by auto calibration are not saved to config.g but they remain in effect until you restart the Duet. If you run M500 after auto calibration then the new parameters are saved to config-override.g. You should normally have a M501 command near the end of your config.g file to invoke config-override.g.

    After initial calibration I suggest you run M665 and M666 with no parameters to see what the new values are, and manually put them into your M665 and M666 commands in config.g.

  • Thank you - extremely helpful. Getting to grips with the Duet and all the masses of information available is quite daunting but, already I am astounded at the improvement over the original BrainWave. Thanks for all your efforts, much appreciated.

  • I don't seem to have a config-override.g and M500 and M501 do nothing. Do I have to create config-override.g somehow?

    Putting the M665 and M666 values in manually was a doddle - thanks.

  • administrators

    When you send M500 config-override.g should be created and various lines automatically added to it.

  • administrators

    The recommended procedure is here:
    Although as you have a manually fitted probe I would not run auto calibration before each print

  • administrators


    I don't seem to have a config-override.g and M500 and M501 do nothing. Do I have to create config-override.g somehow?

    Which firmware version are you running?

  • I am running 1.17e. I found I had to power cycle the board before config-override would show up. All done now and the printer is running fine. However, I just tried to save the heightmap, out of interest, and it saved okay but using M375 to view the file I got the message: M375
    Error: Failed to load height map from file heightmap.csv: invalid grid

    Not hugely important but I would like to have seen the grid.

  • administrators

    There was a bug in 1.17 that prevented the height map being loaded if lines in it exceeded a certain length. It was to fixed in 1.18.

  • I eventually managed to load version 1.18 but I am still getting the; Error: Failed to load height map from file heightmap.csv: invalid grid error message. I have power cycled the printer quite a few times and web page reports the correct versions of firmware. What else can I try to see the heightmap? The heightmap.csv file cannot be read from the SD card when it is placed in the PC either.

  • administrators


    The heightmap.csv file cannot be read from the SD card when it is placed in the PC either.

    That is why its not reading in the web interface. Maybe a new G29 to generate a new file to see if that sorts it.

  • I am doing a G32 S2 which should save the heightmap to a csv file. After doing the routine and issuing an M374 the file is saved and I get a report that the file has been saved. It is when I try to read it with an M375 that I get the Error: Failed to load height map from file heightmap.csv: invalid grid

    I have tried it many times since updating the firmware with the same result. I have verified that the heightmap.csv is on the SD card. Incidentally, a csv file should be able to be read from the PC and loaded into a spreadsheet but the PC cannot open the file either.

  • administrators

    G32 uses bed.g for bed levelling - the height map is produced by G29


  • Okay, thanks for that. So where does G32 store the result?

Log in to reply