Proof of Concept: Using Accelerometer as Probe

Yesterday I had an idea that you can use the ADXL345 as a replacement for the Bltouch.

How should the whole thing work?

Well… When the nozzle moves down to the print bed, a vibration is triggered at the contact. This can be registered and you know when the nozzle makes contact with the printer. Accelerometers are very cool in general.

It has several advantages, but the biggest one would be that you work without offset to the nozzle, which is reflected in the accuracy.

Also, if you already have an accelerometer, you don’t have to buy an extra sensor or mount.

Here is an example taken with my cell phone, in the Z axis you can see how I lightly touch the table with my fingernail several times.

Ref to [FR] Use accelerometer as Z probe · Issue #3741 · Klipper3d/klipper · GitHub

1 Like

(1) The thing is, that the accelerometer measures ds/dt" meaning the change of speed change :wink: So this value is dependant to the velocity and this meens: the slower your “crash”-speed is, the weaker is the signal. In other words: If you move with let’s say 5mm/s down, it will be difficult to identify the contact especially if you use megnetic surfaces (witch are more or less soft).
(2) Another part is the overtravel: a mechanical sensor (or inductive, if you want to burn in hell) allows overtraveling the “right” position without any chrash szenarios. This is because of the reaction time the signal needs to be recognized and to stop the motors (some ms i presume). The accelerator sensor reacts on the crash itself and will penetrate the surface anytime using it (maybe only 1/10 of mm but see (1) you need some “speed”). So it is doable but dangerous.
(3) Solution: If you mount the ADXL to a pin (hold down by its own weight or a spring) and let this pin hit the bed, this could work. But I would never do the crash szenario! But (3) is very clumsy (size!) against other solutions. You may never integrate this in a voron (if wanted) unless you do your own mini-PCB (simple!).

Alternative: If you use Klicky-Probe, your hardware costs are some cents (if you slaugter an old filament sensor or end stop: 0€) and it is much more stable against process disurbances.

My suggestion: Try it!
If you think of something like (3) I see no reason, why it should no work. But think of the output: Your board wants an on/off signal and you will supply an analog value. So you need some software/hardware to “translate” a change-of-signal to an on/off signal (change-of-state, no problem, but you have to do). Maybe your cost-advantage shrinks and the Klicky-Probe solutions pays out quickly… How about accuracy and repeatability? You have to discover!

If you want to make the wolrd a better place (especially for 3D printing nerds) and squander some lifetime, include a lidar system to klipper.

I love this idea, and I would love to see more come of it. After all, there are printers that mount the hotend on a strain gauge to detect when the nozzle makes contact with the bed, and my gut-feel suggests that the adxl345 would be more sensitive.

Having said that, the link that @Sineos posted above highlights some real problems with the approach. The first thing that stood out to me from looking at the graphs was just how low the S/N ratio was, and that does not bode well for accurate, repeatable probing. I would suggest that if you pursue this (and I hope that you do), that you try to find settings that improve the S/N ratio. That would be my biggest concern. Also, it was also mentioned that any stray remnants of filament stuck to the nozzle would greatly affect accuracy.

But despite those concerns, I still love the idea :slight_smile:

I have now read through everything, also on GitHub.

The smallest problem that could have been solved was that the ADXL had to be mounted to the MCU. I would have left the sensor on the Raspi and connected the sample to the mainboard via the digital output.

The biggest problem I hadn’t thought of is that the filament residue and the PEI layer cause a soft “bounce”, which is indeed a very big problem. One solution would be to work with Tensorflow to provide a model for detection… But that would be already in the direction of research.

Generally with this method I would always install as a backup a limit switch slightly deeper than zero, that if the bed goes too deep no major damage.

Because of tensorflow… Here is an example on YouTube of how different movements can be recognized based on acceleration data

1 Like

