MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.16k stars 19.21k forks source link

[BUG] Command M402 stow and deploy probe randomly #23407

Closed saayalac closed 2 years ago

saayalac commented 2 years ago

Did you test the latest bugfix-2.0.x code?

No, but I will test it now!

Bug Description

When attempting to do bed leveling sometimes the prover does not behave properly. The probe deploys well, but sometimes when attempting to stow with M402, the probe stows and deploys again This it's problematic due the probe will hit the glass or the print and damage something

I measured the servo signal with an oscilloscope and I get the following signal (attachment), the PWM looks wrong It's worth to mention that the probe it's the following https://www.thingiverse.com/thing:3303618

Tested with multiple SG90 and the same problem, wiring, it's properly soldered

Bug Timeline

Don't know when it started

Expected behavior

  1. Auto home with G28
  2. Run M401
  3. Deploy probe
  4. Run M402
  5. Stow probe
  6. Repeat from 2 to 5 N times, all works as expected

Actual behavior

  1. Auto home with G28
  2. Run M401
  3. Deploy probe
  4. Run M402
  5. Most cases will stow, but randomly stows and then deploys but M402 does not respond anymore. Must use M401 and then M402 to fix
  6. Repeat from 2 to 5 N times, some random fails

Steps to Reproduce

  1. Auto home with G28
  2. Run M401
  3. Deploy probe
  4. Run M402
  5. Most cases will stow, but randomly stows and then deploys but M402 does not respond anymore. Must use M401 and then M402 to fix
  6. Repeat from 2 to 5 N times, some random fails

At least it works in my setup

Version of Marlin Firmware

2.0.7.2

Printer model

Ender 3 pro

Electronics

SKR 1.4 Turbo

Add-ons

No response

Bed Leveling

UBL Bilinear mesh

Your Slicer

Cura

Host Software

SD Card (headless)

Additional information & file uploads

Marlin.zip image

sjasonsmith commented 2 years ago

Try disabling DEACTIVATE_SERVOS_AFTER_MOVE and report back.

saayalac commented 2 years ago

Hello!

Sorry for the big delay.

I tested with your comment and it actually solved the problem, I understand that this it's due that the PWM signal keeps on all the time. This solves the problem, but I don't like the signal to be on all time. Do you have any ideas what could cause the original problem?

Thanks

saayalac commented 2 years ago

An update:

As I expected, testing with some prints, the probe in some random points started to deploy and stow, the oscilloscope shows PWM signal changing making the servo to change position. So DEACTIVATE_SERVOS_AFTER_MOVE it's not a reliable solution to me.

descipher commented 2 years ago

That's quite the noise pulse with servo detach on your scope, looks like the call for servo detach leaves the pin floating around. This could be the nature of the probe itself not having a signal clamp. What details can you give us about the probe. I will have a look myself since it's possible to resolve with a pin pull down config when the feature is in use.

saayalac commented 2 years ago

That's quite the noise pulse with servo detach on your scope, looks like the call for servo detach leaves the pin floating around. This could be the nature of the probe itself not having a signal clamp. What details can you give us about the probe. I will have a look myself since it's possible to resolve with a pin pull down config when the feature is in use.

Thanks for your help @descipher

I will try to describe my setup. I have an Ender 3 pro with a SKR 1.4 Turbo. The probe I use it's from this project (https://www.thingiverse.com/thing:3303618). The servo, it's a SG90 and the probe it's an optical sensor which it's triggered when a pin enters into it's sensitivity range. (The trigger works ok, the problem it's the servo).

The whole probe it's connected as shown in the following diagram. It's connected to the board with some jumpers, it's not soldered to the board, but the jumpers are properly connected and I have glued them to keep them fixed. image

The cable from jumpers until the servo and the probe it's properly soldered, there are no floating pins/cables.

I know, it looks a bit disorganized, but it's properly connected As I mentioned, I have tested it with different servos and all have the same behaviour. image image

Hope this info will help.

saayalac commented 2 years ago

any idea?

descipher commented 2 years ago

It's noisy, you may have to eliminate the noise. Proper motherboard, case and PSU mains grounding is where to start and or RC filter, Shielded wire, clamping diode, Inductive choke. Keep high current wires away from it, e.g. heater wires. It's also possible to keep the signal output active LOW instead of floating when the servo is disconnected but that's not an appropriate fix for other configs.

saayalac commented 2 years ago

Ok, makes sense, will check all wiring and case setup. Thanks

github-actions[bot] commented 2 years ago

This issue has had no activity in the last 60 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 10 days.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.