Piezo-electric sensors

From RepRapWiki
Jump to: navigation, search

There are current two systems in use:

Piezo-electric Hotend Z-probe - to which this page mainly refers, and:

Underbed Piezo-electric sensors - on which this system is based, and where the majority of the development took place.



There are many z-probe technologies in use in 3D printing, [Reprap Wiki Z Probes[1]] however each has its advantages and disadvantages. Some are more accurate, convenient and useful than others.


The aim was to devise a z-probe which was:

  • Accurate to 0.01mm or better and reproducible.
  • Uses the nozzle as a probe and therefore has no x/y offsets and minimal z offset.
  • Is permanently mounted for convenience and improved reproducibility.
  • Is low cost

Most of these aims are self-explanatory but the advantage of using the nozzle as a probe should be explained:

  • The nozzle in a 3D printer is the tool, and the nozzle tip is the point in space that the coordinate system describes. Being able to determine by probing directly where the bed and this point intersect is theoretically the most accurate method of calibrating/levelling/z-homing, although few modalities so far have achieved this in practice.
  • Having no probe offset from the nozzle. Other common probes such as an IR probe, inductive probe, capacitive probe and deployable/servo probes are physically not using the nozzle as the probe, and therefore have offsets in x,y and z. On a cartesian/corexy machine there is a often a limit to the bed area that can be reached by the probe for the purposes of bed levelling/compensation. At certain nozzle coordinates the probe is out of the bed due to its x/y offset and cannot probe unless the frame/axes are much larger than the printbed, which is unusual. On a delta, effector-tilt an inevitable consequence of mechanical imperfection, means that an offset probe is either fractionally closer to the bed relative to the nozzle or further away depending on the x,y coordinate. This can be compensated for in software, and can be minimised by good mechanical build and optimal mounting of hotend and probe, but it does cause problems and compensation in software manually requires time. With the piezo hotend probe x and y offset is always 0. Z offset can be 0 but practically a small offset of around 0.1mm takes into account the upward movement of the nozzle (and hotend) which is required to trigger the probe.
  • Surfaces in use in 3D printing vary widely, making some probing technologies less effective, thick glass prevents inductive sensors from detecting the metal beneath, IR reflectivity variation results in error using IR sensors, spray coatings are especially problematic due to uneveness. Being able to quickly remove and attach various beds/surfaces is desirable without having to undergo complex or time consuming re-calibration. Physical touch by the nozzle is thickness independent, and surface material independent (unless theoretically the surface is extremely soft, however the system works on painters tape and hard surfaces equally well).

Other z-probe modalities using pressure sensing have been used:

  • Force Sensitive Resistors – placed under the bed. Whilst this system works and is comparable in many ways to the piezo hotend sensor, it suffers from the need to suspend the bed on mounts containing the FSR's. This introduces compliance in the bed, and sometimes even, a loose print bed. The FSR's are sensitive to high temperatures which necessitates insulation to be used which introduces further compliance.
  • FSR's in the hotend, a system exists to place FSR's above the hotend. Whilst this eliminates the issues with mounting the bed, getting a firm nozzle and still having enough compliance to trigger the sensor is the challenge.
  • Underbed Piezo-electric sensors. This system is the forerunner of the piezo hotend probe. In this system 3 piezo discs are used with specially designed mounts below 3 fixing points on which the printbed is suspended. Practically this works the same as the hotend probe but requires greater complexity in mounting the bed so that it is stable and the piezo discs are sensitive to the heat of a heated bed.

The Principle of Operation

The printed parts required for this version and links to several other versions, plus practical assembly instructions are available here:http://www.thingiverse.com/thing:2069480

Basic schematic of Piezo Hotend Z-probe
A hot end clamp securely holds the hotend. Between the clamp which has a narrow flange on the top and the upper part (which can be integrated into an effector or carriage) is a piezo transducer, element or disc designed to be a buzzer, these are very low cost $0.50 approximately. The upper part has a recess to center the piezo disc. The two key innovations have been:
  • To cut a hole in the center of the piezo disc through which the filament within a PTFE guide tube (or Bowden tube) passes.
  • To use rods/pins between the upper part and clamp to reduce lateral movement in the assembly which also causes “wobbly nozzle”, which is detrimental to high quality printing.

When the hotend is pushed upwards by contact of the nozzle with the buildplate the piezo disc bends. At sufficient rate of bend a potentially large voltage can be produced. This is the signal. Since piezo discs vary and designs for mounts to hold them vary, the degree of bend caused by a nozzle contact and the subsequent voltage generated varies. This voltage is frequently too large to be used directly as the input to a 3D printer controller board which require a 3.3v or 5v signal in almost all cases. Given a sharp tap piezo discs can generate up to 90 volts.

Piezo signal conditioning board v1
Piezo signal conditioning board v1.1

To solve this problem a signal conditioning board (SCB) has been devised of which a typical circuit diagram is shown on the right.

