banner perso

Some links about me. Many of my 3D designs are free. I also post on Google+ and in another blog,

Friday, December 18, 2015

Sensors and issues for automatic bed leveling and height adjustment

My printer eventually has a fully automatic and hardware bed leveling (aka tramming), and bed height (aka Z-offset). Yes, it now handles any tool height without any user action, in addition to a long-wished automatic leveling of the bed.
This is part of preliminary studies for a prosumer open-source printer, for which you are more than welcome to give your opinion! The entire bed structure was entirely revamped, as one important point in my former wish list.
Revised heated bed with automatic tramming and tool height compensation.
Since I wanted to document both the new bed but also why I wanted it this way, this first post addresses usual sensors and strategies used to deal with the bed calibration. The deal is to make a bed level and to start printing at a proper height, and there are many ways to do so, but not as conveniently as I wanted (which will be documented in a subsequent post). The second post will show more precisely what and how I did it.

3D printers need a fine, flat, level bed... or they fail.

A precise bed level is just plain compulsory. As listed in the corresponding section in, a wrong bed leveling may result in
  • The initial layer is not sticking to the bed.
  • The initial layer isn't complete; parts of the print just don't get laid down.
  • The head scrapes the bed in some spots (you probably worked this one out for yourself).
  • Plastic gathers around the head during printing of the first or second layer.
  • When printing the second layer the print head is picking up the first layer
There is no hope to print properly with a skewed surface. Not only the first deposited layer must be parallel to the bed surface, but it must also be squashed "just enough" to keep the part stuck on the bed for the duration of the print. Also, the initial layer height must be known precisely for the correct amount of plastic to be deposited (most of us guess the value -- a safe bet with experience).

Side note: other factors may pop the initial layer off the bed. Most thermoplastics contract when they cool down. Old-school Polycarbonate is hellish in this respect, when ABS and Nylon can be difficult. You need both a bed which is well-calibrated and heated, and often use additional glue or special material to keep the deposited plastic stuck on the bed for the duration of the print.

The problem with bed tramming

Manual bed tramming is time consuming at best, and difficult at worst. Most of us often overlook the calibration, by considering it was done weeks or month ago and it did not change... But not all printers are equal here. For example, I probably can drag my sturdy printer here and there without trouble, when most of the entry-level repraps do require a calibration again.

A tutorial on bed leveling by Tomas Sanladerer
(his channel is full of such wise videos)

A rule of thumb is that cheaper printers need more regular maintenance, even though some get software compensation nowadays. The reciprocal is not always true, though.

Anyhow, bed leveling is just not something that can be overlooked to get easy and nice prints. And probably all printers need to be calibrated regularly, soon or later, manually or automatically.

Another fundamental issue is that each time you change something to the head or to the nozzle, a new "zero bed height" must be set. This value is the initial bed distance, not the bed level. A large unwanted offset may kill your plate or your gantry when the nozzle crashes into the bed during homing, but tiny difference as small as 0.1 mm are often enough enough to degrade significantly a print. The latter happens when your new nozzle height changed just because tiny bits of plastic were left in the thread, or because it was not tightened to the exact same force as the former.

Now, obviously, when you change the complete head, a new bed height has to be set, even though the bed leveling should still be OK -- the bed height is not.

All in all, the difficulty to properly calibrate them, and keep them calibrated is a major reason why printers are not as mainstream as the hype likes to tell.

Common bed leveling mechanisms

You may want to skip this small state of the art if you already know this, before I talk about my implementation.

Historically, beds were first adjusted manually via screws and springs: the user moves the head over the bed at different places, check the gap and tune the screw so that the nozzle almost touches the bed. The goal is to leave a few tenths of millimeters. One classic trick is to sliding a sheet of paper between the two. Note that leaving any gap is arguable, but I understand that nobody wants the zero to be a real contact for security reasons. Leaving a safe tiny gap ensures that the nozzle never gets dragged on the bed accidentally. I do it also, but then the gap which is left must be taken into account for the first layer thickness in the object slicer. It would be better that the slicers sets this value, and not that we set the value in the slicer... Anyway.

