1 (edited by elenhinan 2015-03-01 00:06:41)

Topic: Auto-bed leveling with piezo sensors on bed

I've wanted to add bed leveling to my setup for a while, but it was only a week or so ago I solved all issues with my z-axis (ballscrew, other post here) which made me feel it was time to look at the auto-leveling again.

I've fought about a couple different solutions, mostly micro-switches and capacitance sensors. Micro-switches needs a servo or other mechanical device to but it in place, which is a pain to get accurate and repeatable (I can imagine).
Proximity sensors (capacitance and inductive) are temperature dependent, and also are somewhat large (relatively speaking).
Also, both solutions measure the distance between the the sensor and the bed, not the tip of the hot-end.

So I wanted to measure when the hot-end actually touches the bed. Either I would have to add some sensor to the carriage (which I could, but would make the carriage more complicated mechanically), or to the bed.

Since the bed is held by three screws and three springs, One can either try to measure the force of the screws on the bed or the springs on the bed. Or on the bed holder. The size will be the same, but the direction reversed. Doesn't really matter.

Measuring force can be done a lot of ways, but I figured a really sensitive way would be to use piezo electric elements. By measuring the charge emitted/absorbed from these, the force acting upon them can be measured.

The idea is to place one piezo disc under each spring, measuring the force acting downwards. Normally this will be the spring tension + the weight of the bed. When the hot end touches the bed surface, this will add to the force acting on the springs, compressing the piezo and emitting a small charge. Using a charge collector op-amp circuit, the force acting on all three piezo sensors can be turned into a voltage. The DC component (that is, the static force) cannot be measured this way (due to leakage in the piezo element), but this doesn't matter since we're not interested in this, only the change (AC) when the hot end touches the bed. Adding some further (both low-pass and high-pass) filtering to the circuit, we can filter out mose unwanted noise (EMI from the steppers/drivers/heating cartridges) and vibrations.

This is still in a beta fase, but I now have a working system up and running using a breadboard and the first edition of some printed parts.

Using the G30 command, I get great repeatability:

00:09:42.687 : Z-probe:2.70 X:160.00 Y:160.00
00:09:44.126 : Z-probe:2.70 X:160.00 Y:160.00
00:09:45.430 : Z-probe:2.70 X:160.00 Y:160.00
00:09:46.797 : Z-probe:2.70 X:160.00 Y:160.00
00:09:48.181 : Z-probe:2.70 X:160.00 Y:160.00
00:09:49.468 : Z-probe:2.70 X:160.00 Y:160.00
00:09:50.843 : Z-probe:2.70 X:160.00 Y:160.00
00:09:52.210 : Z-probe:2.70 X:160.00 Y:160.00
00:09:53.593 : Z-probe:2.70 X:160.00 Y:160.00
00:09:54.944 : Z-probe:2.70 X:160.00 Y:160.00
00:09:56.184 : Z-probe:2.70 X:160.00 Y:160.00
00:09:57.431 : Z-probe:2.70 X:160.00 Y:160.00
00:09:58.662 : Z-probe:2.70 X:160.00 Y:160.00
00:09:59.941 : Z-probe:2.70 X:160.00 Y:160.00
00:10:01.269 : Z-probe:2.70 X:160.00 Y:160.00

I'll do some more tweaking to the mounts I use for the piezo discs, and the circuit needs some work as it needs some tuning. I would say that all parts used are really cheap, and available from sparkfun. The op-amp isn't really the best for this job, and I would have chosen a different one if I had one available. But I used the one they had at sparkfun, thinking if anyone else want's to do this mod it will be easier to order everything from one vendor.

Uploaded a youtube video to demonstrate.

edit: The probing speed is rather high, as this creates a sharper signal from the piezo elements. Slow probing = slowly rising signal = less accuracy. To high probing speed and z acceleration can trigger the sensor due to the intertia of the bed.

Post's attachments

bed-height-map.png
bed-height-map.png 42.16 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.
Solidoodle SD4, Ramps 1.4, 4x DRV8825, 16V 450W PSU, MK3 alu heatbed /w glass
E3D v6, bowden feeding, airtripper extruder, mk8 gear.
LM8UU X & Y carriages. GT2 belts and pulleys, bearings on all axles.

2

Re: Auto-bed leveling with piezo sensors on bed

Very nice work!  Personally, I have experimented with both probe and FSR based autoleveling and found both to be unacceptable.  So if this catches on, maybe I will finally go with autoleveling.  IMO- probes are too hard to calibrate and have repeatability concerns.  FSRs are extremely difficult to calibrate and suffer from false triggering if there is virtually any friction in your system.  I found this to be true whether they are placed under the bed or the print head.  Did you have any issues with the sensors sticking in the open or closed position when you did not want them to?  That is the biggest obstacle to autoleving, IMO.

