Welcome! Log In Create A New Profile


Report on under bed sensor problems

Posted by leadinglights 
Report on under bed sensor problems
January 11, 2020 10:52AM
I have been looking at some of the problems experienced by some users of piezoelectric discs used for under-bed leveling in 3D printers. Problems have been reported by experienced builders of 3D printers with knowledge of both the mechanical and electronic design so it seemed likely that the cause of the problems would be obvious.

I think I have run the causes of the problems that people have been experiencing to ground – though it has been quite a detective story.

I present below exhibit A: a series of plots set against the bed of my printer. Each plot shows the memory of the values stored in the buffer of the conditioning circuit for 128 readings over 32 milliseconds. The marker with the label “Contact” shows the point at which the nozzle met a contact plate directly below it. The time between the first contact and the detection of the event by the conditioner circuit is about 27 milliseconds on the front left corner but about 8 milliseconds at the bed centre. As the nozzle speed was 2 millimetres per second this means that the travel after initial contact spanned from 16 microns to 54 microns. A difference of 38 microns would be unacceptable with layers of less than 0.1mm – since this is a printer made with fanatical attention to detail other printers might just fare even worse.

To explain what is going on here, may I direct your attention to exhibit B: A reconstruction of the print bed as seen from the side. There are only two sensors shown in the interest of simplicity.

When the nozzle strikes the bed the piezo disc below the sensor has the pressure on it reduced – this was the design intent and it works as planned. Unfortunately, the bed acts as a lever with the centre of mass of the bed as a fulcrum and the piezo disk on the opposite side experiences an increase of pressure

Exhibit 3 shows the output from the three piezo sensors and a sum of the three outputs. This diagram needs a bit of explanation as it contains a bit of fiction and artistic license. The three piezo traces are from the buffer memory of three conditioner circuits and a record of 128 samples immediately before data collection stopped. The blue trace is from the right hand piezo and the conditioner responds when a certain condition has been met i.e. when it would normally respond when a contact event has occurred. The signal from the right-hand conditioner is used after a 5 millisecond delay as a signal to the back and left-hand conditioner to stop also and the data from all three are harvested. Since the back and left signals are delayed they are plotted as shifted along by 5 milliseconds relative to the first trace and a sum of all three has also been plotted.

The fiction mentioned above is in that an additional 8 readings (2ms) have been tacked onto the end of the blue (left piezo) trace and represent a continuation of the trajectory. This is approximately what does happen and helps to illustrate the summed waveform. The timing and general shape of the waveform is very close to what is seen in the first diagram.

A diagram of the interconnections on the test rig are shown below along with a photograph of the same.

Although not conclusive or even complete, perhaps this will give anybody else using piezos or other underbed sensors some idea of where to start in working around the problems which arise if a good accuracy is to be hoped for. I would point out that in the first diagram, with the contact pressure set very high, that triggering spanned about 36 microns – bad but not unusable. If the noise band is small enough then a spread of less than 5 microns is quite achievable.


Edited 2 time(s). Last edit at 01/11/2020 11:11AM by leadinglights.
Re: Report on under bed sensor problems
June 24, 2020 06:18PM
Hello Mike

Found your post interesting, what is the z axis calibration in your chart? II assume that the printer is a delta from the photo that was included. I did a number of repeatabiliy tests using the Precision Piiezo production electronics with the piezos nested in the center+/- of a rectangular bed, the piezos ranged from the smallest-10mm to the largest 40mm all mounted under bed. the tests were conducted on each size piezo diameter. The published resonant frequency for each size was (from memory) 10mm- 10kHz to abt 800 Hz for the 40mm one. My conclusion was to use the smaller disks in order to minimize low frequency pick-up. I was not party to any discussions at the time, several years [email protected] received all of my data at the time and working with his delta , using multiple piezos. I found in my tests the underbed mounting ideal. The contact point underbead was through an insulating blanket, promptin Idris to claim that my setup was using the Piezo as a "microphone" I left the scene following a stroke, and am back now with some limitations- and in the process of building a delta Rostock Max V3.2 , featuring the Duet 32 bit board with the effector based on the smart design

So in your chart the traces represent a pickup by the others in the printer?