First, better use a flat/planar bed!

I made an assumption here. I consider my bed to be a perfect flat, and this is mostly why I am using a glass on top of an aluminum bed. Having a perfectly flat bed is important, as nothing else than a complete probing may compensate a bent or a deformed beds. Given many height values, the firmware can compute and correct the 3D model in real time, so as to compensate for the surface irregularities -- we will see that again later.

As a side note, delta printers are beasts of their own: since the gantry provide no natural movement in the X-Y plane, a multi-point calibration is often required (check it with Marcus Littwin -- the author of Repetier, a slicer and firmware).

Manual bed leveling.

Bed flatness and bed leveling are two different things. You may have a flat bed (aka. a plane), but it may not be parallel to the X-Y movement of your head, which is our main subject here. Historically, bed leveling was done via a few mechanical systems.
  • 4 manual screws pull the bed down, and springs pushes it up. For example, the original Ultimaker had such a 4-point bed leveling , and I still see new printers arriving on the market with this very wrong design. Hey, a plane is well defined by 3 points, not 4! In fact, the fourth screw will always go against the 3 others... and in the worst case, you may even bend your bed surface if it is elastic enough (and then, no way you can print correctly).
  • 3 manual screws: this is the minimum you ought to have on a "modern" printer. And indeed, it is the most common system to level a bed. Actually, it may also be enough if your hardware is sturdy (or even expensive), or when the printer is not dragged here and there, when it is not subject to highly variable temperatures, and when your tool set does not change.
My former heated bed used a central elastic pivot point (made of half a squash ball), where
the front pair of screws pulled the bed downwards while the third one is fixed (not seen).
  • A smart semi-automatic bed leveling was made for the Kuehling & Kuehling printer. In this design, the nozzle pushes the bed down to compress the springs to a known height, and only then thumbscrews are used to lock the height (note that the thumbscrews could be activated automatically themselves).
  • A similar idea was done by Scottbee and featured in hackaday, as a fully automated system. Sadly, I did not hear much about this system. But the idea is there.

Automatic and semi automatic bed leveling

Next came printers with heads equipped with a sensor to record (aka to "probe") the bed by moving closer enough so the sensor triggers.
Contact probing and flatness compensation on a delta printer
by the legendary Johann Rocholl, on his mini Kossel

  • Contact probes were first tested, where a microswitch or an infrared barrier is indirectly activated when the probe gets in contact with the bed. The problem is that either the probe or the nozzle must be in contact with the bed, and not both for obvious reasons. Hence, a servo motor or a a solenoid, is often used to deploy and retract the sensor, so that it protrudes below the nozzle during the calibration.
By knowing the "constant" difference in height between the probe and the nozzle (so called "Z offset"), the firmware knows how far and unlevel the bed it. The tricky part here is "constant", which may not be so constant as we will see in a minute.
  • Contact-less probes are often better, not only because they no more require a heavy, complex and often unreliable mechanical deployment system, but also because they are immune to wear (like infra-red diodes or hall-effect sensors), or even to dirt (like inductive sensor, as commonly used on dirty CNC machines). They are also lighter than contact probes and need less cabling (no need to move the probe in and out of the way).
Contact-less inductive sensor: a howto and an example.

However, inductive sensors require a close metallic bed to trigger and they may be subject to electromagnetic noise. Infrared or hall effect sensors precision is often poor: the triggering distance is not reliable enough. This also depends on the price and sensor you can afford of course.

Note: many if not all firmwares already support probing, with or without automatic retraction. In case of Marlin you have to tweak the configuration somehow and recompile the firmware, which may get tricky (just to get the correct branch...). More advanced features are also supported such as the "matrix probing" (probing is done in many poinst so as to correct non-planar beds -- which proves to be extremely useful for Delta printers when their arms are not perfectly identical).

Now, probes that are attached to the head will add weight to the head. This is detrimental to speed or quality as more inertia is more trouble. Even fixed probes like inductive sensors are often bulky: they may reduce the number of objects that can be printed serially on a bed, since the head need to move around formerly printed parts without knocking them down.

