← back

A Scanning Z Probe for RepRapFirmware and Duet

Written by: David Crocker Posted on: 2023-07-01

Recently we saw the announcement of the Beacon scanning Z probe. Unlike traditional Z probes, it doesn’t have to be lowered at each probe point in order to measure the deviation from Z=0 at each probed point; instead the bed is scanned and the deviation is measured at a (potentially large) number of points. Does this offer significant advantages over traditional Z probes, such as BLTouch and (for delta printers) the Duet3D Smart Effector? The Beacon has a USB interface and is designed for use exclusively with Klipper firmware. Can we use the same technology with other firmwares – in particular RepRapFirmware – and at the same time reduce the cost?

Anatomy of the Beacon

The Beacon probe has been analysed in this Twitter thread. Basically, it uses a LDC1612 inductive sensor ship, coupled with a small microcontroller (likely a SAMD21) to process the output of the LDC1612 and provide a USB interface. The LDC1612 is nothing new. You can buy a breakout board from Seeed either directly or from distributors, such as RS Components in the UK. The associated Github Repository was created in June 2018. However, what the creators of the Beacon have done is to recognise the potential of the LDC1612 chip to measure deviation from an ideal height, rather than to use it as a traditional inductive Z probe with a triggered/not-triggered output.

The Beacon is priced at $79.99 which is more than some 3D printer control boards. I guess that Beacon3D is attempting to recoup their development costs before their product gets widely cloned.

Limitations of inductive Z probes

Inductive Z probes are far from ideal for 3D printers. Before you buy one, consider the following:

  • Do you even need to perform mesh bed compensation? It’s possible to construct a printer that is so stable that you level the bed manually just once. This user is an expert at doing this.
  • Is an offset Z probe (as opposed to a nozzle-contact Z probe) suitable for your printer? If your printer is a delta, the answer is certainly no.
  • Inductive Z probes are notoriously temperature-sensitive. The sense coil inductance and resistance vary with temperature, and the bed (which is the target for the sensor) has a resistivity that varies with temperature – and if it is ferromagnetic, its permeability also varies with temperature. So compensation for the sensor and/or the bed temperature is essential. If the bed temperature isn’t uniform when the bed is probed or scanned, this may result in the cooler areas of the bed appearing to be at a different height compared to the hotter areas.
  • Inductive sensors are usually large. This in turn affects how close to the printing nozzle you can mount them. The further the sensor is from the nozzle, the less useful it is. If the print head exhibits a variable tilt relative to the horizontal as it moves along the gantry (for example, because the gantry sags slightly, or because of play in bearings that causes the tilt to depend on the last movement direction), that will affect the relative heights of the nozzle and the probe. This is especially severe in delta printers, but occurs in some Cartesian and CoreXY printers too. The Beacon isn’t as tall as a traditional inductive sensor, but it does have a large sense coil. The product page gives its size as 30x30x10mm.

A scanning inductive Z probe for RepRapFirmware

It’s clear that a scanning inductive Z probe offers potentially significant time savings compared to a traditional inductive Z probe. So, if you’ve decided that an inductive Z probe is right for your machine, is there a way to use the Beacon with Duet and RepRapFirmware, or to construct an alternative with similar functionality and (preferably) at lower cost? The manufacturers of the Beacon have stated that it is for use with Klipper firmware only, so we can’t expect any help from them.

Perhaps the biggest obstacle to using it with Duet is that the interface to it is via USB only. This presents two problems:

  • Current Duets boards and firmware don’t have USB host capability. In fact, the hardware on Duet 3 boards can in principle operate in USB host mode; but so far this hasn’t been enabled in firmware.
  • Many Duet 3 systems use CAN-connected tool boards mounted on the print head. The Z probe is normally connected to the tool board because this saves running separate wires from the Z probe back to the main board. Even if we enabled USB host mode in the firmware for Duet 3 main boards, a separate cable would be needed for the Beacon.

    A way around these obstacles is to use the same LDC1612 sensor that the Beacon uses, but instead of using a separate microcontroller to provide signal conditioning and a USB interface to the sensor, connect the sensor directly to the I2C interface of the tool board. The amount of processing needed to handle the LDC1612 and make the data available via the CAN-FD bus is tiny, so this does not add any appreciable load to the SAMC21 tool board processor.

Hacking a solution together

Prototyping this was not difficult. The Seeed LDC1612 evaluation board is priced at $16.40 plus carriage. It’s also available in the UK from RS components, at £15.30 including VAT. If you are into making your own PCB then you can purchase a bare LDC1612 chip from Digikey for just $3.75 plus carriage. The Seeed module includes a 40MHz oscillator, so if you use the bare chip then you will need to either use the oscillator built-into the chip, or provide a 40MHz oscillator, or generate a suitable clock for the SAMC21 on the tool board (my sample tool board firmware generates a 32MHz clock on the PA23 test pad).

A screen capture from KiCAD showing where the connections are made to interface the LDC1612 with the Duet3D Toolboard 1LC

