Bl touch Install Success.

  • Fist off I am new to the 3d printing world and even newer to the Duet2 WiFi. I have spent the last week installing the Duet2 WiFi on the Cartesian printer I built and have turned into a Frankenstein. There is very little left that is original of the Folgertech I bought. Anyway I started the install of the BL Touch and found that this was one of the hardest things I have done to date. There were a lot of documents out there but none of them were really clear on all the steps that had to be done to get it working and some had information that was way different than others because of publication date.

    The following is what I ended up doing to get the BL-Touch installed and working very well with my printer. This is all the steps in one place with some of my extra notes included. I am not taking credit for most of this work this is mostly from different web pages here in the Duet WIKI but I am just putting all the steps in one place that I had to go through to get things working. I will say now that the BL-Touch is installed and working it is great.

    For the smart folks out there if you see things I have wrong in the following please let me know or if I did something that I did not need to do please post to why. Like I said I am really new at this and just learning and this was a real pain to get working and until I did everything below it did not work correctly.

    I hope this helps someone get their BL-Touch installed and working.


    Software setup (Duet 2 WiFi/Ethernet)
    Important: In the M280 commands in the following, leave out the I1 parameter if the BLTouch is connected to a servo output on a DueX board.

    1. In your software config.g file input the following G-Code commands to allow the setup to work:
      M307 H3 A-1 C-1 D-1
      M558 P9 H5 F100 T2000
      G31 X0 Y0 Z0 P25 ; (I dropped the P25 because I think the P value is used for Non contact probes and the BL-Touch is a contact Probe)
      • Important: mode 9 is supported in firmware 1.21 and later only. If you are using earlier firmware, replace P9 in the M558 command by P5.
      • In the G31 command the X and Y are the offset of the sensor in relation to the nozzle (so input your own) the number for Z is the trigger height (read on for this). This is the height that is obtained from reading the height the nozzle is from the bed when the sensor pin contacts the bed and retracts, P is the signal threshold.
      • Ensure in your config-override.g file (in the /sys folder of the SD card) does not contain an M307 H3 command that overrides the above configuration.
      • In the M280 commands (see below), you must invert the servo signal using “I1” in the M280 commands if you connect the BLTouch servo input to the expansion header pins, but not if you connect the BLTouch servo input to a Duex.

    2. Create a deployprobe.g file (in the /sys folder of the SD card) it should contain the following single command:
      M280 P3 S10 I1

    3. Create a retractprobe.g file (in the /sys folder of the SD card) it should contain the following single command:
      M280 P3 S90 I1

    Checking the trigger height
    The Z probe trigger height must not vary significantly with XY position. Measure the trigger height of your Z probe at various XY positions and make sure it is consistent. To measure the trigger height

    1. Make sure there is no filament stuck to the nozzle (you may want to do this test with the nozzle hot)
    2. Cancel any existing bed compensation by sending M561
    3. Send M208 S1 Z-3 to temporarily allow Z moves down to Z=-3mm. This is to ensure that you can lower the nozzle all the way to the bed in step 5.
    4. Command the print head to the coordinates you want to probe. To probe the center, send G1 Z1.
    5. Command the print head down in small steps until the nozzle just touches the bed or just grips a sheet of paper. You may need to send M564 S0 to allow movement lower than where the firmware thinks Z=0 is. You may also wish to create a macro to lower the head by e.g. 0.02mm to get greater accuracy (G91 followed by G1 Z-0.02).
    6. Send G92 Z0 to define that height as Z=0
    7. Command the nozzle up 5mm (G1 Z5)
    8. Send G30 S-1 to probe the bed without resetting the Z=0 position
    9. Read off the Z height from the web interface. That is the trigger height.
    10. Repeat the previous two steps a couple of times to make sure you are getting a consistent result
    11. Repeat steps 4-10 for the other XY positions you want to check.

    Once you are satisfied with your trigger height result (should be between 0 and 1mm, depending on your printer), open your config.g file (this can be found in your DuetWebControl), find the G31 command and enter your trigger height as a negative value in the Z parameter (ex. G31 X0 Y0 Z-.43).
    (The value I came up with was .6 as the trigger height. After many test prints and not having good material adhesion to the bed I changed the value to .8)

    Define the mesh size and spacing
    Use the M557 command to define the spacing of the mesh that you want to set up, and either the X and Y limits or (for a delta printer) the probing radius.
    This is changed in the config.g

    M557 X10:190 Y10:190 S20 ; probe from X=10 to 190, Y=10 to 190mm with a mesh spacing of 20mm

    For this I ended up using X30:190 Y15:180 S20 You will have to figure out the best settings based off of the location of your sensor in relation to your print head. Mine is 20mm to the left of the print head so I had to start X at 30 so that I am probing at just the edge of the bed and the 190 was the max it could go because I would run up to the endstop otherwise.

    Probe the bed
    Home the printer if you haven't already, then use the command G29 (or G29 S0) to run the probing sequence. All points in the mesh that are reachable by the probe will be probed. When probing is complete, a message will be returned indicating whether or not it was successful.

    Examine the height map
    If you sent the G29 command from Duet Web Control, it should display the height map automatically. Otherwise you can view the height map in Duet Web Control by right-clicking the arrow next to the Auto Bed Compensation or Auto Delta Calibration button and selecting "Show Mesh Grid Heightmap" from the drop-down menu.
    The height map file is normally called /sys/heightmap.csv but you can specify a different filename in G29, M374 and M375 commands. You can view, edit or download it using the System Editor tab in Duet Web Control.
    (If you have some really funky results from you heat map check into the version of your firmware. Version 2.0 had some issue and could produce some funky heatmaps.)
    Using mesh bed compensation before printing
    • Running G32 to auto calibrate a delta printer will clear the local height map info (but not the copy in heightmap.csv). Therefore, if you wish to use both auto calibration and mesh bed compensation, you must run G32 before you run G29, not after. You can include a G29 command at the end of your bed.g file if you wish.
    • If you don't want to probe the bed every time, you can use command G29 S1 to load the height map from the last time you used G29 to probe the bed.
    • You can use the M376 command to taper off bed compensation over a specified height

  • First after you have the probe installed and working it would be best to use it to home the Z axis. Setup the homeall.g file first then the homez.g file. Keep in mind that you will not be able to home the Z axis until the X and Y axis are homed because the G30 command will not run unless the X and Y axis are homed.

    It was at this point I lowered my Z axis switch so that I only was using my BL-Touch to home with.

    The homeall.g file
    The homeall.g file is used when all axes are to be homed. You could make it by concatenating homex.g, homey.g and homez.g, but some optimizations are possible. For example, you need only raise the head by 4mm once, and you can do simultaneous X and Y homing.
    Note: you must not use a G28 command within homeall.g (or any other homing file). But you can invoke one of your other homing files using the M98 command, for example:
    M98 P"homex.g"
    Here is a sample homeall.g file for a machine with X and Y endstop switches at the low end and using a Z probe for Z homing:

    G91 ; relative mode
    G1 S2 Z4 F200 ; raise head 4mm
    G1 S1 X-240 Y-240 F3000 ; move up to 240mm in the -X and -Y directions until the homing switches are triggered
    G1 S2 X4 Y4 F600; move slowly 6mm in +X and +Y directions
    G1 S1 X-10 Y-10 ; move up to 10mm in the -X and -Y directions until the homing switches are triggered
    G90 ; back to absolute mode
    G1 X100 Y100 F2000 ; put head over the center of the bed, or wherever you want to probe
    G30 ; lower head, stop when probe triggered and set Z to trigger height

    I ended up putting in commands to move the print head back to X and Y home after it homes Z.

    Homez.g File
    Here is a typical homez.g file for homing using a Z probe. Comment out all other lines of code that are in the existing file.

    G91 ; relative mode
    G1 S2 Z4 F200 ; raise head 4mm to ensure it is above the Z probe trigger height
    G90 ; back to absolute mode
    G1 X100 Y100 F2000 ; put head over the centre of the bed, or wherever you want to probe
    G30 ; lower head, stop when probe triggered and set Z to trigger height

    Adjust the X and Y coordinates in the second G1 command according to where you want to probe when Z homing. You need to have set up the Z probe type, trigger height and threshold as described earlier.

    Bed.g file
    I did this because I wanted to make sure that I had a new heat map when I rebooted my printer or if I made changes or if the temp in my room had change or what not. It does not take that much extra time to probe the bed before a print and I feel that it makes sure that it will give the most accurate print.

    G1 Z5                ; Raise the print head 5mm
    M561                ; clear any bed transform
    G1 X100 Y100 F2000 ; put head over the centre of the bed, or wherever you want to probe
    G29                 ; probe the bed and enable compensation  If you are running a second print right after you just printed you can add S1 after and it will    use the existing heatmap

    Gcode Changes
    The last thing you have to do is add G32 into your slicer starting script so that your bed.g gets called and the mesh compensation is used.

    The following web pages are what I based the above information off of I did not write most of this information or take credit for it I am just putting it together in one place.

  • Moderator

    Nice work. It's definitely a process getting a Z probe setup and working, and the BLTouch is one of the most complex. Lots of wire connections, lots of config changes. Glad you were able to get it all pulled together.

    For the sake of completeness if others find this in search in the future there's this document as well for BLTouch troubleshooting.

  • For sure this was a challenge. If it was not for the documentation that was already out there I would never have been able to make it work. I was really just making this post to try and put all of this together in one place to try and help the next person save some searching time. The main reason I built my printer is because I wanted to learn how it worked. I stared with a good one and now the one that I have upgraded and changed a bunch of parts on is really great and I love tinkering on it to make it better.

Log in to reply