BLTouch + Duet Wifi



  • So I've gone through and read (i think) most of whats been posted in regards to setting up a BLTouch on a Duet Wifi but with everyone seeming to have a different setup or strategy it gets a bit confusing. The wiki seems to cover all of the info needed but its a bit difficult with it being spread through various pages. My end goal is to setup a Cartesian printer with a Zmin end stop for standard homing and with a BLTouch for mesh bed leveling. Initially I'm thinking of having the mesh leveling occur only at the start of a print, though this might get annoying and it might be easier to just run a mesh leveling on command when needed.

    I've spelled out my understanding of what each command is needed for and what the parameters are helping to define/specify to confirm my understanding but also to maybe help others trying to set up a BLTouch…if my understanding is actually right.

    My understanding of what all needs to happen in the configuration files and gcode files is:

    ======config.g file======
    =needs added:=
    [c]M307 H3 A-1 C-1 D-1[/c] {to free up heater 3 control pin for use as general I/O pin} where H3 indicates heater 3 (location that BLT servo control is plugged in)
    [c]M558 P5 X0 Y0 Z0 H5 F200 T5000[/c] {to define the probe parameters/usage} where P5 specifies the output of the BLT is plugged into the Z probe connection (P4 would specify the output is plugged into the E0 endstop pins), X0 Y0 Z0 defines that the BLT isnt used for any actual homing (X0 Y0 Z1 would define using BLT for homing Z axis), H5 defines the height of the printer head at the start of each dive/probe, F200 defines a Z speed of 200 mm/min, T5000 defines X and Y speeds of 5000 mm/min
    [c]G31 P25 X-18 Y0 Z2[/c] {to define the trigger and positioning of the BLT} where P25 is the sensitivity of the trigger detection (or the pulse duration duet will consider a trigger?), X-18 Y0 is the offset of the probe from the nozzle tip, Z2 is the vertical offset of the BLT's trigger point to the nozzle tip
    [c]M557 X50:550 Y50:550 S100[/c] {to establish the parameters of the G29 mesh bed probing procedure} where the X and Y parameters defines the extremes of the probing grid and S defines the spacing of the grid points

    ======deployprobe.g======
    =only contains:=
    [c]M280 P3 S10 I1 [/c] where P3 is identifying the pin for heater 3 (pin 8 - wifi, pin 21 - duet 0.8.5), S10 indicates to deploy pin

    ======retractprobe.g======
    =only contains:=
    [c]M280 P3 S90 I1[/c] where P3 is identifying the pin for heater 3 (pin 8 - wifi, pin 21 - duet 0.8.5), S90 indicates to retract pin

    ======bed.g====== isnt needed since I'm not trying to perform a G32

    ======homez.g====== can remain the same since I'm still using my Z min end stop for Z homing

    ======[starting script in Simplify3D]======
    =needs added (after G28):=
    [c]G29[/c]

    additionally it seems helpful to add the following macro
    ======resetprobeerror.gcode======
    [c]M280 P3 S160 I1[/c] where P3 is identifying the pin for heater 3 (pin 8 - wifi, pin 21 - duet 0.8.5), S160 indicates to reset error state

    What errors/issues do i have in this breakdown or is it fairly safe to say that if I add/edit the above to my duet wifi I should have an operable BLTouch?
    Does using the Z min end stop for Z homing and then using the BLT for mesh leveling cause any weirdness as far as operation or offsets? I was intending to use the end stop just because I'm confident that it keeps the nozzle from crashing into the bed. I may convert over to just the BLT as my confidence builds in the setup.



  • here's my one question for you, and this is the main reason most of us home with the bltouch or other probing solutions in the center of the bed.

    What will happen to your Z endstop when a location of a point on the bed is lower than the location of your Z endstop?

    As far as the setup of the settings goes I would say you have it pretty well worked out.

    free up the heater pin, asign, the heater pin for the probe, set the x/y/z offsets, set the probing dimensions(be sure that your probing dimensions compensate for the offset usually by >10 just to make sure that it will probe inside a reachable boundary), setup macro's for retract(90), deploy(10), reset(160), and self test(120)

    The big thing after this is setting it all up and testing the fool out of it hooked up to make sure that you have signal fromt eh bltouch when it is in an error state(it defaults to showing triggered when in error state) and run it though its paces before you ever tell the machine to depend on it, while homing, probing etc



  • I agree with Sniffle, using the bl touch for homing is great and if your bl touch works (just test deploy and retract) then there isnt really much of a reason to use a endstop over the probe for homing.

    Also you can use m400 and m401 (double check) to retract and deploy the probe.

    Last thing I am not sure if most people do it differently, but I use my bed.g file and I fill it with my mesh leveling code, well it homes first in the center and then does the mesh leveling. I can copy it if you want



  • @ThePigSlayer:

    I agree with Sniffle, using the bl touch for homing is great and if your bl touch works (just test deploy and retract) then there isnt really much of a reason to use a endstop over the probe for homing.

    Also you can use m400 and m401 (double check) to retract and deploy the probe.

    Last thing I am not sure if most people do it differently, but I use my bed.g file and I fill it with my mesh leveling code, well it homes first in the center and then does the mesh leveling. I can copy it if you want

    Please do. I would like to see it.



  • Thanks for the additional info! I understand what you are saying as far as using both an end stop and BLT and I'm thinking I may just go ahead and spend the extra time really testing it out so that I can confidently disable the end stop.
    @ThePigSlayer:

    I agree with Sniffle, using the bl touch for homing is great and if your bl touch works (just test deploy and retract) then there isnt really much of a reason to use a endstop over the probe for homing.

    Also you can use m400 and m401 (double check) to retract and deploy the probe.

    Last thing I am not sure if most people do it differently, but I use my bed.g file and I fill it with my mesh leveling code, well it homes first in the center and then does the mesh leveling. I can copy it if you want

    I agree, I think that your bed.g would be really helpful.

    Your mentioning of m400 and m401 (looking at the Gcode page, it looks like its [c]M402[/c] and [c]M401[/c], respectively) for retract and deploy made me realize that in the lines I had above I failed to actually retract or deploy the probe since i wasn't calling the deployprobe.g or retractprobe.g macros anywhere. So I'm guessing you have something along the lines of:

    [[language]]
    M402
    G29
    M401
    
    ```somewhere within your bed.g and then rather than your starting script containing [c]G29[/c] it would contain [c]G32[/c] which calls bed.g?
    
    @Sniffle:
    
    > …setup macro's for retract(90), deploy(10), reset(160), and self test(120)...
    
    I'm assuming there isn't an Mxxx command similar to M401 and M402 for reset and self test and that the simplest way of running these would be to activate them from the macro buttons on the interface?
    
    Do you need to call the reset and self test in bed.g or somewhere similar or are these dominantly used for testing/troubleshooting?


  • I have them setup in custom macros on the web interface, so that If i need them they are they are easily accessed without the need to type gcodes.



  • Thanks for the correction hendricks.

    You can setup macros but you will also need to edit the retract and deploy system files as those are what m402 and m401 call.

    Anyways, here is my bed.g file, which I call by just clicking the auto bed compensation button, or G32.

    M557 X50:150 Y50:150 S25    ; Define grid
    
    T0                          ; Select tool 0
    G91 			    ; Relative mode   
    G1 Z10 F150		    ; Make sure everything clears the bed                     
    
    ; ------------ Home Z ---------------------
    
    G90                         ; Absolute mode
    G1 X110.5 Y72 Z6 F4000      ; Home at center of bed, my offsets are X-10.5 and Y28
    M401                        ; Deploy probe
    G30                         ; Home Z-axis
    
    ;----------- Mesh Level ------------------
    
    G29                         ; Start mesh level
    M374                        ; Save results, but this might not be necessary 
    M402                        ; Retract probe 
    
    G1 X20 Y20 Z10 F3000        ; Dock position
    
    


  • I am settting up my bl touch now. appears to be wired and working correctly i jest can't seem to find where to enter the off set for the probe vs print head. Can someone please refresh my memory?



  • Thank you sir! just what i was looking for! stand by… 🙂



  • this is a cartesian. FT5 bl touch classic Here are my config files. I had the bl touch for months and started setting it up but was an even more of a newbie then then i am now. been doing manual level and printing fine for months. I found and copied a lot of above for the other files in this thread (thanks much to all above!!!) but i think cut and paste is not the best way to go about it. Everything appears to work and i can power up and home fine but when i try to bed level via auto compensation button or macro, probe deploys then print head shoots to front right corner of machine and bl touch is solid red so no apparent error. I know something is not right but no idea what. offset on x is 22 mm and doc indicates max is 15mm so not sure if that is a hard limit. probably just a mismatch from configs above… Any help in cleaning up my config would be much appreciated!

    "Config G"

    ; BLTouch
    M307 H3 A-1 C-1 D-1
    M558 P5 X-22 Y-9 Z4 H3 F200 T5000

    "Deployprobe.g"
    M280 P3 S10 I1 ;deploy probe might need to try no I1

    "Retractprobe.g"
    M280 P3 S90 I1 ; retract probe might need to try no I1

    "bed.g"
    ; called to perform automatic bed compensation via G32

    ; Clear any bed transform
    M561

    ;# Deployprobe.g
    M280 P3 S10 I1
    ; Probe the bed at 5 points
    G30 P0 X50 Y50 H0 Z-99999
    G30 P1 X50 Y250 H0 Z-99999
    G30 P2 X250 Y250 H0 Z-99999
    G30 P3 X250 Y50 H0 Z-99999
    G30 P4 X150 Y150 H0 Z-99999 S
    ;#Retractprobe.g
    M280 P3 S90 I1

    meshlevel.g
    ; called when tool 0 is freed
    ;
    meshlevel.g
    T0 ; Select first hot end
    G91 ; Relative coordinates - for dropping Z no matter what its current height
    G1 Z4 F6000 ; Lower bed to avoid hotend dragging in bed.

    G28 Y ; Home Y axis first to avoid crash
    G28 X ; Home X

    G90 ; Absolute coordinates
    G1 X50 Y50 F3000 ; Go to first bed probe point and home the Z axis

    G28 Z ; Home Z given we are in a known safe on-bed position

    M557 X10:250 Y10:250 S40 ; Bed probe from X50 to 220 and Y50 to 220 in 40mm increments

    M401 ; Lower BLTouch probe-refrences deployprobe.g
    G29 S2 ; Clears bed height map in RepRapFirmware
    G29 ; Kicks off the Z probing across the height map
    M402 ; Retract BLTouch probe refrences probretract.g

    M374 ; Save calibration data. Default is sys/heightmap.csv

    G1 X10 Y10 F3000 ; All done - move to BACK right

    ;Still playing with mesh stuff. Also note that for some reason sending simple probe code g29 or g30 will result in a crash into hotend.
    ;Using those codes does not include deploying probe M401.
    ;So I just made a macro for meshprobing so I can do it from the machine with out web service.

    Meshlevel macro
    T0 ; Select first hot end
    G91 ; Relative coordinates - for dropping Z no matter what its current height
    G1 Z4 F6000 ; Lower bed to avoid hotend dragging in bed.

    G28 Y ; Home Y axis first to avoid crash
    G28 X ; Home X

    G90 ; Absolute coordinates
    G1 X10 Y10 F3000 ; Go to first bed probe point and home the Z axis

    G28 Z ; Home Z given we are in a known safe on-bed position

    M557 X10:220 Y10:250 S40 ; Bed probe from X10 to 220 and Y10 to 185 in 40mm increments

    M401 ; Lower BLTouch probe-refrences deployprobe.g
    G29 S2 ; Clears bed height map in RepRapFirmware
    G29 ; Kicks off the Z probing across the height map
    M402 ; Retract BLTouch probe refrences proberetract.g

    M374 ; Save calibration data. Default is sys/heightmap.csv

    G1 X10 Y10 F3000 ; All done - move to BACK right



  • update. did some testing and these 3 commands appear to work fine so assumeing config files are fubar
    M280 P3 S20 I1; test mode

    M280 P3 S10 I1 ;deploys probe

    M280 P3 S90 I1 ; retracts probe



  • I'm still not 100% on the calibration because I don't have a conclusive idea of the config information.

    If we're all using a BLTouch with the DuetWiFi, every bit of information should be the same except the bed size and carriage height parameters.

    Currently, my Auto Home process checks X and Y, then when the probe touches the bed it sets off the Alarm and rams the bed indefinitely.

    –------------
    ; General preferences
    M111 S0 ; Debugging off
    G21 ; Work in millimetres
    G90 ; Send absolute coordinates...
    M83 ; ...but relative extruder moves
    M555 P2 ; Set firmware compatibility to look like Marlin
    M208 X0 Y0 Z0 S1 ; Set axis minima
    M208 X340 Y250 Z280 S0 ; Set axis maxima

    ; Endstops
    M574 X1 Y1 Z1 S0 ; Define active low and unused microswitches
    M558 P5 X0 Y0 Z1 H5 F200 T6000 ; Set Z probe type to modulated, the axes for which it is used and the probe + travel speeds
    G31 X-40 Y7 Z0.9 P1 ; Set Z probe trigger value, offset and trigger height

    ;Z-offset (Z0.9). Higher value LOWER nozzle height
    ; Lower value RAISE nozzle height

    M557 X10:340 Y10:240 S68 ; Define mesh grid

    M307 H3 A-1 C-1 D-1 ; disable heater 3, which makes it available for use to control the BLTouch

    ; Drives
    M569 P0 S1 ; Drive 0 goes forwards - X
    M569 P1 S0 ; Drive 1 goes backwards - Y
    M569 P2 S0 ; Drive 2 goes backwards - Z
    M569 P3 S1 ; Drive 3 goes forwards - Extruder

    M350 X16 Y16 Z16 E16 I1 ; Configure microstepping with interpolation 16
    M92 X160 Y160 Z1600 E800 ; Set steps per mm 16

    M566 X600 Y420 Z12 E120 ; Set maximum instantaneous speed changes (mm/min) - (JERK)

    M203 X6000 Y6000 Z500 E400 ; Set maximum speeds (mm/min)

    M201 X1000 Y1000 Z1000 E250 ; Set accelerations (mm/s^2)

    M204 P1000 T1000 ; Set Max acceleration for P=printing moves and T=travel moves
    M906 X1600 Y1600 Z900 E1000 I30 ; Set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Heaters
    M143 S285 ; Set maximum heater temperature to 285C
    ;M305 P1 X101

    M305 P1 T107000 B10832 C4.891620e-7 R4700 ; Set thermistor + ADC parameters for heater 0 - BED
    M305 P0 T99600 B4388 C0 R4700 ; Set thermistor + ADC parameters for heater 1 - HOTEND E3d

    M307 H0 P96.0, I3.285, D603.9 ;Bed
    M307 H1 P1.1, I0.011, D51.5 ;Hotend pid

    ;M307 H1 P17.8, I0.055, D74.9 ;Hotend E3d pid

    ; Tools
    M563 P0 D0 H1 ; Define tool 0
    G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
    G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C

    ; Network
    M550 CLU ; Set machine name
    M552 P0.0.0.0 S1 ; Enable network and acquire dynamic address via DHCP

    ; Fans
    M106 P0 S0.3 I0 F500 H-1 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off
    M106 P1 S1 I0 F500 H1 T45 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on
    M106 P2 S1 I0 F500 H1 T45 ; Set fan 2 value, PWM signal inversion and frequency. Thermostatic control is turned on

    ; Custom settings are not configured



  • @AaronGreen:

    I'm still not 100% on the calibration because I don't have a conclusive idea of the config information.

    If we're all using a BLTouch with the DuetWiFi, every bit of information should be the same except the bed size and carriage height parameters.

    Currently, my Auto Home process checks X and Y, then when the probe touches the bed it sets off the Alarm and rams the bed indefinitely.

    –------------
    ; General preferences
    M111 S0 ; Debugging off
    G21 ; Work in millimetres
    G90 ; Send absolute coordinates...
    M83 ; ...but relative extruder moves
    M555 P2 ; Set firmware compatibility to look like Marlin
    M208 X0 Y0 Z0 S1 ; Set axis minima
    M208 X340 Y250 Z280 S0 ; Set axis maxima

    ; Endstops
    M574 X1 Y1 Z1 S0 ; Define active low and unused microswitches
    M558 P5 X0 Y0 Z1 H5 F200 T6000 ; Set Z probe type to modulated, the axes for which it is used and the probe + travel speeds
    G31 X-40 Y7 Z0.9 P1 ; Set Z probe trigger value, offset and trigger height

    ;Z-offset (Z0.9). Higher value LOWER nozzle height
    ; Lower value RAISE nozzle height

    M557 X10:340 Y10:240 S68 ; Define mesh grid

    M307 H3 A-1 C-1 D-1 ; disable heater 3, which makes it available for use to control the BLTouch

    ; Drives
    M569 P0 S1 ; Drive 0 goes forwards - X
    M569 P1 S0 ; Drive 1 goes backwards - Y
    M569 P2 S0 ; Drive 2 goes backwards - Z
    M569 P3 S1 ; Drive 3 goes forwards - Extruder

    M350 X16 Y16 Z16 E16 I1 ; Configure microstepping with interpolation 16
    M92 X160 Y160 Z1600 E800 ; Set steps per mm 16

    M566 X600 Y420 Z12 E120 ; Set maximum instantaneous speed changes (mm/min) - (JERK)

    M203 X6000 Y6000 Z500 E400 ; Set maximum speeds (mm/min)

    M201 X1000 Y1000 Z1000 E250 ; Set accelerations (mm/s^2)

    M204 P1000 T1000 ; Set Max acceleration for P=printing moves and T=travel moves
    M906 X1600 Y1600 Z900 E1000 I30 ; Set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Heaters
    M143 S285 ; Set maximum heater temperature to 285C
    ;M305 P1 X101

    M305 P1 T107000 B10832 C4.891620e-7 R4700 ; Set thermistor + ADC parameters for heater 0 - BED
    M305 P0 T99600 B4388 C0 R4700 ; Set thermistor + ADC parameters for heater 1 - HOTEND E3d

    M307 H0 P96.0, I3.285, D603.9 ;Bed
    M307 H1 P1.1, I0.011, D51.5 ;Hotend pid

    ;M307 H1 P17.8, I0.055, D74.9 ;Hotend E3d pid

    ; Tools
    M563 P0 D0 H1 ; Define tool 0
    G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
    G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C

    ; Network
    M550 CLU ; Set machine name
    M552 P0.0.0.0 S1 ; Enable network and acquire dynamic address via DHCP

    ; Fans
    M106 P0 S0.3 I0 F500 H-1 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off
    M106 P1 S1 I0 F500 H1 T45 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on
    M106 P2 S1 I0 F500 H1 T45 ; Set fan 2 value, PWM signal inversion and frequency. Thermostatic control is turned on

    ; Custom settings are not configured

    this does not show your homeall.g and homez.g, those files are what control your homing process, and most likely the procedure needs to be changed from the G1 command to lower indefinately to G30 which will amke it stop



  • @Sniffle:

    this does not show your homeall.g and homez.g, those files are what control your homing process, and most likely the procedure needs to be changed from the G1 command to lower indefinitely to G30 which will make it stop

    This is what I have…

    FYI. My set up also uses the Z probe connection for Z GND and IN. The rest are on Expansion Pin 1, 2 and 8 respectively.

    I'm just on a 3D printer fixation at the moment because I've pushed back a major port folio gig for a props company I need to do a presentation for.


    ; homeall.g

    G91

    ; Lift Z
    G1 Z5 F6000

    ; Course home X and Y
    G1 X-235 Y-215 F4000 S1

    ; Move away from the endstops
    G1 X5 Y5 F5000

    ; Fine home X and Y
    G1 X-235 Y-215 F250 S1

    ; Absolute positioning
    G90

    ; Go to first bed probe point and home Z
    T0 ; select first hot end
    G91 ; Relative coordinates
    G1 Z3 F200 ; Lower bed to avoid hotend dragging in bed.
    G90 ; Absoulte coordinates
    G1 X170 Y125 F3000 ; Go to first bed probe point and home the Z axis
    M401 ; deploy probe
    G30 ;probe
    M402 ;retract probe
    G1 Z2 F200 ; Raise bed to 2mm.


    homez.g

    T0 ; select first hot end
    G91 ; Relative coordinates
    G1 Z5 F200 ; Lower bed to avoid hotend dragging in bed.
    G90 ; Absoulte coordinates
    G1 X170 Y125 F3000 ; Go to first bed probe point and home the Z axis
    M401 ; deploy probe
    G30 ; Calibrate Z-axis
    M402
    G1 Z2 F200 ; Raise bed to 2mm.



  • I also noticed that the Z probe sensor on the console doesn't show any changes when the probe rams the bed, or when the alarm goes on or off, or if the probe is triggered.

    Maybe the signal from the probe isn't reaching the console or something…



  • Found the immediate problem. Rookie mistake. I checked the colouring of the BLT ground wire and it changed from black to blue when it went through the Tevo connector to the board, which meant the Z probe wires were switched.


Locked
 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.