(Solved) ESTOP loop/scheme - external safety relay

More
5 years 4 weeks ago #222041 by spumco
[TLDR: need help setting up HAL with and2 and a momentary estop reset]

Ok, thanks to everyone's help I've got LCNC installed, gmoccapy up, and my spindle motor working.  Before I move to the axis motors I need to get my estop logic sorted out.  And yes, I currently have a working external estop - it's just not doing everything I want.  I'm good-to-go on the hardware/wiring side of things, but not so much in the HAL situation.

I've attached simplified version of my external power/estop circuit for anyone with the patience to help me sort this out.  Ignore the missing fuses and other safety stuff.  Here's what I have:

Main Power
  • ON switch SW1, momentary NO
  • OFF switch SW2, momentary NC
  • Relay K1, DPDT
Estop
  • ESTOP switch SW3, latching NC, two contact pairs
  • RESET switch SW4, momentary NO, two contact pairs
  • Relay K2, DPDT
Basic function:
  • ON/OFF/K1 is a tandard industrial two push-button circuit to power sensors and permit estop loop
  • When K1 is active, ESTOP can be unlatched and RESET pressed, permitting K2 to activate
  • When 7i76 output is pulled low, K2 activates
  • When K2 is active (ESTOP clear), drive contactors are active and 7i76 is signaled (external estop clear)
  • Basically, the operator and LCNC can both drop the estop circuit (killing drives), but only the operator can clear an estop.
Eagle-eyed viewers will see this scheme results in circular logic: K2 needs to be active to signal ESTOP clear, but 7i76 output needs to be triggered to activate K2.  I have bypassed this by jumpering K2 coil to ground temporarily.

Functions I need help with:
  • Assuming ESTOP SW3 is unlatched, I would like to use the RESET to signal LCNC through the 7i73 to trigger the 7i76 output as a 'estop-clear-request' signal.
  • In addition to the K2 estop signal to 7i76, I'd like ESTOP SW3 to signal LCNC through the 7i73 of an estop enable or clear.  If the relay doesn't drop out for some reason (welded contacts), I'd like LCNC to know I still want an estop.  Belt and suspenders sort of thing, doesn't cost me anything.  I believe I need an and2 function, not sure.
So if someone can walk me through the process of adding & configuring the two functions above I'd appreciate it.  Keep in mind that I'm just barely grasping some of the HAL concepts and I haven't internalized anything beyond the difference between signals and pins, so short words without too much jargon would be welcome.  I'm learning, but I'm still in the rather painful stages.

HAL file attached.  I'm using a config generated by pncconf and tweaked by PCW earlier today for some spindle PID stuff, but it's otherwise straight outta' pncconf.

-R
 
 

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

More
5 years 4 weeks ago #222054 by chris@cnc

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

More
5 years 4 weeks ago #222070 by spumco

Take  a look to estop_latch.
linuxcnc.org/docs/2.8/html/man/man9/estop_latch.9.html
You will found many examples. 
I learned from Rod.
162.243.45.186/47-hal-examples/25861-external-e-stop?start=10
 
Thank you.

I read both of those links earlier today, but I guess it isn't really sinking in.

I am beginning to suspect that the text-based HAL/INI scheme is causing me problems; perhaps I'm more of a graphical learner.  I can comprehend anything in narrative form very quickly (tech manuals, novels, whatever), but any time I look at a HAL file I get lost & confused after about three seconds.  Which means HAL snippets pasted in a thread don't sink in - I have no experience, so any context goes over my head.

Even the MAN pages aren't working for me as they don't have examples with a description of how that example works.

I understand I need to add a function, and specify how many instances of that function.  I'm going to disect Rod's example, mostly as an exercise for myself:

loadrt estop_latch count=3
[Ok, just created three instances of the estop_latch function]

addf estop-latch.0 servo-thread
addf estop-latch.1 servo-thread
addf estop-latch.2 servo-thread