The basic principle being to detect the rate of change of voltage and where sufficient trigger a change in output at 5v (or 3.3v if this is the input voltage) which can be safely and reliably detected by the 3D printer controller. An adjustment by a potentiometer (or two in some designs) can control threshold and/or sensitivity and allows a range of piezo discs to be connected, this allows for greater choice in sourcing the piezo disc than a pre-configured board setup for a specific piezo disc.

This board is connected to the positive and negative leads from the piezo disc, and VCC (5v/3.3v), ground and signal from an endstop or z-probe connector on a 3D Printer controller.

A usable output from this system can be defined as obtaining a reliable signal when the nozzle touches the bed, and the minimum of false triggers (signal changes when the nozzle is not probing the bed). To achieve this requires:

  • Mechanically - that only vertical movement of the hotend+nozzle bends the piezo disc and generates a triggered-signal in the printer firmware.
  • Electronically – that noise generated by normal printing and travel moves is ignored or filtered, and only sufficiently firm upwards movements cause a state change to triggered for the printer controller to detect.
  • (In firmware) – this is less important as the SCB is designed to flip from 0v to 5v when triggered, however in reality there is a degree of analogue voltage change on varying rate of flex of the piezo disc. In firmware that permits analogue sensors you can set a trigger threshold which can be used to determine the line above which the firmware considers the probe triggered, below which is ignored.

Mechanical Design Considerations

Since piezo discs used as sensors generate a larger voltage (and therefore clearer signal) when bent more, the housing holding the disc should only support the disc around its circumference. The part of the clamp which presses up into the disc on probing movements should be narrower than the disc so as to bend the disc when the nozzle is pressed into the bed. Since they are very sensitive there is some leeway in how much of the disc is supported by the upper part, and how narrow the top of the clamp can be.