Re: Report on under bed sensor problems
June 25, 2020 02:23AM
Dear Mike,

I found your analysis very intesting. I did not understand every detail yet and will have to reread. But I have some ideas already, which I want to share with you:

Besides mass lever effect, I see other effects also, where I don't know how it contributes to the result:
- the natural frequency (eigenfrequency) of the aluminium plate could play a role, especially the transient response
- the springs and their oscillations could play a role. The left/right upper/down piezo elements curves are different, maybe due to differences of the springs/screws/...
- the piezo elements may be different

I wondered whether the analysis of all piezos together when a contact is done would get better results. Adding (or the emphasis of single elements) of all piezo signals e.g. may sum up the first big peak above the threshold and shortens the time.
If the curve at the position is known, it would be possible to correct the time delay and recalculate the measurement.
Another aspect would be analyzing the effect of diffferent springs, different speeds and materials.

Best regards, Joerg

Edited 2 time(s). Last edit at 06/25/2020 02:36AM by JoergS5.
Re: Report on under bed sensor problems
June 26, 2020 08:30AM
A true luxury of questions. I will do my best to answer all of them.

  • The Z-axis is not shown on the chart and the Y-axis is in ADC counts. Having said that, with a Z speed of 2mm/second the 32ms X duration covers a Z travel of 64µm. Z drive is from a 0.9° stepper driving a 1mm pitch lead screw with anti-backlash nuts.
  • The printer is not a Delta but a slightly unusual Cartesian type where the bed moves in both X and Y-axes. This is to have the heaviest bits like multiple extruders where they are only required to move slowly. views of this printer in [www.youtube.com] and used as an engraver in [www.youtube.com]
  • The resonant frequency of a piezo disk is quoted with it in open air and retained only at the periphery. When it is clamped into an assembly it has less significance than the tuned frequency of a guitar string if the palm of a hand is rested against it.
  • In the first series of plots, all three underbed piezos are wired in parallel while the contact record is approximately in the position for each graph shown on the bed. the second set of plots, marked as Combined.png, shows the output from all 3 piezos along with a calculated sum. The calculated sum of the voltages and the measured values are tolerably close.

BTW, I have also fairly recently had a stroke but have the good fortune of having no residual deficit.

  • The interaction of the mass/leverage/elasticity of a plate held in 3 places and struck by a nozzle in a number of others is understandably complex and probably best done with a Finite Element Analysis package. The last time I used one of these was back when computers had green screens, an experience I would rather not repeat.
  • The natural frequency of a plate such as a printer bed is in the hundreds of hertz, say somewhere in the middle of a piano keyboard. That this is a cycle time some milliseconds should have warned me that getting things down to the hundreds of millisecondsEDIT: microseconds would be difficult - particularly when the sensors are inboard of the corners.
  • As the springs are held in compression and forces move through the piezo disk and mounting mechanism, only parasitic oscillations are expected from them and these only at a low level. I have tried to show this in the diagram below.
  • Piezo elements were closely matched on a jig made for this purpose.
  • The piezo element outputs are summed simply by paralleling them. The only purpose of looking at the outputs separately was to find where the error was coming from.

EDIT: I got a message that the text in the picture made no sense so I have replaced it - hopefully with a sensible one

The present status of this project, at least for this printer, is that I have abandoned multiple underbed sensors. I am using a single underbed sensor to detect nozzle contact and measure Z height at a single point. Bed leveling/compensation is now done with a sort of piezo/microswitch/semi_BL-Touch sort of thingy. [reprap.org]
For others though, I can only offer the following:-
Keep the positions of underbed sensors, Piezo or otherwise, at or beyond the edge of the bed
and remember that object lessons can be found even in the distant past.

The Rime of the Ancient Mariner
He went like one that hath been stunned,
And is of sense forlorn:
A sadder and a wiser man,
He rose the morrow morn.


Edited 3 time(s). Last edit at 06/27/2020 02:40PM by leadinglights.
Re: Report on under bed sensor problems
March 23, 2021 11:11AM
I have been looking at this again as I am doing some tests on my newest printer and have been annoyed that I couldn't really get to grips with the problem (Spoiler alert, I still can't, but results are intriguing)

Just to summarize what has gone before in this project: Underbed piezos are "Best in Class" as bed sensors if done correctly, but there are many ways in which they can be used incorrectly - in which case they really really really suck.

My current printer uses them incorrectly, with three sensors mounted in a triangle somewhat inboard from the edge of the printing area. The photo below shows the bottom view of the print bed and carriage

Recent progress on my printer has involved using a touch sensor mounted on the extruder carriage to map the bed. Think BLTouch, but with the printer heads being retracted instead of the sensor being extended. Once I had this running, I decided that it would be possible to map the relative sensitivity of the bed across its surface. To this end, I put new, selected piezo disks in each of the three underbed sensors and did a comparison using the Repetier bed height map tool first with the touch sensor and then with the three underbed sensors.

Results were that the map was similar to that achieved in the run mentioned earlier in this thread except that I was checking over many more points - 4 runs each of 64 points (8 X 8 grid), each run being slightly displaced to give 264 data points. The errors relative to the touch probe were that near the sensors were pretty good at 3 to 5 microns, but far from the sensors, the errors rose to about 50 microns although even this was pretty chaotic, with 10µm errors just 5mm away from the 50µm errors.

The test that made it really suck was when I deliberately replaced one of the sensors with one that was 25% more sensitive. Despite the greater sensitivity, there were points on the bed where it was not possible to detect a nozzle contact. Changing the nozzle speed from 1mm per second to 5mm per second only moved the areas of insensitivity, it did not eliminate them.

There are two takeaways from this: It can be done properly. The Delta printer below detects a contact repeatably within 5µm of actual contact. The sensors are mounted on the periphery of the print bed.

The other takeaway is that no underbed sensor is immune to the problems I have experienced here and that positioning of the sensors is critical

Re: Report on under bed sensor problems
March 29, 2021 12:14PM
Mike, I have an under bed piezo sensor on my delta, of a completely different design. I sure wish I could attach my notes or pictures, but the forum keeps complaining that they are too large (although they are not). I'd even be happy to send you a sensor if you're interested.

Re: Report on under bed sensor problems
March 29, 2021 02:17PM
Hi rq3,
I am not sure of the limits that the forums software has on size, but I think that it is 800 kilobytes, not 8 megabytes as advertised when you try to attach it.
For pictures, I typically use old-fashioned Windows Paint to reduce them. Paint is now found in the apps tray under Windows Accessories. Just open the (.jpg, .png etc.) anduse the size button to change it to a reasonable size - even 640 X 480 is usually quite acceptable on a forum posting, then re-save the file under a new name.
For Word files, I think that saving them as .docx instead of .doc will dramatically reduce the size. Other ways are to edit photographs in the files to reduce them to an acceptable minimum size..

I am always interested in seeing other bed leveling sensors - but beware as I am not above pilfering others' ideas.

Re: Report on under bed sensor problems
March 29, 2021 07:55PM
Mike, I managed to post the docx file in its entirety on thingiverse:

The basic idea is not new, and in fact is how automobile engine knock sensors work. Feel free to leverage as you see fit.
I'm surprised that apparently this hasn't been stumbled across in the printer community, and I'm shocked at how well, and easily, it works.
Again, I'm happy to send one along if of any use to you.


Edited 2 time(s). Last edit at 03/29/2021 08:02PM by rq3.
Re: Report on under bed sensor problems
March 30, 2021 05:33AM
Hi rq3,
I read your document on Thingiverse with great interest. It is obvious that you have put a great deal of thought into the subject and I can't find any significant problems. In particular, the idea of filtering out high-frequency vibrations and most of the first order acceleration component is new, as is the use of a mass attached to the piezo sensor to affect some of this filtering.

Having said that, I can see some possible problems allied to ones that I have experienced. The following applies to underbed sensors only: I know of no equivalent for in-probe sensors - although it does not mean that some boojum does not exist somewhere. Also, there is nothing miraculous about piezos, or any other type of sensor that will render them immune to these problems.

Primary amongst these is the fact that a build stage is dynamic and the movement that a sensor will be looking for can be different in different areas and can be chaotically unpredictable in some areas. This can be most clearly seen on something called a Chladni plate or sand plate and trivial differences of frequency can have major changes in areas of insensitivity.