Z-offset: an issue with the usual bed leveling systems

A professional tool changer (ref.).
See how no tool ends at the same height?
In any case, two problems remain with the above systems. Even when the bed is level, two other factor may impact the print.

  • heat expansion: when the bed heats, it often expands a bit vertically, especially when it embeds an aluminum plate (which I would recommend to homogenize the heat). Without a sensor, most existing systems will not take this into account, so they better be set after the bed is hot.
  • reciprocally, helping calibrate the tool height is something almost always forgotten in the 3D printer world as for now! But the distance to the bed also changes each time a nozzle or a complete head is changed (possibly for dual heads, but also for manual head changes). Each tool has its own "Z offset".

A remark on dual head setups

The excellent BCN3D dual head setup I discovered as
a moderator at the 3D Print Show Paris 2015
All in all, manual alignment of the heads is both difficult and extremely non user-friendly, to a point it took years for printer manufacturers to propose reliable dual head systems. In fact even single-headed printers require regular re-calibration, possibly each week or month at best as said by the Kuehling brothers (and even though their printers are really good pieces of engineering -- not low cost repraps).

Back to dual heads: say, if the nozzles are not exactly aligned, or if one oozes a bit before it cools down, then it will kick the part being printed by the other nozzle. Vertical alignment of the nozzle outputs must be achieved to less than a thenth of millimeter. Manually, it is almost impossible without some help from the design itself (e.g. sliding the entire barrel up and down in an Ultimaker or in a Kraken is quite hard).

Designers now often dissociate the heads to reduce the problem drastically, as shown above in the BCN3D printer for example. But the head nozzles still need extremely careful vertical adjustment, just as with more or less usual multi-nozzle hot ends.
The Kraken by E3D. Four hot ends to align perfectly!

In deeper trouble now: forthcoming tool changers!

Automatic tool changers are devices that let the machine change its tool without any user action, most often within the job.

Some high-level CNC milling machines featured tool changers for years already. The need was high for these, because a single work session requires many different tools (e.g. milling a path on a PCB with a V-bit, then drilling the holes with different diameters).

But nowadays, the need to 3D print with different material is also becoming important, and soon compulsory. So 3D printers will soon requires tool changers aswell.

A very few people already tackled the subject. Most notably to me, the prolific Markus Seidt (aka wokbrenner or foehnsturm) did this oustanding combined printer/polishing machine:

An outstanding automatic tool changer for an Ultimaker by Markus Seidt.
This is one of the earliest designs for a 3D printer and it relies on magnets.

The so-called tool "Z-offset" is most probably computed once, manually, and then given to the machine so it adapts the height according to the tool in use. It is somehow easier when the tools are the same as above, and when the tool holder grabs the heads is a very repeatable way.

Bed adjustments with sensors on the bed.

The other major option is not to carry the sensor on the head, but to keep it in on the bed. This results in less visible/moving cabling, and less weight to carry (both are a good thing).

On CNC milling machines, a contact switch is usually placed on the bed, and the head is then lowered until it touches the probe. Often electric conductivity is used for a very high precision (check this small instructable for example, or see the video below).

Zeroing a CNC with a probe (and and electric contact)

But these are still all manual operations: forgetting them, or failing to do it properly will break the bits and ruin the work. The damage is lower on a 3D printer compared to a CNC mill, but it still means failed prints and wasted time, and angry users.

Zeroing a CNC is often achieved by sensing an electric contact. On a 3D printer though, the milling bit, the printer nozzle, or the bed itself may not be conductive -- or more exactly no electric path can be made from the nozzle back to the bed. The electic contact probe could be made with a reliable microswitch, but it would gather dust, oozed plastic, and it will be a problem very quickly if it is left in place.

Automatic bed leveling with permanent sensors inside the bed

Manual procedures may help with automatic tool changer only when each of the tools are pre-calibrated and the mechanical tool holder is very repeatable (and better not mix the toolset).

