Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: fredeflint on February 08, 2018, 05:45:18 PM

Title: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 08, 2018, 05:45:18 PM
Hello,

As has been noted in other threads i found from searching the forum, the output signals get set to their  inactive state when the mach 3 program is in estop.

My situation:
I am trying to use the outputs currently to control an electronic vise holding the work piece. The vise is activated by a relay driven by an output pin on my controller card. The pin is mapped to an output signal in the mach3 ports and pins setup.

My issue:
So the issue is that if the vise is closed and you e stop, it will open, which i don't want. What i want is just that the state of the output is unchanged at an estop. ie if it is inactive and you estop, it remains inactive. if it is active and you estop, it remains active. hence this problem is not solved by simply changing the output from active high to active low etc.

So i thought maybe you could use a brain or macropump to add logic to keep the output steady during estop but does the estop state override brains?or is there some other way to achieve this perhaps?

Basically i want the output signal to latch at an estop, not change to its inactive state.

Thank you for your time.  
Title: Re: Mach 3 outputs and e stop behavior
Post by: Overloaded on February 08, 2018, 07:32:52 PM
I did a "bit" similar with a collet closer on my lathe.
The output energized a relay - pneumatic,4 way, 2 pos. solenoid valve that opened the collet(vise).
In E-Stop, power off, lightnin' strike, whatever ... as long as there was air pressure, the collet stayed closed.
Only way to open it was if Mach was running and the output went HI.
If the output is OFF during running, it will be off at estop... no change.
The wiring of the relay NO or NC along with the active hi/lo output should do what you want.
Maybe I'm not understanding what you are meaning. (it has happened)
Russ
Title: Re: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 08, 2018, 08:10:21 PM
Hi,

Thanks for your reply. I think you might get what im saying and it does sound similar actually to what i want but in your application you  say,

"Only way to open it was if Mach was running and the output went HI."

So in your setup, if the collet is OPEN as caused by mach 3 running and dictating the output HI and you hit ESTOP, does the collet then close?


edit:
Also, since my op  i tried to make a macropump test.  The script just forces  the output to active state no matter what ( ActivateSignal( OUTPUTXX)  ). So this was to check which has precedence, estop (forcing it inactve) or charge pump (forcing it to active state). The end result is that they seem to compete actually, and the vise does a nice little polyrhythmic dance. As amusing as it was it is not what i hoped for. :P

I also found another thread i did not see originally where someone replies to  a similar question and says that estop overrides settings from brains and macropump, so this seems true at least for macropump i have not tried a brain yet. I think i will just setup an arduino or something to latch the mach3 control cards outputs when estop is active (hook up estop and output signals to the arduino as well, sit it inbeteween the mach outputs and the solenoids). I just hoped i could do it without anymore hardware but i don't see a way to get mach3 to latch so far.



Title: Re: Mach 3 outputs and e stop behavior
Post by: Overloaded on February 08, 2018, 08:33:29 PM

"Only way to open it was if Mach was running and the output went HI."

So in your setup, if the collet is OPEN as caused by mach 3 running and dictating the output HI and you hit ESTOP, does the collet then close?


 


Yup. I could not forsee a situation where M3 would be running, the collet (vise) is open, and I'd need to hit the estop.

If you want the vise ENTIRELY independent of MACH, a simple ON/OFF switch would be the easiest, imo. Why do you need some sort of sw to control it anyway ?
Title: Re: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 08, 2018, 09:15:38 PM

Yup. I could not forsee a situation where M3 would be running, the collet (vise) is open, and I'd need to hit the estop.

right right ok and i wish this was the case for me too, since this is the easiest solution.

If you want the vise ENTIRELY independent of MACH, a simple ON/OFF switch would be the easiest, imo. Why do you need some sort of sw to control it anyway ?

Yes i agree that would be very easy but I don't want it independant of mach3 though, i want it independent of ESTOP signal.

The main goal is full automation. The vise is sort of the first step. I am cutting very often the same part, like 100's at a time so i am working on a feeder/robotic arm to feed pieces into the vise, but the vise first needs to work, so that is the step we are at now.

Originally i had bought a Modbus over etehrnet relay board which i think would avoid this since i doubt estop sends modbus coil register signals (i hope not anyways haha). But even though i could get it to work with the modbus test window in mach3, i could not get it to work with vb script or brains, even after reading some threads which sounded like people had similar issues, these solutions did not workout for me. So instead now i moved the goalpost a bit and  am going direct onto my controller card which unfortunately now seems to be affected by the estop signal, although from research this seems normal, not an issue with the card, it is what "should" happen etc...

anyways its a classic case of not doing enough research before buying some parts and just assuming it will work out, but ya im just trying to make something work with what i have on hand atm. it does almost work ahah.

here is a short video if you want to see a test of the vise opening/closing for fun.

https://www.youtube.com/watch?v=xftNNhw9QnA
Title: Re: Mach 3 outputs and e stop behavior
Post by: Overloaded on February 08, 2018, 09:37:29 PM
Here is a thought:   2 relays
Basically, considering the voltages required...
Use 1 relay, NO, when energized by a mach output (thru bob relays ?) it closes and closes the vise.
 It also latches itself with one wire to the coil.
That latch wire goes through the NC contacts of another relay. The coil of this second relay goes to a second output of Mach.

Momentarily energize coil1, vise closes and latches.  Line, or vise voltages keeps it latched as long as power is on. Estop, or not.
The only thing that will open it is if mach is running, out of estop and you momentarily activate output 2 to break the latch.

The only way to close the vise is if mach is running, out of estop and out1 is momentarily activated.

I think ...
Title: Re: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 08, 2018, 11:34:03 PM
That is not a bad idea either.

It made me think also you could just get latching relays and since you just pulse them high/low to set the relay state... i will sleep on it and try something tomorrow.

Thank you for your thoughts!
Title: Re: Mach 3 outputs and e stop behavior
Post by: Overloaded on February 09, 2018, 12:15:35 AM
Keep us posted ..............

Thanks,
Russ
Title: Re: Mach 3 outputs and e stop behavior
Post by: olf20 on February 09, 2018, 07:15:14 AM
Would a two (dual) coil solenoid do what you want??
olf20 / Bob
Title: Re: Mach 3 outputs and e stop behavior
Post by: Overloaded on February 09, 2018, 09:00:52 AM
A dual coil latching, set/reset relay would be a more convenient package of what was described above ..... if you have one on hand.
Thanks Bob,
Russ
Title: Re: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 09, 2018, 04:51:46 PM
ya the latching relay idea would work, drawback is i don't have any on hand and also i believe it would require 2 io per relay instead of 1 which i don't have available on my control card if i want 4 vise. but it is probably the cleanest solution suggested in a way and i did not even think about that approach until Overloaded suggest the 2 relay solution, so thanks for that idea .

anyway i was hoping to get something working today with what i have in the shop so i made some arduino program that monitors the mach3 controller card outputs + the estop switch. basically it just passes the mach3 outputs but latches the previously scanned state if the estop is activated. and then after finishing  that i realized the arduino cannot drive the relays bc they are 24 volt and the arduino board on its own does not have open drain outputs of course, whereas the cnc control card does have 8 open drain outputs.

so in the end i just ordered a relay shield for the arduino and have to buy something anyways, but i t was quite cheap and should be here early next week. tgif i guess.

ill post results when it arrives.

thanks for your input everyone.
Title: Re: Mach 3 outputs and e stop behavior
Post by: Overloaded on February 09, 2018, 05:58:26 PM
ya the latching relay idea would work, drawback is i don't have any on hand and also i believe it would require 2 io per relay instead of 1 which i don't have available on my control card if i want 4 vise.

The method I suggested only uses 2 outputs total, 1 for each relay. 2 simple SPDT ice cube relays. (I assumed everybody has a few of them lying around  ::) ;D )

BTW, what is the voltage of the devices we're talking about ?
Outputs ? Vise ?
(how does an electric vise work anyway ?  ??? )
Just curious.
Russ
Title: Re: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 10, 2018, 12:12:16 AM
Hi Russ,

yes 2 outputs total per vise per se, since i ultimately desire to control each vise independently. if you look at the movements in the  video i posted earlier, i have 10 macros basically, 1 to open/close all vises, and 1 to open close each vise independently. in the video i make use of all macros to get that sequence. So that uses 4 outputs which is all i have actually per card free in my current config. the macros are all basically de/ActiveateSignal(xx), there is not much magic there and it works nicely other than the estop issue.