A second effect is based on the fact that piezo disks can act as pyroelectric generators, responding to changes in temperature in an equally surprising sensitivity. This can affect the offset of the sensor and cause unexpected changes in response.

You can make an underbed sensor and check it for response every square millimeter of the surface and find no faults, but when you change the dynamic only slightly, a new build surface for example, you can find the nozzle grinding into the bed without triggering the sensor. Even worse, you can publish your design and have it copied by many readers who follow your plans almost to the letter, only to find some of them getting angry because they kept damaging nozzles and build stages. Worse still when you have an argument with a correspondent who you had been on very good terms only to end by calling them a blithering idiot - I have been there.

Out of simple interest, I would like to see the source code for your Picaxe MCU Edit: Woops!! I didn't see the code at the end of the document, just assumed it was a bill of materials.
When my own latest source code is good enough to be seen in polite company I will publish it on Github.


Edited 1 time(s). Last edit at 03/30/2021 09:37AM by leadinglights.
Re: Report on under bed sensor problems
April 02, 2021 06:13PM
Mike, I hear you. My company manufactures aircraft avionics. 99.9% of my customers are terrific. The remainder have done things that make my jaw drop. And these are folks that are licensed by the Federal Aviation Administration (FAA) to install my products, and other products like them, on aircraft.

During phone calls my first question is always, "Did you read and understand the installation manual?". The only legally correct answer is, "Yes". We're talking aviation here. My next question is always, "What can I change in the manual to make it clearer?" Almost always I get crickets for a response, especially after I have walked through the manual with the customer over the phone. Once in a great while I get a good suggestion, and it gets into the latest revision of the manual, but that hasn't happened in many years. Which is a good thing, because the manual is approved by the FAA, and they have to bless any changes. It's time consuming.

The latest fun one was an installer who phoned to ask how to bench check the device. I ran through the simple process with him. At the end he remarked that the device was already installed in the aircraft, but he wanted to bench check it. When I suggested that perhaps he had is priorities a bit askew, he said that he couldn't remove it because, "I thought the connectors looked a little flimsy, so I hot melt glued them in place. I can't take it out." He even e-mailed me photos to prove it.

These are very expensive mil-spec connectors we're talking about here. Nowhere is there any mention of hot melt glue anywhere in my manual, or that of the manufacturer of the connector. Sometimes you just have to fire a customer. I suggested that he rip the thing out, and send it to me for a full refund, which didn't fly well with him because HIS customer (the aircraft owner) would NOT be happy. So I suggested that he have his customer call me so that I could tell him he should really, really, really find someone else to work on his aircraft. You can imagine how that went over, and left me in the position of trying to decide whether to report this yahoo to the FAA. I probably should have, but its a grey area and his actions weren't life threatening. This time. I haven't heard a squeak since then.

The joys of trying to make the world a better place.

Edited 1 time(s). Last edit at 04/02/2021 06:14PM by rq3.
Re: Report on under bed sensor problems
April 03, 2021 06:34AM
Hi rq3,
It may not have been apparent in my earlier posting, but I was the Yahoo. Let me explain, and perhaps clarify why I seem to be regarding it almost as a religious mission to tell everybody to take care with underbed sensors.

I fitted all of my own printers with variations of underbed piezo sensors. In every case the sensors were bulletproof and all reports I heard from others were the same. After a year or two I had heard of only a very few reports of failure, and most of these from people who misunderstood the operation of the sensor - typically floating the bed loosely on springs without any force transmission to the disk.

One email correspondent was not amongst the Yahoos but seemed to have problems of varying sensitivity. Both he and I had sufficient mechanical nous to be able to model the forces on the piezos and the mechanical and electrical response or the piezos. Despite this, I couldn't duplicate his results even though I tried to copy his layout - including the inward mounting of the sensors. In the end, we ended the correspondence on bad terms as I implied that he was just plain wrong.

It is only now that I know that the dynamic component can be more important than the static balance of forces and that if I had moved one of the sensors by a few mm then I would have seen the same failure to trigger.

My opinion of underbed sensors of any kind is now that you should mount multiple sensors at or beyond the periphery of the bed unless you are using only a single sensor to be probed at only one position on the surface.


Edited 1 time(s). Last edit at 04/03/2021 06:34AM by leadinglights.
Re: Report on under bed sensor problems
April 04, 2021 06:44AM
A further comment on the dangers of underbed probing.

Re: Report on under bed sensor problems
July 08, 2021 06:58AM
Just a quick report on the status of this investigation - for both remaining readers of this forum. I have now used a touch sensor on my old delta printer to demonstrate this problem even on a printer that has given very reliable bed leveling for many years with underbed sensors. On the diagram below, I leveled the bed first using the three underbed piezo sensors with probes at S1, S2 and S3, and using a 5 X 5 grid at the Red points on the diagram, errors were within 40 microns of flat. Changing to a touch sensor [reprap.org] I probed as close to possible the same positions. The points within the triangle agreed within 10 microns but on those outside the triangle, there could be up to 50 microns difference to the previous points as at point P1. Worse still, with some points on the bed outside the square there was a difference of up to 80 microns between measurements with each method.

To recap on previous findings.
  • There are two sources of the problem in underbed sensors: Dynamic problems caused by the difference in time between the pressure seen at each sensor and dynamic problems caused by different sensitivities of each sensor.
  • This problem is not restricted to piezo sensors although different types of sensors with different time characteristics will give different results, they will all suffer from some version of the above errors.
  • If the sensors are mounted substantially inboard of the periphery of the build stage the problems will be quite severe. Conversely, if the triangle of sensors encloses the whole of the bed, as in the blue triangle, then the errors become very small. A manageable solution can probably be found with sensors just beyond the edge of the bed.

Re: Report on under bed sensor problems
July 08, 2021 05:31PM
Mike, I don't know what printer firmware you're using, but if it's Marlin, there is an "interrupt enable" function that is disabled by default. If your control board can handle it (most 32 bit boards can), enabling the interrupt function eliminates, for all practical purposes, the delay between receipt of a signal and the controller's response to the signal. In other words, it does away with the delay and motor "coasting" effect.

On my under-bed piezo design, just enabling the interrupt function made a drastic (as in orders of magnitude) difference in the standard deviation of repetitive nozzle contacts wiith the bed. The absolute worst case SD I get is 3 microns, anywhere on the bed, and that is if I do a repeatability test while the bed is heating from cold to 60C. On the other hand, I'm not completely sure I trust Marlin's implementation of the test and its maths. I'm by no means a coder, but I mean to look into the base C++ one of these days.

As I've noted before, my sensor is a mass loaded piezo disc, and the entire assembly is glued under the bed. There just one, it responds to dropping a BB from one inch anywhere above the bed, and is insensitive to temperature changes and stepper noise and vibration. There are no springs, levers, or other extraneous parts, and no adjustments other than a one time software "set and forget" for sensitivity.

Just a thought.

Edited 1 time(s). Last edit at 07/08/2021 05:32PM by rq3.
Re: Report on under bed sensor problems
July 09, 2021 05:19AM
@rq3. Your mass-loaded piezo sensor may well avoid the problems that I have seen but it is not impossible that it will be troublesome on other beds - like areas that are completely dead. I was happy with my tests on my early printers until I drilled down in the elusive search to get triggering within 1 micron/1 millisecond/1 gram when I started seeing problems - then my newest printer gave me some clues that the underbed sensor that I used method had feet of clay.

One thought in passing is that there is a potential problem but also offers a potential solution. Since your sensor is quite dynamic it may fail to register a contact event if the nozzle is contaminated with soft plastic residues and you are probing far from the sensor. The solution is to first probe directly over the sensor. The piezo output wave shape will be much less sharp if there is plastic on the nozzle and software to detect this softness and stop the leveling should be fairly simple.

On the firmware front; although I only use Repetier firmware on a Mega2560/RAMPS combination, this seems to accept signals from my controller boards at somewhere in the few tens of microseconds. In all of the research, the controller board and firmware are only there to edit: lower the nozzle and then stop it in a reasonable time. The actual measurements are taken by entirely separate instrumentation - you can see some of this earlier in this thread, particularly [reprap.org]


Edited 1 time(s). Last edit at 07/10/2021 02:28PM by leadinglights.
Sorry, only registered users may post in this forum.

Click here to login