Finally, locking a tool in place is hard to achieve without tiny and non-repeatable errors, which in turn leads to irregular heights or lack of precision. On CNC mills, it is probably even impossible to adjust the drill bits properly as the smaller ones can be swallowed completely in the collet chuck.

No... the real deal would be to detect the exact time when any tool that gets lowered gets in contact with the bed, because we would not only be able to tram the bed nicely, but also to compute the proper Z offset for the tool.

We have seen that relying on electric contact of the nozzle on the bed is possible only with bare aluminum beds and conductive hot ends. Moreover, a 3D printer heating cartridge is often driven with PWM, which generates a lot of electric noise and may pollute an electric signal.

And anyhow, our bed may be coated or covered with a glass plate, so it is not conductive. Period.

So far, I have never seen someone using retractile sensors on the bed itself, where a servo motor would slide or pop sensors in the corner of the bed for the head to go a touch them. I guess it would be much too complex to get something reliable (and I am not even considering the complexity).

Could we sacrifice a small surface of the bed, with protruding sensors? Why not... but it gets impractical as soon as the bed can be removed (a desirable feature). And the sensors probably get exposed too much, especially with a heated nozzle moving around.

Or again, may be the head could move out of the bed to probe a fixed sensor (only to compute the tool height). But sacrificing any part of the printable surface for calibration is a pity.

So... could sensors be embedded in the bed, or under the bed instead?

Yes. And there are different options, like having a magnetic field sensor under the bed, and a magnet glued close to the nozzle. Now, for the same reasons as above, I tend to favor mechanical contacts over distant field sensors, as the formers leave no fuzziness on the measure.

So what kind of sensors? The most interesting to me are pressure-sensitive ones. They can "feel" when the nozzle enters in contact with the bed, i.e. when it starts pushing it down. Of course the sensor need to be fast to react, and sensitive enough to get the signal before the nozzle breaks anything...

Sensitive load cells may be an option, even though their signal is slightly more complex to analyse and they require amplification and proper calibration. For bed leveling, most of the load cells are also probably unsuitable because of their bulkiness and weight range. Still, Airtripper, as an another and early hacker god, used some to experiment with filament force sensors

Piezoelectric sensors are also an option. These generate (high) voltages when squeezed, but they only react to changes in pressure (i.e. they at zero volt under a static load). A good read about the pros and cons of piezo sensors for bed leveling can be found in this thread.

So far and in my opinion, a promising kind of sensors are FSR: Force Sensitive Resistors. As they name suggests, they are resistors that change with the applied pressure. Their main drawback is their price, unless you make them by yourself (easy, but I suspect the foam may wear out quickly as it is not intended to be squashed repeatedly contrary to FSRs).

And... without much surprise, a few people already tried FSR to help with the bed calibration on a 3D printer. The video below shows them used on a delta printer. The FSR are the 3 round sensors placed just below the glass plate.

Unsurprinsingly, Johan Kossel again:
bed calibration using force sensitive resistors.

FSR are also what we used, and the complete setup will be documented in depth in the second part of this post.


Bed tramming and tool height detection... lots of options, eh?

But in any case, I am sure that automatic probing will soon become a must for user-friendly machines (for 3D printers as much as for CNC mills).

As for now there are four main options:
  • tram the bed manually, with springs and screws
  • probe a static bed and compensate with the software (deform the printed object accordingly)
  • design an extremely sturdy printer that need only calibration once before it is sold (costly)
  • automatically tram the bed with help of an automatic probing, and 3 actuators
Only the last option solves both problems at once, which is very important as soon as the printer's heads can be changed. And 3D printers with tool changers are a near and very expected future in my opinion.

Time to switch to my own bed ;)

A Force Sensing Resistor (FSR) on a hidden plate in the bed. Its resistance varies with pressure.
It is used here for an automatic 3D printer bed leveling system (and, yes, my plate is rusty).

About Me

My photo

If you know me and you cannot tell exactly what my real job is, then you probably found the right Jeremie. Check for some pointers.

I am self-employed and I help start-ups, research centers, small companies with their needs related to computers, sensors, data processing and mechatronics. If you have a project and know what "R&D" is, then you already sparked my interest ;)