HAL component for DC motor runaway protection

More
4 years 4 months ago #244656 by jpa
With DC motor servo setups, there is a known risk of runaway conditions if the feedback encoder cable gets disconnected or the encoder malfunctions. If the machine is stationary when this happens, the feedback malfunction can show 1-2 encoder ticks of position error to LinuxCNC, which is too small to trigger following error. The PID integrator will try to compensate the error, causing the axis to slowly accelerate towards one end until it crashes.

I had a near-miss with this when messing with the cabling with machine powered on (I know, stupid..). Fortunately quick e-stop press avoided a crash this time. To protect against any future cabling or encoder faults, I made this little HAL component.

Parameters:
  • control_threshold: Movement is expected to occur if absolute value of control exceeds this threshold.
  • feedback_threshold: Encoder is considered to work correctly if the changes in feedback exceed this threshold.
  • time_threshold: Time delay to account for motor inertia.

Pins:
  • input control:  The output from PID controller
  • input feedback: The feedback input to PID controller
  • output out: Goes high if runaway is detected

The basic idea is that once the PID output is high enough, the motor should start moving. If the component doesn't see movement in encoder feedback within given time, it can be used to trigger emergency stop. Small movements that are below feedback_threshold are expected to occur within time_threshold seconds, after which PID output will return below the threshold. Larger movements will reset the timer every time a feedback_threshold worth of movement is detected since the last reset.

There is example of using this component in a full configuration here:
github.com/HacklabJKL/sergei_cnc2/commit...636d14fa01c15c82e95c
The following user(s) said Thank You: tommylight, COFHAL

Please Log in or Create an account to join the conversation.

More
4 years 4 months ago #244667 by tommylight
Nice, thank you.
Luckily, i had failed encoders but never a run away, still this issue wanders often through my mind.
Installing extreme limit switches is one way of dealing with it, so far i used this, it cuts the power to ser vo drives in case they are triggered.

Please Log in or Create an account to join the conversation.

More
4 years 4 months ago #244836 by andypugh
Do you want to add this to the linuxcnc HAL modules?

Please Log in or Create an account to join the conversation.

More
4 years 4 months ago #244947 by jpa
Hi,

Yeah, it could be nice to have this part of the main distribution.
Though it might make sense to let this "bake" bit first, I'm still building my CNC machine so haven't done very much practical testing yet.

Today when testing I did notice a small bug with negative movements , fixed in the attached version.
The following user(s) said Thank You: itsme

Please Log in or Create an account to join the conversation.

More
4 years 4 months ago #245174 by andypugh
Feel free to create a pull request on github when you are more confident in its reliability.

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago #297946 by vre
I have done a test without limit switches
and a failed linear scale resulted in a crash.
Ferror was 3/20mm but this didn't worked.
Ferror protects when encoder does not work
or works unreliable ?
Machine was a mill with analog speed servos
without encoders and position feedback send to linuxcnc by linear scales.
Can use this component to protect from this type runaway ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.300 seconds
Powered by Kunena Forum