[Got it - just added all three functions to the servo-thread, meaning they'll run at a certain speed and get polled/resolved constantly.]

But now it gets murky:

# --- ESTOP CHAIN STARTS ---
net latch-reset iocontrol.0.user-request-enable
net latch-ok-in iocontrol.0.user-enable-out

[Starting to get lost.  Signal latch-reset has been connected to pin iocontrol.o.user-request-enable.  Ok, but where does that pin come from and what triggers it? Is it in a list of pins somewhere outside the HAL files?  Is the latch-reset signal something Rod made up for this function, or is it coming from sonewhere else?]

net latch-ok-in => estop-latch.0.ok-in
net latch0-out <= estop-latch.0.ok-out

net latch0-out => estop-latch.1.ok-in
net latch1-out <= estop-latch.1.ok-out
net latch1-out => estop-latch.2.ok-in

[The above seems to be the equivalent of a series circuit; the "ok" value is passed from one input to another and finally to signal estop-latch.2.ok-in. Still confused as to where these pins come from.]

net latch-reset => estop-latch.0.reset
net latch-reset => estop-latch.1.reset
net latch-reset => estop-latch.2.reset

[This seems to connect three pins to the same signal.]

net latch-out iocontrol.0.emc-enable-in <= estop-latch.2.ok-out
net estop-out estop-latch.2.fault-out

[Here he's connecting the 'final output' estop-latch.2.ok-out from earler to iocontrol.0.emc-enable-in.]

# --- EXTERNAL ESTOP SWITCH ---
net external-estop <= hm2_7i76e.0.7i76.0.0.input-00
net external-estop => estop-latch.0.fault-in

[Finally, something I think I understand.  A physical pin is connected to a software pin.]

Besides the physical pin on the 7i76e, where do these pins come from and what do they do?

Where do I find out what iocontrol.0.emc-enable-in does?  Where do I find out what estop-latch.0.fault-in does? 

Getting back to my original question... I want to use a momentary pushbutton to cause the estop to clear.  If I create one or more estop-latch functions, which results in estop-latch.N.ok-in and .ok-out

I think I understand the basig logic and sequencing, but it's the software pins that appear to be black holes.


O.M.G.  
Something just clicked as I was writing this.

Creating a function via loadrt results in software/HAL pins being created.

Every place in the HAL file that has a 'loadrt' statement will cause HAL pins to spring in to existence magically.  Nowhere in the MAN pages is this explicitly stated. Those just have a description of the function and a list of pins.

Even the nice picture in the HAL intro just implies this.

I'm sure everybody is going "well, DUH"... but until 3 minutes ago it wasn't obvious.

So now I can reverse-engineer by looking at a pin, figuring out what Function created it, and then look up that Function in the manual to see what that pin does.  Right?

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

More
5 years 4 weeks ago #222082 by tommylight

So now I can reverse-engineer by looking at a pin, figuring out what Function created it, and then look up that Function in the manual to see what that pin does.  Right?

Yes! :)

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

More
5 years 4 weeks ago #222083 by chris@cnc
For easier understanding think every estop-latch is one estop button.
To definie chain length use loadrt
loadrt estop_latch count=3 ->  means you have 4 "buttons / functions" 
estop-latch.0
estop-latch.1
estop-latch.2
estop-latch.3

next activate all buttons in servo-thread to get time cycle control of pin. All Pins now asking in ms steps are you true or not.
addf estop-latch.0            servo-thread
addf estop-latch.1            servo-thread
addf estop-latch.2            servo-thread
addf estop-latch.3            servo-thread

Now 5 important Pins active 
estop-latch.0.ok-in  -> chain start here with signal iocontrol.0.user-enable-out by press F1 or E-stop button in GUI

estop-latch.0.fault-in -> foult in PIN from hardware E.G hm2_7i76e.0.7i76.0.0.input-00-not 

estop-latch.0.reset -> reset Pin connect to iocontrol.0.user-request-enable. By press F1, estop fault reset if all buttons ok.
No self enable in case of EMG.

estop-latch.0.ok-out -> estop ok-out bit. Need to activate next chain member e.g. estop-latch.1.ok-in
Last chain member pin enable "iocontrol.0.emc-enable-in <= estop-latch.3.ok-out"

estop-latch.0.fault-out -> trigger bit to see in halshow what EMG is pressed. Last chain pin "net estop-out <= estop-latch.3.fault-out" close the chain.  Is GUI EMG or EMG buttons foult, chain is open  and can only reset by active all signals estop-latch.x.reset. Not self enable. I think that was your main problem.

Same pins for estop-latch.1 till 3
Search in halshow for estop.latch Pins for diagnostic
The following user(s) said Thank You: spumco

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

More
5 years 4 weeks ago #222084 by chris@cnc
For safe is recommended to cut by EMG pressing the safety relay power. Only this way you have hard and software EMG.  

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

Time to create page: 0.173 seconds
Powered by Kunena Forum