3D Printering: the final frontier. These are the voyages of another 3D printer hack. Its mission: to explore strange new ways of leveling a print bed.

So far, we’ve had servo probes, Allen key probes, Z-sled probes, inductive and capacitive contactless switches, just to name a few. All of them allow a 3D printer to probe its print bed, calculate a correction plane or mesh, and compensate for its own inherent, time variant, inaccuracies.

These sensors are typically mounted somewhere on the print head and introduce their own sensor offset, which has to be precisely calibrated for the whole thing to work. To eliminate these offsets – and a large part of costly EOL testing and calibration – the Polish 3D printer manufacturer Zortrax uses a smarter approach: Conductive pads on the build plate. During the leveling procedure, the printing nozzle makes contact with these pads, which practically turns the nozzle itself into the probe — offset-free. Makerbot patented a contact sensing solution based on force sensors located in the print head, although similar builds based on limit switches were known before. Other DIY builds use force sensitive resistors (FSR) underneath the build plate to achieve the same. All these techniques are based on the detection of a brief contact between the printing nozzle and the build plate, and are therefore offset-free.

Compelled by the idea of eliminating the last manual calibration step, I wanted to make Zortrax’s method of contact sensing compatible with non-conductive PEI, Garolite and glass build plates. I didn’t want to interfere with the Makerbot patent, and force sensitive resistors would not survive the temperatures of a heated bed. I figured that I could just strap a sufficiently heat resistant piezo sensor to the print bed to sense the little knock the nozzle would make when it collides with the print bed. However, not much sound energy is released when a nozzle runs into a build plate at blazing 1 mm/s. A first test revealed that the knocking sound was too weak to be reliably distinguished from other vibrations in the machine.

Several piezo discs, attached to the bottom of a Prusa MK2a heated bed. The test platform: A Prusa i3

To fix this, I acquired a 10 W structure-borne sound exciter and attached it to the extruder. The exciter allowed me to actively inject a white noise signal into the nozzle. If it was strong enough, this signal would travel through the entire printer and could be picked up by the piezo discs in the print bed, far above the printer’s own noise level. I assumed, that when the nozzle touches the print bed, the transfer function between the exciter and the piezo sensor must change rapidly due to the direct transfer of sound between the two. This change would then lead to a rapid change in the amplitude spectrum the piezo picks up. A little DSP could process the piezo signal, detect these rapid changes in the amplitude spectrum and give back a trigger signal to indicate the collision.

For the required realtime DSP, I hooked up the piezo discs to a plain Teensy Audio Shield equipped with a Teensy 3.1, which practically completed the hardware portion of this project in one step. Using Paul Stoffregen’s amazing DSP library, it took only a few lines of code to run a 256 point FFT on the input signal and a few more to generate a time-averaged amplitude spectrum. The little sketch compares this averaged “frequency fingerprint” of commonly present vibrations to the current spectrum, calculates an overall energy difference between the two, and if that difference exceeds a certain threshold, the Teensy pulls an output pin low, telling the 3D printer controller that the nozzle just touched the build plate. I later added an OLED display and rotary encoder, basically for plotting the signals and for being able to adjust the threshold.

This turned out to work quite well, while submersing the whole printer in a pleasant swoosh noise, but it added quite a bit of additional weight the extruder assembly. Also, these exciters aren’t particularly cheap, and an additional audio amp would be required, too. It wasn’t really it.

It took a while for me to figure out what I would do with the whole project. And then, just when I was about to send it into project-limbo, I had another idea: To save cost and weight, I could use the extruder’s stepper motor as the exciter, the stepper motor driver as the amplifier, and stick with the cheap piezo discs attached to the print bed as microphones. In theory, the 3D printer controller could both generate the noise signal and process the sound signal from the piezos, so the only additional component would be the preamp and the piezo discs.

Yet, it was still unclear if the stepper motor would adapt to become some sort of speaker, so that’s the first thing that needed testing. I hacked together a little noise injector board that would go between the 3D printer controller and the stepper driver. This little hack utilizes an Arduino Pro Mini clone to switch between two modes: A bypass-mode, where it just passes through the signals from the 3D printer controller, and a noise mode, where it streams a pseudo-random sequence of forward and backward micro steps to the motor driver. This, I hoped, would cause the stepper motor to oscillate and produce a noise signal. And well, it did. I turned it on and the extruder motor swooshed with a strong noise, very similar to the exciter I used before, although the extruder’s gears rattled quite a bit.

I tweaked the random sequence to make sure that the stepper motor would never perform an actual full step as a random accumulation of micro steps. Besides that, everything worked surprisingly well. The probing is accurate to a level where it becomes really hard to tell how accurate it actually is. If the nozzle touches down to a sheet of paper and stops once it senses the touch, the paper will slide easily and consistently between the nozzle and the build plate without being stuck. Since then I’ve been using this for several prints, and it works just like regular auto bed leveling probes, although with fewer advantages than expected: It eliminates the offset calibration, but also introduces a threshold value for the touch detection.

From an economical view, this is still a nightmare. On current Arduino-style 3D printer platforms, it takes an additional DSP, DAC, a preamp and the noise injection adaptor to implement this sort of sonic auto bed leveling. Even if the piezo discs are virtually free, everything adds up to about 5 times the cost of a decent capacitive distance switch.

It might make more sense in the not so distant future. We’re beginning to see a new generation of 3D printer controllers that feature a more powerful 32 bit MCU, ideally we want one that supports DSP instructions. Given the availability of cheap STM Nucleo boards with powerful, DSP-enabled ARM Cortex-M4 MCUs, my bet is that insanely powerful 3D printer controller electronics, capable of tricks like this one, are bound to happen rather soon. For now, enjoy the following video of an early test of the sonic auto bed leveling: