Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: sungyeolyang on July 25, 2022, 11:09:16 PM
-
Please advise if I'm misunderstanding something.
I'm reviewing the m6 script sample and planning an ATC.
I'm trying to use an external controller (arduino) to do positioning and rotation of a tool.
Here are my basic ideas and questions.
1. To send tool change command to external controller (arduino), do I need to turn on IO in motion controller (Intgra 7866) to prepare my controller for tool rotation and replacement?
If I had 10 tools in this case, I would need 10 IOs, right?
If I have 30 tools, should I have 30 IOs?
This method is too inefficient. Any other good ways?
(Example: No. 4 io on -> No. 4 tool replacement command, No. 5 io on -> No. 5 tool replacement command…)
2. When the Mach 4 is first run, the tool number on the Mach 4 should match an empty tool slot on my Arduino controller.
(This ensures that the tool will fit into the empty slot when changing the tool.)
My question is, when Mach 4 is running, it reads the number of tools it currently has,
(my controller wants to pass the number of an empty slot to Mach)
I'm looking for a way to synchronize the tool number of an external arduino controller with the tool number on the first run of Mach 4.
Are there program samples (ATC) or tool replacements I can refer to?
-
I don't use Arduino, but I'm sure you can make a counter to handle this instead of using inputs.
On the current machine I'm working on, this is what I'm doing. I start the tool change sequence in Mach4, I move the Z Up to the tool change position and make sure the spindle and coolant are off as well as any other task that Mach4 can take care of; then I send a register # over to the PLC via Modbus; this register # is the requested tool; in the M6 Macro, I now wait for the PLC to finish rotating my carousel. You can use the following API Call to wait for an input to become true before continuing, or if it times out, then you can do something else.
rc = mc.mcSignalWait(inst, mc.ISIG_INPUT21, 1, 5) --Wait 5 seconds for input 21 to become active
if (rc~= 0) then --Check our return call
mc.mcCntlSetLastError(inst, "There was an error")
end
My carousel has an index switch, so it counts the number of rotations and stores that inside a register in the PLC. So as it rotates, it counts up or down until the current carousel position counter equals the requested tool number sent over from Mach4. Once it reaches that position, it turns on an output inside the PLC which is read as an input in Mach4, this input correlates with my mc.mcSignalWait call and it can continue with the macro.
Then again, you can do exactly as you suggest, have a bunch of inputs you can use for the arduino. I have an old hurco that has a lot of proximity switches that tell me what current tool position I am on in the carousel; It has a 20 tool position carousel, so 20 inputs telling my PLC what to do. I have my PLC look for the correct sequence of inputs that tells my register that it is a certain number and I do the same thing as stated above, once the current carousel position and the requested tool registers equal, then it sends a signal to mach4 to continue the m6 macro.
-
I was inspired by your article
I am a fan of CNC.
I'm a Windows programmer, but I don't know much about Mach 4, so I don't know how to build an ATC.
Reading your post gave me a definite direction.
thank you !!
I think I can do something!
-
https://www.machsupport.com/forum/index.php?topic=34228.20
Here is a link to an old M6 I had done a while back. I'll see if I can get the one of the machine I'm working on and post it here.
It is extremely more comprehensive.
-
Thanks for sharing a good source.
These will be of great help!!
-
Can I know the type and model of PLC you are using?
I want to buy it and test it.
I have a Hicon Integra 7866
It also has a smooth stepper.
I'm debating which one to use for my large mill CNC machine.
Based on your comments, I would like to try the PLC and MODBUS method.
As a Windows programmer, I have no difficulties with the program.
i just need to understand the platform (Mach 4).
-
https://www.machsupport.com/forum/index.php?topic=34228.20
Here is a link to an old M6 I had done a while back. I'll see if I can get the one of the machine I'm working on and post it here.
It is extremely more comprehensive.
Can I know the type and model of PLC you are using?
I want to buy it and test it.
I have a Hicon Integra 7866
It also has a smooth stepper.
I'm debating which one to use for my large mill CNC machine.
Based on your comments, I would like to try the PLC and MODBUS method.
As a Windows programmer, I have no difficulties with the program.
i just need to understand the platform (Mach 4).
-
I use the Click PLC from Automation Direct. I get the Ethernet version so I can use TCP modbus.
I use the HiCON on everything now. I’ve used the ESS smoothstepper before and I much prefer the HiCON.
I think I have laid out TCP modbus setup with the Click PLC somewhere on this forum. You can search for it.
-
I use the Click PLC from Automation Direct. I get the Ethernet version so I can use TCP modbus.
I use the HiCON on everything now. I’ve used the ESS smoothstepper before and I much prefer the HiCON.
I think I have laid out TCP modbus setup with the Click PLC somewhere on this forum. You can search for it.
I was debating whether to use the Hicon or the Smooth Stepper.
Your comments have been of great help!
Thank you. ~~
it was a big help
According to your idea, the Mach 4 will instruct the tool replacement and
Let's say the PLC completes all replacements within 10-15 seconds and sends the results back.
To replace the Mach 4 tool, you need the current tool number and the tool number to be replaced.
If it's set up normally, I don't think there's any problem with it working
My question is, when the PLC is newly powered on and Mach 4 is completely started, shouldn't the tool number of Mach 4 be transmitted to the PLC between the two systems?
Or, when Mach 4 is executed, do I have to manually align with the PLC by entering the current tool number correctly?
-
It depends on your setup.
On my Hurco, the PLC always know where the carousel it is due to the input combination for every position.
I have a lathe that has no index switch or home sensor for the turret. On Mach4 startup, I have a message box pop up asking for the current turret position, the user input updates the PLC counter.
The mill I’m currently working on has a tool 1 position sensor, so I home the carousel in my Reference All button and I also have a Carousel home button in case I need it otherwise. The m6 Macro will tell me if the carousel isn’t home and will not run. The PLC counter updates to “1” after the homing sequence.
-
Thanks for the advice ^^;
It depends on your setup.
On my Hurco, the PLC always know where the carousel it is due to the input combination for every position.
I have a lathe that has no index switch or home sensor for the turret. On Mach4 startup, I have a message box pop up asking for the current turret position, the user input updates the PLC counter.
The mill I’m currently working on has a tool 1 position sensor, so I home the carousel in my Reference All button and I also have a Carousel home button in case I need it otherwise. The m6 Macro will tell me if the carousel isn’t home and will not run. The PLC counter updates to “1” after the homing sequence.
-
why use external plc?
i use mach with pokeys , i use about 24-28 inputs and about 50 outputs , i do all i need
i use ATC with servo or without , and many other devices by the mach
in some cases when we have 2 or more axiss that need work in paralel i use 2 pc as master and slave
i cant think about any challenge cant implemet by mach ( many times need use external application but still all its conect to mach)
even RS485 absolute encoder to read the value i have c# application that run from mach
no need arduino , no need any external plc
-
Thanks for the good advice.
Could you please share the M6 script?
I was thinking of an external Arduino that could handle it easily, because of the difficulties of the M6 script.
Control the motor to move the ATC to the replacement position and
Rotate the tool palette, replace it, move it back to the exchange standby position,
I have to do several programs.
Because I'm new to the M6 Lua script
ysy9999@gmail.com
why use external plc?
i use mach with pokeys , i use about 24-28 inputs and about 50 outputs , i do all i need
i use ATC with servo or without , and many other devices by the mach
in some cases when we have 2 or more axiss that need work in paralel i use 2 pc as master and slave
i cant think about any challenge cant implemet by mach ( many times need use external application but still all its conect to mach)
even RS485 absolute encoder to read the value i have c# application that run from mach
no need arduino , no need any external plc
-
Much more then you describe,some points MUST consider while change tool
1.chesck if real have tool inside spindle
2.must cheack sensor( open and close) while cicle
3.must give solution for any kind of failure for example tool not unload or
Tool not look ,each solution it's according yours machine
4 must give. Answer for any events happening while change tool( and always happened many) for example workers press stop ,or air pressure fall
5 recommend ( for me it's must) write to external software or file ,the new too ,so next time you will turn on can compare before work,many many times for many reasons the tool Mach think it's inside the spindle it's not the real one
6 before change tool must cheack all
Accoriese around not disturbing for example hood up...and all machine offset are clear,and cheack twice spindle not rotate
That what I can remember now from my car
Good luck
-
I'll post my m6 Script from the mill I'm working on. It is incredibly extensive and has the ability to empty the spindle when you call up tool 0.
I use an external PLC because it is far FAR more stable then anything I've used in the past as far as motion controller breakout boards.
For 1, it is all 24vdc so it is very stable with noise. Also..... it is a PLC. If there are tasks you don't want to code in Mach4... just write a few rungs of ladder logic and you never have to worry about it... for example.. lube pump timing, low fluid levels can be run through the PLC and send an alarm to Mach4... etc...
-
when i start with pokeys (about 4 years ago) we have many issues with noise ,more with there plugin for the realys cards
at beginning it was real big head ace for us(output was turn on without any command) and they blame...noise.. etc,..
but when they understand we not play games ,they take the problem in there hands improve plug in ,and after several software updates
i can tell you ,about 2-3 years many many cards "0" problems
no noise ,nothing
so this stable issue its real not point for me
about write the plc , i think that if you have some experience ( not much)with write code ,its very easy and much powerful then some patterns that some one build for you(like ladder) but this my opinion maybe some one else think something else
one more point very important for us its remote control ,with windows software its very easy control and debug far customer
if you want i can send you link to see our ATC ( we have all typs,linear ,linear under gantry, carousel by toth wheel and carousel by servo)
also drill block with many drill inside
yaakov
-
Thanks for the advice.
Is there any link or data I can refer to? (anything)
Can you share your M6 script?
My mail is ysy9999@gmail.com.
Thank you again.
when i start with pokeys (about 4 years ago) we have many issues with noise ,more with there plugin for the realys cards
at beginning it was real big head ace for us(output was turn on without any command) and they blame...noise.. etc,..
but when they understand we not play games ,they take the problem in there hands improve plug in ,and after several software updates
i can tell you ,about 2-3 years many many cards "0" problems
no noise ,nothing
so this stable issue its real not point for me
about write the plc , i think that if you have some experience ( not much)with write code ,its very easy and much powerful then some patterns that some one build for you(like ladder) but this my opinion maybe some one else think something else
one more point very important for us its remote control ,with windows software its very easy control and debug far customer
if you want i can send you link to see our ATC ( we have all typs,linear ,linear under gantry, carousel by toth wheel and carousel by servo)
also drill block with many drill inside
yaakov
-
Sorry, it has been a while. But here is the m6 from the mill I have been working on.
-
thank you ^^
Thanks again for your kindness.
It will be of great help.
Sorry, it has been a while. But here is the m6 from the mill I have been working on.
-
Can I see a picture of the ATC in action with this script?
I'm curious to see a picture of the device that works with this script
Sorry, it has been a while. But here is the m6 from the mill I have been working on.
-
Chad Byrd
i didnt pass all yours code details but as i see i didn't see you check if user press stop while M6 run
as you know mach only stop movement in stop not stop I/O and i had so big hade ace with that....
onther point we always write in external text file the curent tool after change
because many reason can happened and mach will not save current tool ,so we always check in 2 different place if the tool id its same
last thing in yours M6 you give the tool name acording its position on magazine ,this will limit you in case you have more tools then
on yours magazine ,for us we have many times more so we have external text file with the tool name according tool fork id
same if you have linear or servo magazine you bater have external file that you can reach and update tool
thanks
yaakov
-
I have had zero issues stopping in the middle of my macro. I have buttons to reset my magazine, drawbar, etc if something goes wrong.
Mach seems to handle macro stopping much better than in the past.
I have a gear motor that controls the carousel, so I keep track of the carousel position inside the Click PLC I use on the machine. If Mach closes, I have to re reference the machine and part of that reference sequence is to home the carousel. If the actual tool doesn’t match what is in the spindle, I just change the DRO to match.
Lastly, I have this macro set to use 20 tools because that is what my carousel holds and the jobs I plan to run on this machine uses less than that.
If I needed more tools, I would make it empty the spindle and force a manual tool change prompt to complete the tool change sequence.
-
How would you check to see if the user presses stop during the macro?
If something isn’t right, I just hit the e stop. Hard reset for everything and it inhibits z axis movement just in case.
-
i add one registry that always reset it on start program(we have M function on head that start program ,open vacuum,blink light on remote...ets)
then i have event for stop press this event change registry value, so before any force output i always check that registry status
---about tool in spindle i agree if yours worker is professional ,but many times the worker near the machine not very professional
---stop while change tool its something happend to us many many times ,because when machine change tools many times user understand he made some mistake ,and instead of wait until finish tool change they press stop
---in some cases we add sensor that cheack if there tool on fork before unload ,to avoid accident
good luck
-
I get it.
We have 5 mills with Mach and 5 lathes with Mach. They understand to check the tool before hand. And if they stop the tool change, it usually requires me or my brother to reset it anyway, so we check to be sure it is good to go.
Post your code in here as well, if you don’t mind, let’s get a wealth of knowledge up in this forum!
-
sure why not but we have several types so im not sure which one i sent
because we have servo ,manual ,hood by cilynder hood by servo....
this one is typical