I’ve been following the thread and it’s interesting but a couple of things.

  1. How does the accelerator differentiate between the collision with the build surface and say somebody walking by the printer (or worse, the printer is on an unstable floor or table)?
  2. Wouldn’t the action of the nozzle hitting the build surface leave a dimple? I guess it wouldn’t for glass (or would it) but I think there could be long lasting damage/changes to any other surface.

It’s an interesting project to try and I’m looking forward to your results but I don’t think it will be something that can be used by everyone.

@ mykepredko:

  1. The signal should be of different quality: since the Z-Axis “direct crash” would be mainly measured in that direction, other “noise” could have a completely different pattern since the acceleration should be not streight in Z-direction. But anyway: you need to program this! It is not easy, but maybe the “door slam”-acceleration is not that large…
  2. Definetely! You have to mechanical decouple the accelerometer from the contact itself (see (3) in my humple contribution).

@ SphaeroX:
Yes you can do. But it will take a year to implement if you want to identify the “movement-type” itself. The ADXL is a powerful device, but think: If your only tool is a hammer, everything looks like a nail. Check your point of view: Do you want to (a) do a new probe or (b) do you want to test, what can be done by using the ADXL? Both is a great project, but has different procedures: While you can “do-what-you-want” at (a) but you should check the requirements for (a) (=Why is the wolrd better, if you implement the new probe? What is the advantage of doing so against any established solution? Be an engineer!) :wink:

For me this approach has too many ifs and whens:

  • Especially lead-screws exert high forces very quickly → Every probing will flex and stress your motion system, rails, bearings etc. Hopefully only as elastic deformation but nevertheless it surely will experience some wear effects given time and repetition
  • Only works if the nozzle is clean
  • Probing with hot nozzle → I would not want to press a 260°C+ nozzle repeatedly on a PEI sheet

While surely being an interesting approach from the engineering perspective, the real world benefit is questionable (compared to a more or less dead simple and safe micro switch)

1 Like

SeeMeCNC tried this with the delta Rostock Max v3:

I tried using it on my v2 years ago and it never quite worked correctly. The biggest issue was repeatability as flex in the system (hotend, gantry, bed, etc) would change the accelerometer’s response. Not to mention, watching/hearing the nozzle hit the bed was anxiety provoking… is it going to stop? or is it going to crash?

The other consequence is that it would start damaging the nozzle. Even cold, the brass was soft enough metal that it would start to deform when hitting the bed (i was using a glass bed at the time). And a steel nozzle was stiff enough to chip the bed.

1 Like

i think we can utilize more than a single accelerator to rule out the errors.

for instance one mounted at the hotend and another mounted at the bed. you will have something to compare against. if both the bed and nozzle generated some kind of (matching?) vibrations at the same time, then it is a positive, otherwise it is a negative.

i think we can utilize more than a single accelerator to rule out the errors.

Yes you could do so (long answer: no, it will not work, because…). But why? The Klicky Probe is reliable, proofen, more or less stable against external attractors, extremely cheap, already implemented and has the side effect, that cou can change to any nozzle in 1 minute beeing ready to print if you use Auto Z-Calibration. What are the arguments for a double ADXL-Solution? :thinking:

Your approach is great but I see it like Berggipfel. If you install a second or even more sensors, then I can also use my BlTouch for this.

the thing with accelerometer is that, it is multi-purpose, lightweight, no unnecessary mounting/unmounting actions, quicker, occupy almost no space on the printed (also, the parking space also takes up significant volume in the printer, if you want a much compact design, it is not possible with a detachable probe). it just starts right away without the need to grab/deploy the probe, compared to conventional probes. depending on the setup (i3 with moving beds), your bed might already need an accelerometer, if it is always mounted it will be easier for input shaping calibrations too.

There is one big drawback to this method. I’ve been using this method (with a piezo sensor ) for a year now with great results, however, you must keep the nozzle clean when HOMING or an ABL. Any oozing or any crud on the nozzle will effectively generate a new Z Offset and throw the print off. Other than that it works fine with Marlin and is very accurate and repeatable. The next step would be to capture this generated trigger as a Z axes ENDSTOP. Good job.