SD4 w/ RUMBA, E3D Volcano, all bearings, glass bed

3

Re: Auto-bed leveling with piezo sensors on bed

Thanks smile I read about FSR some time ago, but was put off by the low sensitivity (100g weight to trigger I think). But that was with passive electronics. And they're temperature dependent as well. I would be interested in your experiences with them.

Status update:

As of now, it works. Kind of smile As the video shows it works quite well when everything is set up properly, but there are some issues yet that I'm working on (I have at average 30 min tops to work with this, between all my other duties, so it might take some time). I am positive I'll solve them though, but I'd rather try and fix them before making a circuit and BOM available, to prevent people wasting their time on an unfinished design. For people more technically inclined I can make an exception smile

* Sensitivity. They are very, very sensitive. Right now the circuit is just an op amp as charge collector, with high and lowpass filtering, with output fed into a comperator. The comperator uses a 10k potmeter as a voltage divider between VCC and GND. With lowest possible threshold, the LED flashes when I breathe at the bed surface. Obviously, this triggers the circuit whenever a stepper moves, so the threshold needs to be adjusted up. I'll add some resistors so I can fine tune the threshold voltage more, because now it's very coarse, making it very random if a small change in the potmeter will make the system better or fail spectacularly.

* Noise. Without any low-pass filtering, the circuit would trigger all over the place when the steppers were energized. After setting the low pass freq to ~300hz, these problems went away (as the steppers PWM freq is ~20 kHz). The problem now, however, is that the hotend pwm output runs at 63 Hz, with wires directly next to my thin wires to the piezo discs. At high current. So the circuit freaks out when the hot-end is turned on. This can be solved in a couple of ways. I guess I'll try first to shield the wires, and perhaps also the circuit (which is on a breadboard now, making it difficult). If not, I can just make a script to heat up the bed and hot end, turn off the hot end while probing, and back on again.

* Left side of bed was less sensitive than the right at some times. I've made new ABS mounts and done some changes to try and prevent any binding, I'll see if they fix this. There shouldn't be any way for a force to be directed towards the bed without going through the piezo discs now.

* Sensitivity again. I want the sensors to be sensitive, but at the same time I want to move the z at about 5mm/s to get a good signal (2mm also works though, I guess one should experiment a bit). Since the circuit has a high pass filter of about ~3 Hz, any static or slowly increasing force will be attenuated. However, the acceleration to 5mm/s can cause the circuit to trigger on the force from the inertia of the bed. This can probably be fixed with a script setting the z (and xy) jerk to zero, and acceleration low like 30 mm/s^2. And after probing, setting them back to their normal values.

I did a test run just now when printing out new improved holders for the piezo elements:
20:50:34.083 : Z-probe:2.88 X:50.00 Y:50.00
20:50:37.361 : Z-probe:2.83 X:150.00 Y:50.00
20:50:40.895 : Z-probe:3.24 X:100.00 Y:150.00
20:50:41.592 : Transformation matrix: 1.000000 0.000002 0.000437 0.000000 0.999993 -0.003862 -0.000437 0.003862 0.999992
20:50:41.592 : Info:Autoleveling enabled

As can be seen, the table is really off (by purpose). I made a small video showing that it works fine. It There's a small amount of under-extrusion at the right side, but this is not caused by the bed leveling but is caused by the bowden setup, which is a separate issue I'll tackle some other day.

Crappy video showing the z moving while printing, and that the first layer isn't completely hopeless.

Solidoodle SD4, Ramps 1.4, 4x DRV8825, 16V 450W PSU, MK3 alu heatbed /w glass
E3D v6, bowden feeding, airtripper extruder, mk8 gear.
LM8UU X & Y carriages. GT2 belts and pulleys, bearings on all axles.

4

Re: Auto-bed leveling with piezo sensors on bed

I'll check and see if I can get some thin coaxial cables at work tomorrow, or maybe borrow them from an old headset. That might decrease the noise picked up by the wires.

Solidoodle SD4, Ramps 1.4, 4x DRV8825, 16V 450W PSU, MK3 alu heatbed /w glass
E3D v6, bowden feeding, airtripper extruder, mk8 gear.
LM8UU X & Y carriages. GT2 belts and pulleys, bearings on all axles.

5

Re: Auto-bed leveling with piezo sensors on bed

elenhinan wrote:

I'll check and see if I can get some thin coaxial cables at work tomorrow, or maybe borrow them from an old headset. That might decrease the noise picked up by the wires.