i also have 2 larger cncs than shown in video that can hold actually 8-10 of such vises so i try to keep the io required as low as possible for now which is why originally i had bought a modbus relay card to expand the output capability of my machines, and intended to not even use any of the outputs from the controller cards since there are only a few free on the cards i have.it;s possible eventually this card will work out but i spent about 3 days reading and trying things, and beyond the modbus setup window i could not get mach3 to communicate with the card, so i gave up.

re voltages of device:

the cnc card is a "leafboy77" card that has open drain outputs so you can use whatever voltage yo would like.  in all my cabinets i have  a 24v supply for most things and then either a 48 or 60v supply for the steppers. so i have 24 v relays and air solenoids etc. since the leafboy outputs are open drain it is no problem to interface them with 5V arduino but i did not think hard enough about then putting the arduino on the  relays i have wired to the air solenoids which require 24V.

re: electric vise

probably i should have said pneumatic vise, because it is actually just an air cylinder with a jaw on it. by electric i just meant it is controlled electronically, with an air solenoid, very similar to the collet example you gave in your own work i would guess. so the solenoid directs the air to either open or close the vise. i can take more pictures on monday if you are interested in how it is setup. but is basically mach3->leafboy77 card->a bunch of relays and water pumps etc at 24V and a bunch of steppers at 48-60 VDC + a vfd.

have a great weekend!
Title: Re: Mach 3 outputs and e stop behavior
Post by: Overloaded on February 10, 2018, 12:44:28 AM
Thanks for the details, I understand better now.
I have not seen the video. Slow connection, lame pc ......could not get it to run for me.
Will try again a bit later when on a different pc.

You have a good one as well.
Kind regards,
Russ
Title: Re: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 10, 2018, 12:13:59 PM
Russ,

Ah ok, if the video is not working then here is 1 picture i had already taken off my phone last week of the vises, you can't see all 4 in the photo but im sure you can get the idea, just a twin rod cylinder with some blocks added...