Version 1.1 and later of the Duet 3 Tool Board uses a I2C bus with 3.3V signals levels to connect the LID3DH accelerometer. The Seeed module or a bare LDC1612 chip can be connected to the same bus. I picked up +3.3V and GND for it from the IO1 connector, tapped into the SDA signal on resistor R54, and the SCL signal on R53. These resistors are 0402 size so I used a fine-tipped soldering iron. Here is an image showing the location of the two resistors on the version 1.2 tool board, close to opposite corners of the accelerometer chip. I have circled the two pads that the wires connect to.

An image showing the wire mod connections to the Duet3d Toolboard 1LC

Here is a photo showing the wires connected to those points. I found wire wrapping wire suitable for this because it is thin but solid core.

An Image of the LDC1612 breakout board connected to the Duet 3 Toolboard 1LC

Here’s how I connected the Seeed LDC1612 board to the tool board for the purposes of testing.

I chose to install the scanning sensor on my E3D Tool Changer, which I had previously modified to use a Duet 3D 6HC main board and tool boards for two Hemera tools. Rather than mount the sensor on one of the tools, I chose to mount it on the tool pickup head. I printed a part to replace the original printed cover of the tool pickup head. The tool board is wider than the front of the pickup head, so to keep it clear of the sides of the machine when the pickup head is at the extremes of the X axis, I extended the cover upwards to hold the tool board clear of the machine frame. I also extended the bottom of the cover to mount the sense coil about 3mm higher than the Z probe microswitch on the pickup head. Here are some more photographs.

Image showing the Duet 3 Toolboard 1LC and the LDC1612 mounted on a temporary printer mount Image showing the Duet 3 Toolboard 1LC and the LDC1612 mounted on a temporary printer mount from underneath Image showing the Duet 3 Toolboard 1LC and the LDC1612 mounted on a temporary printer mount from behind

Firmware configuration

The microswitch on the tool pickup head is a stable and accurate Z probe, whereas inductive Z probes are known to be sensitive to temperature. Therefore I chose to use the inductive sensor as a secondary Z probe. This also allowed me to compare height maps produced by the scanning probe with height maps produced by the microswitch. Here’s an extract from my config.g file:

; Microswitch Z probe
M558 K0 P8 C"io3.in" H3 F1000:600 I0 T30000
M558 K0 P8 C"io3.in" H3 F1000:600 I0 T30000
G31 P200 X0 Y0 Z0
;M557 X-140:140 Y-80:80 S40                 ; temporarily disable original mesh grid

; Scanning inductive Z probe
M558 K1 P11 C"24.i2c.ldc1612" F25000 T30000
G31 K1 Z3 Y-17M557 X-140:140 Y-90:80 S12    ; define mesh grid for probe 1

The next step was to modify the mesh.g file to handle the K parameter, so that I could use G29 K0 to use the original microswitch probe, or G29 K1 to use the scanning probe:
; mesh.g file, handles G29 commands with no S parameter
; mesh.g file, handles G29 commands with no S parameter
T-1
M208 S0 Y100
if exists(param.K) & param.K=1
  G1 X0 Y0 F30000       ; move to bed centre
  G30 K0                ; re-establish Z=0
  M558.1 K1 S2          ; calibrate the scanning probe
  G1 Z7                ; approach from above in case of backlash
G29 S0 K{exists(param.K) ? param.K : 0}
G1 X0 Y0 F24000
M208 S0 Y49
G1 Y-150

I chose to calibrate the scanning probe immediately before scanning the height map. It’s probably not necessary, but it takes only a few seconds and makes the process less sensitive to temperature. The whole calibration and scanning process takes around 20 seconds..

Here’s an example of the height map produced by the scanning probe.

screen capture showing the Duet Web Control UI displaying a height map created by the scanning Z probe

For comparison, here’s the height map produced by the microswitch probe: screen capture showing the Duet Web Control UI displaying a height map created by a switch based z probe

It is evident that the height maps have similar shape but there is a small Z offset between them.

Summary

The scanning probe using LDC1612 and the 20mm search coil on the Seeed breakout board appears to work well, at least when used in combination with a regular Z probe to establish an accurate Z=0 datum.

Further work remains, in particular:

  • We need to establish how temperature sensitive the scanning probe is and whether we should compensate for sense coil temperature, or bed temperature, or both. The Duet 3 1LC tool board already has a second thermistor input, which could be used to compensate for sense coil temperature.
  • The 20mm sense coil of the Seeed breakout board is larger than would be convenient to mount on a small and light hot end; so we will investigate using smaller sense coils. I think it should easily be possible to use a 10mm diameter sense coil, perhaps even 6mm.

Although I prototyped this using a Duet 3 tool board, for those not wishing to make hardware modifications it would be possible to use a SAMMYC21 board instead. I have added LDC1612 support to the standard SAMMYC21 firmware configuration.

Here is a short video showing the prototype in action:

← back