The piezo disc will still generate a signal even if pre-loaded. This is one characteristic which makes it suitable in this application, unlike other force sensors, a degree of pre-load keeps the nozzle firm but still allows for signal to be generated on gentle (10-15g) probing force (FSR's typically require 50-100g). It is quite acceptable to tighten the machine screws holding the clamp to the upper part, to a reasonable degree to achieve a firm assembly with very little lateral compliance, provided they are tightened evenly. If the sensitivity is too low these screws can be loosened slightly.

When printing the parts yourself, make sure that the surface used to support the piezo sensor and the part that bends the sensor have as smooth a surface as possible. So think about this when deciding on print part orientation. In one design we had to split the part into two, because both sides had structures that needed to be smooth. Printing a part with supports will generate too rough a surface.

The Bowden tube passing through the top part, the disc and clamp and down into the hotend should not impart force to the disc and bend it when the head moves in x and y. This can be achieved with an adequate sized hole in the disc (4.5mm being optimum), and use of a collar on the top part to support the Bowden tube and reduce lateral movement. A design is being considered with a Bowden coupling on the top part, and a PTFE guide tube going down into the hotend. This allows other hotends to be used aside from e3d v6 which this system was designed around, which has a convenient and small Bowden coupler which can fit within the clamp.

Versions are also in use which allow mounting of flexible cable driven extruders directly above the assembly. You can mount a direct extruder above the assembly, or incorporate the top part into the underside of an effector or carriage.

The rods which can be steel, acetal or PTFE amongst other materials are fixed to the top part either by inference fit or adhesive, but pass through the clamp with some tolerance and where appropriate, lubrication such as lithium grease. They act to stabilise the clamp from lateral movements (and prevent a wobbly nozzle) but allow vertical movements. Well assembled the hotend should feel quite firm (though it will never be completely rigid) in lateral movements, and with only a very slight compliance in vertical movement, though this is barely detectable by hand.

Electronic Considerations

The signal conditioning circuit is in two parts, a differentiator and a comparator. The differentiator converts the rate of change of the piezo voltage into a voltage, that is to say, the faster the piezo voltage changes, the higher the output voltage of the differentiator. The comparator compares the output of the differentiator to a threshold voltage, set by VR2.

VR1 sets the input impedance of the differentiator, a higher resistance on VR1 gives a higher voltage spike for the same contact strength, higher spike in the same amount of time means a faster rate of change, gives a higher voltage output from the differentiator.

The signal conditioning board sensitivity needs to be adjusted by trial and error, though once adjusted needs very little further attention unless key components are changed or significant temperature changes take place, which should be unlikely above the hotend, where broadly ambient temperatures should be expected. Moving the printer from a very hot place to a cold place might necessitate one-time re-tuning of the signal conditioning board (SCB).

Adjustment can be undertaken by moving the head around and lowering the sensitivity to eliminate almost all flickering of the LED on the SCB, although a small amount is acceptable, and its important to allow this, as a setting which shows no change during normal movements will be too insensitive for optimal gentle probing. However set it high enough that a firm upwards press on the nozzle gives a clear change in the LED usually from OFF-ON but some boards allow setting the logic in reverse to go from ON to OFF on triggering. It is not important which logic state is used as long as the firmware is configured correctly.

Firmware Considerations

Most firmware will interact with the probe and its SCB as a digital switch. Some can interpret the output of the SCB as an analogue signal, so can be tuned slightly more precisely. In most firmware the probe will be configured as a z_min_endstop or wired to a dedicated z_probe connector. This guide presumes you will configure the probe with an inverted output i.e. falling signal on triggered also called active low. If you setup the SCB to give a rising signal on triggered (active high) then the probe logic needs to be reversed in each case below.

Please be aware with all of this configuration information it is unlikely to work by merely copying these settings and an understanding of how your firmware uses the information the probe provides will be required for smooth operation and fast, reliable, tuned performance. This is subject to change so please consult the relevant resources for your firmware.


Refers to version 1.1 RC8

The SCB should be attached to the z_min_endstop connector, in most cases, although later versions allow a dedicated z_probe pin to be used for the signal wire with VCC and GND obtained from any other suitable source. Either way, the SCB needs to be supplied with power from the ramps (or other derivative board), be careful to ensure that positive, negative and signal are connected to the correct pins both at the SCB and the ramps board. The pins are not in the same order on the SCB as they are on a ramps board. Cut the wires/solder/heatshrink or slide the pins out of the plugs and rearrange them.

In marlin you need the following set:

  2. define fix_mounted_probe
  3. define USE_ZMIN_PLUG

Enable fine endstop pullup settings and comment out: //#define ENDSTOPPULLUP_ZMIN (i.e. you do not need a pullup for z_min

  1. define Z_MIN_ENDSTOP_INVERTING true (provided you use the LED on with VR2 method)
  2. define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left +right [of the nozzle]
  3. define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front +behind [the nozzle]
  4. define Z_PROBE_OFFSET_FROM_EXTRUDER -0.2 // Z offset: -below +above [the nozzle] (might need to be tweaked from -0.05 to -0.20)
  5. define XY_PROBE_SPEED 300 (can try lower for slightly more accuracy but piezo's trigger best with a firm tap)
  6. define Z_HOME_DIR -1
  7. define HOMING_FEEDRATE_Z (10*50) (reduce if your z axis can't move this fast but a faster z homing speed makes for better triggers)

-I have enabled auto bed levelling with bilinear mode (non-flat bed) and set options there to suit

It is also worth using M-codes such as M201, M205 to lower jerk and acceleration in your start gcode before probing to reduce the false triggers that can occur as the sensor is so sensitive to mechanical noise (vibrations during movement). You can speed them up afterwards. Ensure the z_probe is not an active endstop/limit switch when printing otherwise your machine might stop if the nozzle bumps over a rough area. A further development might be to use this information to plan a slow-down or stop safety system based on piezo probe reading during printing. This would be potentially be a first.


Refers to Smoothieware Edge Compiled circa Feb 2017.

Connect the probe to either the z_min endstop or z-probe connector.

If using it as an endstop add these lines to config.txt

gamma_min_endstop 1.29!

gamma_homing_direction home_to_min

Also add

probe_pin 1.29!^

gamma_fast_homing_rate_mm_s 20

gamma_slow_homing_rate_mm_s 4

zprobe.enable true

zprobe.probe_pin 1.29!^

zprobe.slow_feedrate 5

zprobe.debounce_ms 1

zprobe.fast_feedrate 50

zprobe.probe_height 5

Please note the pin on your board will depend on whether you are using a Smoothieboard/Azteeg board/MKS SBase board or a Re-Arm.

I recommend using the debounce.ms 1 setting as it eliminates most of the issues with false triggering.

If you still get them with smoothie the easiest fix is to send M220 Sx where x is speed percentage modifier, try 50% and then go higher or lower depending on results. Go back to normal speed after probing.


Refers to RRF 1.17.

Here the probe is connected (on duetwifi) to z-probe connector, note it is a 4 pin connector and one middle pin is unused. Ensure the wires are correct for +,- and signal.

There is some debate about how to use the probe. I have had great success with using it in analogue mode by using these gcodes in config.g

M558 P1 I1 F500 X0 Y0 Z0 ;analogue piezo sensor output falls on contact, probing speed, not used to home axes

G31 X0 Y0 Z0 P700 ;sensor is nozzle and trigger value.

Then you can read an analogue value on the duet web control or paneldue screen. You need to use low jerk/accel when probing. I also set low motor current to reduce effect of a headcrash but this has mainly been during testing, return all values to nominal printing values after probing.

However you can configure as digital input instead using

M558 P5 I1 F500 X0 Y0 Z0 ;digital piezo sensor output falls on contact, probing speed, not used to home axes

G31 X0 Y0 Z0 P100;sensor is nozzle and debounce ;sensor is nozzle and debounce value.

In this case P100 sets the debounce, you might need to lower it if you get false triggers, so you can most likely probe at normal speed with this value low enough to filter the noise.