Hello Guest it is April 28, 2024, 01:08:31 AM

Author Topic: Best way to disable/e-stop machine on servo error (digital input)  (Read 697 times)

0 Members and 1 Guest are viewing this topic.

Situation is I am running Mach4, with Ethernet Smooth Stepper motion control with MB3 breakout board. Connected up to the servos with an Enable Output (wired to the motor enable outputs 0-3), and also a Drive Ready signal running into inputs 6-8.

The ideal would be to be able to modify the function of the main Enable/Disable button, replicating the disabling functionality to be called via a signal change on the Drive Ready lines, but also implementing a check to only Enable the system when all Drive Ready signals are present. I'm competent with the scripting stuff, and have already done a reset (on screen) button to send a 500ms pulse to the drives to reset them, and also added the LEDs to indicate Drive Ready status, I've been able to do do some basics on the change of those Drive Ready signals.

But, the bit I'm missing is understanding what goes on in the Enable On and Enable Off 'actions' that are selectable from the dropdowns, but don't appear to be documented anywhere.

Or, is there a better way to do this? Like can I call those Enable On and Enable Off 'actions' from within scripts?

Sorry if this has already been covered, I've tried some searches but may not know the correct terms to use.
Re: Best way to disable/e-stop machine on servo error (digital input)
« Reply #1 on: January 15, 2023, 02:56:26 PM »
Hi,
I use servos on my new mill.

Each servo has an alarm output which is hooked to the BoB/ESS combination. I have allowed for six axes (X,Y,Z,A,B,C) and thus have six inputs to the ESS,
one for each axis. Any one or more of those inputs will cause the machine to Estop, using the API provided for the purpose. Note that each alarm input has
an entry in the SigLib table that invokes the mcCntlEStop() API.

Code: [Select]
LUA Syntax:
rc = mc.mcCntlEStop(
number mInst)

Description:
Disables the control and optionally dereferences all axes.


All my servos have an ENABLE input and a RESET input. In order for a servo to run it must be enabled. Note also that the ESS has output signals of the type Motor0Enable,
Motor1Enable, Motor3Enable etc. When Mach is enabled then all these outputs are active, and when or if Mach is Estopped then all those signals go inactive.
I use only one signal, Motor0Enable, and use it to drive all six servos. The ESS output switches a signal level MOSFET on the BoB and pulls the ENABLE output low.
The servos are programmed that an active low input turns the servo on.

Just as a matter of interest I have an electromagnetic brake on the Z axis and it too is driven from the same ESS output. The ESS Motor0Enable also switches a medium
current Darlington transistor on the BoB to apply 24VDC to the electromagnetic brake. It requires approx 250mA to release the brake.

My servos require an active RESET should they fault out. For this purpose I use a general purpose ESS output and that drives a circuit commoned to all the six servos RESET input.
I have a button on screen that I press should any one or more of the servos require a reset....it hardly ever happens, but its handy. Otherwise I would have to de-power the machine to
allow a power-cycle to reset the servo drives, a PITA.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Best way to disable/e-stop machine on servo error (digital input)
« Reply #2 on: January 16, 2023, 12:04:22 AM »
Thanks Craig, I had tried that function but after googling it a bit more I think I had forgotten the 0 parameter so it hadn't been disabling the drives and I discounted it. In any case, it all works well now!

I guess for the rare occasions the drives trip out, I just need to remember not to enable the system again without reset the drives, which shouldn't be too difficult.
Re: Best way to disable/e-stop machine on servo error (digital input)
« Reply #3 on: January 16, 2023, 12:15:05 AM »
Hi,

Quote
I think I had forgotten the 0 parameter so it hadn't been disabling the drives

What exactly is the '0' parameter? I assume you mean the instance variable? If that is that case you are writing potentially weak code.
It is true that the only instance of Mach4 in a single instance environment is instance 0.......but that may not always be true. Mach4 was always intended to be
a multi-instance solution, and Mach4Expert is already multi instance. Thus, if your code were to run on such a machine it would fail.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Best way to disable/e-stop machine on servo error (digital input)
« Reply #4 on: January 16, 2023, 01:43:32 AM »
No not the instance, I've done plenty of C++ and leaked plenty of memory before! Pretty novice at lua though, don't suppose there is an equivalent of a header file with well documented parameters etc?

Call I used was:

mc.mcCntlEnable(inst,0)

the second parameter, that was in some other thread when I googled mcCntlEnable.
Re: Best way to disable/e-stop machine on servo error (digital input)
« Reply #5 on: January 16, 2023, 02:48:12 AM »
Hi,
OK:

Code: [Select]
LUA Syntax:
rc = mc.mcCntlEnable(
number mInst,
number state)

Description:
Enable or disable the control.


So the second parameter sets either TRUE or FALSE.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Best way to disable/e-stop machine on servo error (digital input)
« Reply #6 on: January 17, 2023, 04:19:30 AM »
to expand yours issue
there are several safety circuits ,before the control like air pressure or inverter...
also other device to force according enable situation like Z brake ,traffic light, safety curtain...
i found best place mange all this its by the Pmc ,convenience to act according events and timers
try it ,its real good solution for this uses
(its not instead M function and Lua works ,its other solution for specific point)