(https://lh3.googleusercontent.com/aV09g5h8MkgGe8Oz0sT6eNqmk8HjoSjBKFXM0yszwKy-9UJG9jAM5mEXwUfdUiNJ98jedVBePLEPexwYZ4iWHI-MvqXUYRcsdEYoTrcAxE0n9iTQV_ic73vOI_zZWtTfPhgf6o5sQOvJbUj80NDSMikqoKB1gGj39FUY_GGAepULFE-PtqBFGOeQlTkeOUNsgJNefKhPmSoAnMG1PkhH3vURmFD-jqMqiBkRyG5u-IFZ3AZWnl6YHKhFY9Awlf3yeDb8w3kHEoORcvhDZhnGkDa_8OWqBSf0JlPf_v1N1WBccXyb8TRadsyWortu4kHHNrmxvwdaRM-2EJOiN-w1O8Fuat3E2FMHpxbeaxDAhNbD2xUiub7FjkbxMNYdK1708Ldy6mvRbce8gWPHsO8QB58UftiJkhjnFJ419QiU-XWOkuDCcn3kuBlU0L3dPJZ-RrCIp4AKN69TZ9haPEb1Vh_KAx6vQjWFY9rsa1c6PQ3ytRsL1cEwnCZVQ_KgqrxGrokIAH2-QWCgXYaNieVafMW8UzvOX8ardFIrLX9kQ1Nrxbu4b2_M2Yx_rxfzfXh4fFxHHYdT8Huzzahb-Md8cj_2wT0GEnek=w800-h600-no)

cheers

s
Title: Re: Mach 3 outputs and e stop behavior
Post by: fredeflint on February 15, 2018, 12:48:02 AM
tl;dr: i was able to make an acceptable solution using an arduino and a relay shield.




...I'm not sure this is the best solution, it does work in that you can latch the vise to that state it was in when the estop event occurred. Here i tried to make a holder for the a
holder for the arduino to stick on din 25 rail.

(https://lh3.googleusercontent.com/2vP09LgGJg2EiQVoNBT5Brx3KXTwnaq0_d_AQQOtsfQRJjq7DXpS075IMq7evdhOJgu6BhOvfd_dSlJLEQULaHz8Jp2zP8Y1W_oDEz7bj5opdVz0wzfkDl_q761HUVbzIo18f1FFmrjIjLtkx2l1ypGdfwBW6TJNWkGLvm5Db9Iy9xvLBvvl-uDbXim0rdcpcXcHKrMhXX2VLOKdu2HZP9x-mEgGzyQrGhaDYePL__OB6w6Xh4dR7-pLJURWcrMrmO85yIoH9QAOWqoO1s26gcH5VuocHnm3jWZqWLO8Ardh3agvySU7xeuQiBtWF_PQHAailCxMfMAZlw7xSnqAZUrxf2DfrZUC-mwysFJkOUsZkXcPB5rLFr3wB6Muhh7j-EzXSU_HtShCmG_4ZpVY_vvRrmor0g-DuALK5Y4QarcEA2zDdyuErYIlSppsTMor36J-p-7poqLdgZ2ZhZ6q3Jnisl1CLznO2Z21iRLoTe73ZUOTPEJK4ebCHXrhZtS4tkbmQyFnCmTAKadTx6rZS5qgQ83Blzr3OxXQf8xmrYcfRRc-axJEpXa4RHuX81lAnYmoibH_nHrpqIaraseli5UB4oWeEs4m=w533-h400-no) (https://lh3.googleusercontent.com/G9OqFQIb7IC6x4OVj70G-QF1t6J42fQiEmKVOsMY0ef25buGJlbyK-XnBoqcJjndPIWI3E9lfbYzsHWXFFdL6W25GJqgEVB033VyP8WMj6zoPBmyH3-9x3mQcBf9WBh5mTR9ep1irGBXyNMjHrdgtsCyHtYn_INM1S6t8jZSRh1cVMQMHEcQCSsvaWuSIio3tcMkN5wDcf31wyFzijLx-pz7kFgsqrbSA-bQ64roqEZf9_yaoD0VHMh0m_x7fxwIXuCpGSRqiuXX8zZ3_7anwMYWvbvKXyAv2YAe3yKSeQxIkzkc9oLFnRpK91PvHeBGl-cprH-1NdELD1f8Otp9H2jkSBITdThG3AgKQG-9jjTIXc7VKwiGaR8r5n97hCfiwDlbSbcmMvxj4Mk49xb2brjl2lCbYeuG2iAQhpwMJb769ZZu_NQcREqv20CxLIE5cOWGxJoTC87ApQnuYwp34p2X7h7gYJgx_n6q6RSCVkUt7jY1VoW-VI2oOX8kxnVvSElfnfMrsU4pdbeccVKr0pYJUnMkoNzET4ZV-Zpn_qzvo5wskCbY9twOPiLYREY5wpyZVvpY-swZtFrfW6a1XWu476geCn-m=w533-h400-no)


I made a video to show the clamp does not move from either state when the estop is pressed. In the test setup m8201 is closing the first vise and m8301 opens it. I hit estop in both states to show it does not affect the position. (https://www.youtube.com/watch?v=SL8hY5IIr3Y)


The final program was a bit more complicated than i originally thought bc my original idea had some gotchas and was not adequate for every situation.

In the end i used the mach3 outputs (4 of them, 1 for each vise) to send pulse signals to the arduino inputs, a momentarily high pulse toggles the state of the corresponding output relay.  I used 4 outputs on the arduino to signal the relays state back to inputs of the mach3 control card. The signal on these connections is the state of the corresponding relay (ie latched or not).

The open sesame macros check the corresponding mach3 control card input to see if the vise is open or closed. If it is in closed state then a toggle pulse is sent to the corresponding arduino input, if it is already open no pulse is sent. The closed works in a similar manner. This allows me to control 4 vises with 4 output only, not 8 as would have been needed with actual latching relays. But at the cost of 4 inputs on the mach3 control card if you want mach3 to know the sate of the vise. The card has 16 inputs and i use only 5  before this, so not too bad in the end.

Again its a bit of a complicated solution but it seems to work

I also noticed in the modbus section there are many serial modbus firmwares for the arduino, so that might be another way to try to set it up as well which might not require any connections between the arduino and mach3 control card at all.

Anyway, thanks to Russ and others for their input.

s