3D Printers are now "auto-leveling" via a limit switch contacting the surface that is swung into place prior to printing and height of the bed is checked in 3 places. Software then continually adjusts the print head on the Z Axis throughout the printing process to travel the printing head in the same plane as the printing bed.

Are there not electronics that can simply measure such a short distance (<2") accurately (ultrasound, infrared??? to accuracy of .1mm likely) and instantly without the need to lower the print head until a limit switch is engaged?

It would seem likely this measurement of the printing bed's plane could be accomplished quicker and cheaper than by a limit switch swung down into place via a servo motor and moving the print head down to have it engage...

  • \$\begingroup\$ Even in 2013, the “servo dropping a switch” was only a thing in hobbyist devices. The professional printers used more sophisticated sensors. \$\endgroup\$ Apr 15 at 2:50

4 Answers 4


Distance measurement through non-contact methods is perfectly feasible, and is used in many industrial applications. Not having this in a 3D printer is not a technology constraint but a cost and complexity one.

For instance, at the simplest level, proximity sensors such as Vishay TCRT5000 can be used, with fairly trivial microcontroller code required. The device consists of an infrared LED and a photodetector, which work by reflected infrared from a surface, such as the printer bed. Precision is not earth-shaking, but nor is the cost: $1.46 for 10 units.


For something slightly more sophisticated, fully integrated, serial interface proximity sensors using a similar reflective IR mechanism are available, e.g. Vishay VCNL3020 (~$3 each) and Austria Microsystems TSL2671 (~$1.60 each). Both of these have I2C interfaces, and eliminate the entire effort of modulating the IR LED and calibrating for ambient light.


Depending on the layer resolution of the 3D printer, this too may not provide sufficient precision and accuracy for the purpose. In such case, laser-based, diffraction-grating angular deviation sensors such as the Sick OD Mini product range are available. These are typically accurate down to tens of microns. Prices are pretty steep, making these unviable for domestic 3D printers. Such devices are commonly used in industrial grade machinery, including, presumably, additive manufacturing machinery.

OD Mini

Note that all the common distance sensing devices I have mentioned, used in the sensing range of interest, are based on infrared or occasionally visible light reflection, either using reflection intensity (low precision) or angular dispersion (high precision). Ultrasonic devices typically do not boast the degree of precision these optical devices can achieve.


An LVDT can provide a resolution of few microns, however, the front end is more complex.

Edit: Wikipedia LVDT Attach one to the shaft of the print head, calibrate the distance, and make sure the surface doesn't move.

Last time I checked, LVDT were very expansive. (few hundreds USD per unit)

  • \$\begingroup\$ Could you elaborate a little? By LVDT, do you mean Linear Variable Differential Transformer? Could you post links to the LVDTs, which can do few microns? That would be interesting to see. \$\endgroup\$ Dec 24, 2013 at 18:52
  • \$\begingroup\$ For an LVDT to work, the sense arm would have to be fixed to one object, say the base-plate, while the transformer would have to be fixed to the other object, say the print head. So how exactly would this be practical, or cost effective? \$\endgroup\$ Dec 25, 2013 at 9:40
  • \$\begingroup\$ Attach the LVDT's core to the print head shaft and its body to the shaft's base. Since the XY actuator is usually at a fixed distance from the print bed, you have only one measurement to do, and that is of the print head's travel distance. \$\endgroup\$
    – Lior Bilia
    Dec 25, 2013 at 12:13

2 years later and now it's an affordable extra PCB next to the printer head. A controller like the Duet has a connector for this sensor.

"Differential modulated IR height sensor" https://miscsolutions.wordpress.com/mini-height-sensor-board/


Some distance sensing devices can be acquired via Ebay for about 120 Euros. I have actually tried this on an Omni200 3d printer to get more control over the first layer height. The sensor is a Panasonic HG-C1030-P. Mounted on the printhead it looks like this:

Mounted sensor on printhead-1 or Mounted sensor on printhead-2

Most of these sensors come in so-called NPN or PNP variants, which just differ in their output circuitry. For the interfacing to the 3d printer controller, a small circuit board was designed which supports both versions. If anyone is interested, schematics can be found here:


The board layout looks like this:

Interface for laser distance sensors

The sensor allows precise measurements in the order of 1/100 of a mm on different materials and its output is able to give an active (low) signal if the object approaches too closely. Another helpful feature of the sensor is that for manual bed leveling, the readings at the led display can be used directly for any height correction.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.