BLTouch on Duet Wifi & RepRapFirmware
The time has come to setup BLTouch on my system.
I’m going to use Duet WiFi + Duex5, but I’ll post details about using it without the Duex as well.
Since I do use Duex5 and because of other considerations explained in this blog-post, I’ve decided upon not following the pin selection most often mentioend other places. I do however try to explain my reasoning and how you can use it to customize your own setup.
Please let me know if you have comments or inputs. I do take all comments as a positve thing, also potential corrections to my writings 🙂
When I feel I have everything I need, I’ll boil down on this post and use it as a “how-to” for both duet3d wiki and instructables.com
Index
Physical overview
First a short explanation on how a BLTouch sensor works and what it is: The BLTouch sensor is in the category of Servo sensors, meaning it’s using a mechanical servo mechanism to raise and lower the metal pin to do the testing.
Quote from the maker: ANTCLABS(A&T)
- BLTouch is an auto leveling sensor for 3D Printers based on open-source.
- Simple, Smart, High-precision
- It could work with any kinds of bed materials, such as glasses, woods, metals, and so on.
Probe Connector role
At first the Duet Wifi and RepRapFirmware didn’t support servos, but focused on other sensor types like their own IR-sensor.
It means the description on the WiKi can be a bit confusing for us non-electronical centric people as they talk a lot about using the Probe Sensor, which just doesn’t apply fully to the BLTouch Sensor. (To be honest I get more confused by reading this page, so don’t feel bad if you are like me!)
They have added a BLTouch section now though, which helps a lot. Thumbs up! 🙂
It means we can’t just use all the pins from the Probe connector as the sole connection on the Duet WiFi, but only use 2 of these pins in the Probe Connector, GND and IN, to register the actual signal from the BLTouch. We need to use PWM connector for the other 3 pins from the BLTouch.
The Probe Connector is the one to the right in the photo. Placed next to the LCD connector to the left of it.
The red wire is IN and black wire is GND
![]() |
Note: You might notice the small 480Ω resistor crimped into the connector here. More on this later.
Using expansion PWM port for Servo
The 3 remaining wires from the BLTouch are there to control the Servo Pin inside the BLTouch.
Since we have a Duex board we are going to use 1 of the 5 ports labeled as “PWM” ports on the board itself, but listed as “Shared with servos” on Duex2/5 main features page.
When looking at the Wiring Diagram, the connectors are labeled as “PWM / Servos“.
Physical Connections
Lets start by looking at the 2 wires for the Probe Connector on the Duet Wifi/Ethernet.
2-Pins for Z signal
We are going to connect the 2 wires labeled Z (white) and GND (black) on the BLTouch and connect to the matching pin on Duet WiFi Probe Connector, as shown in the diagram.
Note: Your wires might be colored differently. Especially if you use a counterfit version like 3DTouch.
My version of the BLTouch is an old Classic version.
5v to 3.3v logic level conversion
The BLTouch is as default configuring using 5v logic. It means we have to make sure we set it up to run as 3.3v logic instead. Don’t worry about not grasping what 3.3v logic means, as it’s really not important to know what it is, only how we hook up our sensor.
If you have an old Classic BLTouch (as I do), you need to either solder or crimp in the included 480Ω (ohm) resistor between the 2 wires for the Probe Connector.
I crimped them into my connector. Mine came with a 480Ω and 10kΩ resistor.
![]() |
![]() |
I do not know why the 10kΩ was included.. anyone know?
- Source for right side and below -image and information: BLTouch on indiegogo.com
If you have a new version of BLTouch with serial number, you just need to cut the solder away between 2 solder pads, as shown here:
3-Pins for Servo
The 3 left over wires on the BLTouch are GND (brown), Red (5v) and Orange (control signal)
If you do not own a Duex expansions port and instead use the pins on the Duet Wifi, you connect as shown on this diagram:
You can use a different Heater-pin, just make the necessary adjustment in your configurations.
- GND ( G, Brown) to pin 2 on Duet WiFi
- 5v (5v, Red) to pin 1 on Duet WiFi
- Orange (S, Control signal) to pin 31
Some info on the Duet Wiki where they use pin 8 instead of my 31. They are also using different colors than my BLTouch, so be sure to check on your own model!
Note on below wire colors: I did not have any brown (used black) or orange (used white) cables, so go by the labels near the connectors, or remember my choices.
The difference between Pin 8 and Pin 31, is how Pin8 is assigned Heater 3 and Pin31 is assigned Heater 7. I picked the last available, in case I later wanted to actually use Heater 3 as a heater. I’m never going to use 7 heaters, and Heater 7 connector also made for nicer wiring in my case 🙂
Note: It can be confusing how the numbering on PWM# and E# doesn’t follow each other. Reason for this is, how the Heater numbers (E) starts with E0 and E1 located on main Duet WiFi board, while the PWM ports are either starts with PWM1 or PWM0 is somewhere not known to me.
The above diagram is a small part I made out of the full diagram.
Firmware Configuration
It’s time to configure our firmware in order to use the BLTouch sensor we just connected. There is some good information on the Connecting a Z probe – BLTouch on the Duet3d wiki.
Disable heater
As shown in the warning in the above diagram, the PWM channels are shared with the heaters, so we need to disable the relevant heater.
We are using the PWM_5 connector, which is the 7th Heater.
We disable it using the M307 Gcode command and setting A, D and C to -1 in our Heaters section in Config.g file. Setting them to -1 means they are disabled.
M307 H7 A-1 C-1 D-1
Note: change H7 to whatever heater you need to disable according to how you choose to wire it up.
RepRapFirmware 1.16 and later allow the PID controller for a heater to be disabled by setting the A, C and D parameters to -1. This frees up the corresponding heater control pin for use as a general purpose I/O pin.
Set Servo Position
Now we need to configure the position of our Servo Pin, which we do using the M280 Gcode command.
Deploy Probe
In order to do so, we put the following into our deployprobe.g file. If you do not have this file, you just hit New File in the System Editor where all the other config files are located and create it.
Insert the following into the file, where the P-number corresponds to our H-number above.
M280 P7 S10
S10 is the “angle” the PIN is put in to engage. You can read more and also see a table of most of the expansion pins. When dealing with BLTouch the engaged position is at angle 10.
Note: In the Duet wiki it is listed to include a Invert parameter: I1 at the end as well, but mine doesn’t work when used.
Retract Probe
Next we need to configure how we retract the Servo Pin in the BLTouch. These settings are configured in the retractprobe.g file. Create it the same way as before if you don’t have this file.
M280 P7 S90
Once again, the P-number corresponds to our H-number while S defines the “angle” to put the probe into. When dealing with BLTouch the retracted position is at angle 90.
Note: In the Duet wiki it is listed to include a Invert parameter: I1 at the end as well, but mine doesn’t work when used.
Configure Endstop Section
Set Z-Probe type
Now we need to setup the Probe Type to Type 5 in our Endstop section in the config.g file using the M558 command.
P5 (from RepRapFirmware 1.14) selects a switch (normally closed) for bed probing between In and Gnd pins of the Z-probe connector (Duet 0.8.5 and Duet WiFi).
Settings legend/explanation:
Overview of what the different parameters means and do:
- P# = Mode/Type of probe – P5 is for bed probing between In and Gnd pins of the Z-probe connector.
- XYZ# = 1 use probe for this axis. 0 do not use probe for this axis
- H# = Dive Height of the Servo pin. 5mm is normal for BLTouch
- F# = Feed Rate mm/min
- T# = Travel speed to and between probe points (mm/min)
It all means that we insert the follow line for our new Z-Probe, defining the Type and usage settings.
M558 P5 X0 Y0 Z1 H5 F120 T6000 ; Set Z Probe to type Switch or Digital output where Z probe connector is used. Used for z only.
;
- Put it in the Endstop section in config.g file:
Set or Report Current Probe status
Next we need to setup how the Probe behaves, using the G31 command.
Settings legend/explanations
- Z# = Trigger height. 1.5mm is normal for BlTouch
- P# = Trigger value. 25-100. Lower it if nothing happens.
- XY# = Placement of probe relative to your nozzle. Called offset. In mm.
It means we set trigger value to 50 (don’t worry if it means nothing to you), define where the probe is placed in realtion to our nozzle and the trigger height of the Probe Pin.
The Z value is the Z-offset. Used to tune the distance between trigger location and nozzle. Higher offset value and you get the nozzle closer to bed.
G31 P50 X-25 Y38 Z1.5; Set Z probe trigger value, offset and trigger height
- This line is also placed in the Endstop section in the config.g file.
- Just place it under the above M558 line.
G32: Probe Z and calculate Z plane
The G32 Gcode Command can be used to define 3 or more probe points. I am only using mine as a Z-min endstop with 1 point, so not going to use this feature for now.
Links
- Duet3d forum post on: BLTouch
- Duet3d wiki: Connecting a Z-probe
- Duet3d wiki: Connecting BLTouch
- Official indiegogo post on BLTouch: https://www.indiegogo.com/projects/bltouch-auto-bed-leveling-sensor-for-3d-printers#/
Relevant Gcode commands:
- M574: Set endstop configuration
- M307: Set or report heating process parameters (config.g file)
- M280: Set servo position (deployprobe.g and retractprobe.g file)
- M558: Set Z probe type (config.g file endstop section)
- G30: Single Z-Probe (config.g file endstop section)
- G31: Set or Report Current Probe status (config.g file endstop section)
- G32 Probe Z and calculate Z plane –
- M557: Set Z probe point or define probing grid – not sure if needed?
I believe the “S” value in deploy and retract correspond to Servo angles, it’s deployed at 10degrees, and retracted at 90 degrees
Hello Jakob. I don’t understand the Servo Angles in regards to BLTouch. Is it just a deprecated value called angles, that has some other function on BLTouch? Asking as the pin goes straight up and down, so not sure what 10 and 90degrees actually means here?
Not that i am really any kind of expert :). The bltouch emulates a servo type probe , so in order to trick firmwares into thinking it was really a servo this was build into the logic- at least that is the logic i apply to this. So it is likely a legacy, but why change it, as that would likely break the functionality build into any number of firmwares.
Now i just need to make mine work it doesnt deploy when homing Z. Just installed the duet with the help of your excellent guides, thanks. Only have three issues. Extruder thermistor fails, hotend fan fails(i Think that is hardware fail), and the Said non-deployment of BLT on home(it self tests ok). Oh and the motors whine when idle but i suppose that can be tweaked
Most r/c servos operate on PWM (Pulse Width Modulation). It ranges from 0 to 1520 pwm giving it a 120 degree range. Most servos are centered at 760 and the input from the transmitter tells it to move one way or the other. The bl touch pin is deployed or retracted telling the “servo” to go to 10 degrees (a specified pwm) to deploy and 90 degrees ( a different pwm) to retract. It’s a signal to control it.
Hello
1 X 10KΩ Resistor for Smoothieboard
1 X 240Ω Resistor for 3.3V Logic Level
Thanks so much for all the work explaining this! I never would have gotten my BLTouch working without it. I wanted to share that there is a a new, new version of the BLTouch – V3 (as on 4/20/19). You still have to make the break between solder pads, but they have been relocated. The pic and details for that are here: https://www.antclabs.com/bltouch (scroll down to “Internal 3.3V logic conversion”).
Thanks Paul 🙂
One more update and a question. Now with Version 3.1, the BL-TOUCH is 3.3 and 5v tolerant. No modifications required. Now the question – do you know if the ground wires (black and/or brown) can be be connected to the same ground pin on the Duet? OR can you connect the brown or black to an always on ground pin? Basically, I have Wanhao D6 that I’ve converted to using the Duet2 Wifi and the ribbon cable is only 16 wires, so I’m short one adding the BL-Touch…
Can someone help me make the BLtouch work.
G30 commands continues to indicate: Z probe already triggered at start of probing move.
Pin also not deploying …
When i run M280 P0 S10 pin is deployed.
Config:
Roys 3D printer
G30
Status
Idle
Mode: FFF
Tool Position
X
0.0
Y
0.0
Z
0.00
Extruder Drives
Drive 0
0.0
Speeds
Requested Speed
0 mm/s
Top Speed
0 mm/s
Sensors
Vin
24.3 V
MCU Temperature
29.7 C
Z-Probe
1000
Tools
Extra
Control All
Tool Heater Current Active Standby
Tool 0
T0 – Load Filament Heater 1
off 20.3 C
0
0
Bed Heater 0
off 19.9 C
0
0
Temperature Chart
System Directory
0:/sys/config.g
; Configuration file for Duet WiFi (firmware version 3)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v3.1.9 on Sat Nov 28 2020 15:24:08 GMT+0100 (Midden-Europese standaardtijd)
; General preferences
G90 ; send absolute coordinates…
M83 ; …but relative extruder moves
M550 P”Roy’s 3D printer” ; set printer name
M669 K1 ; select CoreXY mode
; Network
M551 P”@Susg75vx!” ; set password
M552 S1 ; enable network
M586 P0 S1 ; enable HTTP
M586 P1 S0 ; disable FTP
M586 P2 S0 ; disable Telnet
; Drives
M569 P0 S0 ; physical drive 0 goes backwards
M569 P1 S0 ; physical drive 1 goes backwards
M569 P2 S1 ; physical drive 2 goes forwards
M569 P3 S1 ; physical drive 3 goes forwards
M584 X0 Y1 Z2 E3 ; set drive mapping
M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
M92 X160.00 Y160.00 Z800.00 E837.00 ; set steps per mm
M566 X900.00 Y900.00 Z12.00 E96000.00 ; set maximum instantaneous speed changes (mm/min)
M203 X24000.00 Y24000.00 Z540.00 E1200000.00 ; set maximum speeds (mm/min)
M201 X3000.00 Y3000.00 Z100.00 E8000.00 ; set accelerations (mm/s^2)
M906 X950 Y950 Z1300 E1100 I30 ; set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout
; Axis Limits
M208 X0 Y0 Z0 S1 ; set axis minima
M208 X400 Y400 Z500 S0 ; set axis maxima
; Endstops
M574 X1 S1 P”xstop” ; configure active-high endstop for low end on X via pin xstop
M574 Y1 S1 P”ystop” ; configure active-high endstop for low end on Y via pin ystop
M574 Z1 S2 ; configure Z-probe endstop for low end on Z
; Z-Probe
;M307 H7 A-1 C-1 D-1
M950 S0 C”exp.heater7″ ; create servo pin 0 for BLTouch
M558 P9 C”^!zprobe.in” H5 F120 T6000 ; set Z probe type to bltouch and the dive height + speeds
G31 P500 X0 Y0 Z0 ; set Z probe trigger value, offset and trigger height
M557 X0:300 Y0:300 S20 ; define mesh grid
; Heaters
M308 S0 P”bedtemp” Y”thermistor” T100000 B4138 ; configure sensor 0 as thermistor on pin bedtemp
M950 H0 C”bedheat” T0 ; create bed heater output on bedheat and map it to sensor 0
M307 H0 B0 S1.00 ; disable bang-bang mode for the bed heater and set PWM limit
M140 H0 ; map heated bed to heater 0
M143 H0 S120 ; set temperature limit for heater 0 to 120C
M308 S1 P”e0temp” Y”thermistor” T100000 B4138 ; configure sensor 1 as thermistor on pin e0temp
M950 H1 C”e0heat” T1 ; create nozzle heater output on e0heat and map it to sensor 1
M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit
M143 H1 S280 ; set temperature limit for heater 1 to 280C
; Fans
M950 F0 C”fan0″ Q500 ; create fan 0 on pin fan0 and set its frequency
M106 P0 S1 H1 T45 ; set fan 0 value. Thermostatic control is turned on
M950 F1 C”fan1″ Q500 ; create fan 1 on pin fan1 and set its frequency
M106 P1 S0 H-1 ; set fan 1 value. Thermostatic control is turned off
; Tools
M563 P0 D0 H1 F0:1 ; 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
; Custom settings are not defined
Did you get it to work. Please join facebook group for more complex help 🙂
https://www.facebook.com/groups/duet3dunofficial/