RG174?

SD3, Lawsy Carriages with GT2 belts on x axis, BLTouch, Bondtech BMG extruder, E3D v6 via bowden, MIC6 bed with 200W heater w/SSR relay and a RUMBA controller

6

Re: Auto-bed leveling with piezo sensors on bed

elenhinan wrote:

Thanks smile I read about FSR some time ago, but was put off by the low sensitivity (100g weight to trigger I think). But that was with passive electronics. And they're temperature dependent as well. I would be interested in your experiences with them.

My issues with FSRs was not that they took too much force to activate, but that within the constraints of 3D printing, the force was not reliably directed to the FSR enough to trigger it.  When I put them under the bed (on a delta type printer), the nozzle would slam into the bed and the motors would skip before the FSR was triggered.  This was because the bed must be securely held in the X and Y in order to print quality parts, but it must have very easy movement in the Z to allow the FSRs to trigger (and not get stuck in the triggered position).  Now, I was using a hand cut piece of circular glass that I cut with a compass cutter and printed bed holders, so I think if you had laser cut glass or something to ensure a more perfect circle and injection molded bed holders that were very precisely held onto the frame to be neither too loose or tight then you might have a better time.  Putting them in the print head held down with springs has similar issues.

I'm not saying that FSR's don't work.  You can go on youtube and find people who are a lot better than me and have made them work.  I'm just saying that they are very difficult to get to work reliably.

SD4 w/ RUMBA, E3D Volcano, all bearings, glass bed

7 (edited by elenhinan 2015-03-03 22:49:57)

Re: Auto-bed leveling with piezo sensors on bed

I've added it to thingiverse smile

mloebl wrote:

RG174?

Thanks, had no idea for names of any small coax. I'm used to work with them, not buying smile

Found some cheap rg316 cables with male SMA and female panel mount SMA connectors pre-installed for cheap on ebay. I guess it'll be some weeks before I see them. Although, after cleaning up the breadboard and switching the hot-end pwm frequency from 15 to 61hz I do not have problems with interference (right now at leasT). Maybe I'll get around it without shielding smile As I want the design to be as simple as possible so people can easily adapt it, this would be a good thing.

Anyway, back to progress. I made the breadboard layout a bit less like a nest of wires and resistors, and drew the schematic up in cadsoft eagle. It's far from a perfect design, with dc bias drift, no adjustable amplification and so forth. I want to add a second dual opamp to use for bias reference voltage and adjustable amplifier between the charge collector and the comparator. But I'm short some capacitors for AC coupling each stages sad I'll see what I can do. Without an oscillioscope it's a pain to debug as well.

Also found a flaw in my mechanical design. I use a single bar in front for both piezo discs. Depending on how much I tighten the screw holding it down, one side becomes more or less sensitive than the other. The lone disc in the back works fine. So I'll print out some new ones keeping the two front discs independent of eachother. In the meantime, I'm using the auto-leveling as is smile

After cleaning up the breadboard, setting max z travel acceleration to 30 mm/s^2 and 0 mm/s z jerk, it seems to work fine.

It's still very much a work in progress though. But I'm confident it's at the point where it works well enough that any issues should be rather easy to overcome with some research smile

Solidoodle SD4, Ramps 1.4, 4x DRV8825, 16V 450W PSU, MK3 alu heatbed /w glass
E3D v6, bowden feeding, airtripper extruder, mk8 gear.
LM8UU X & Y carriages. GT2 belts and pulleys, bearings on all axles.

8

Re: Auto-bed leveling with piezo sensors on bed

Excellent work!  I'm looking forward to updates on this one.

Has anybody added the height map feature to Marlin?  What would it require to do so?

SD3, RUMBA, 360W power, ABS: Glass bed + Aquanet Extra Super Hold Hairspray, Anti-backlash Z spanner, Repetier Host + Slic3r

9

Re: Auto-bed leveling with piezo sensors on bed

I love playing with sensors and saw this article on hackaday that may be useful for this project.

http://hackaday.com/2015/03/16/instrume … le-change/

SD3, RUMBA, 360W power, ABS: Glass bed + Aquanet Extra Super Hold Hairspray, Anti-backlash Z spanner, Repetier Host + Slic3r

10

Re: Auto-bed leveling with piezo sensors on bed

elenhinan, do you have any progress with your piezo sensors?
We want to cooperate with you and complete this as a finalized opensource project.

11

Re: Auto-bed leveling with piezo sensors on bed

Hey @Elenhinan, did it finally work out? I am curious about the repeatability of this solution.