Hello Guest it is April 19, 2024, 04:19:08 AM

Author Topic: How to link external controller and tool number?  (Read 1823 times)

0 Members and 1 Guest are viewing this topic.

How to link external controller and tool number?
« 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?

 
Re: How to link external controller and tool number?
« Reply #1 on: July 26, 2022, 08:51:35 AM »
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.
« Last Edit: July 26, 2022, 08:54:43 AM by Cbyrdtopper »
Chad Byrd
Re: How to link external controller and tool number?
« Reply #2 on: July 26, 2022, 09:31:49 AM »
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!
Re: How to link external controller and tool number?
« Reply #3 on: July 26, 2022, 09:37:17 AM »
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.
Chad Byrd
Re: How to link external controller and tool number?
« Reply #4 on: July 26, 2022, 09:39:31 AM »
Thanks for sharing a good source.

These will be of great help!!
Re: How to link external controller and tool number?
« Reply #5 on: July 26, 2022, 09:45:20 AM »
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).
Re: How to link external controller and tool number?
« Reply #6 on: July 26, 2022, 10:27:51 AM »
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).
Re: How to link external controller and tool number?
« Reply #7 on: July 26, 2022, 12:25:43 PM »
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.
Chad Byrd
Re: How to link external controller and tool number?
« Reply #8 on: July 26, 2022, 08:38:25 PM »
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?


Re: How to link external controller and tool number?
« Reply #9 on: July 26, 2022, 09:39:20 PM »
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.
Chad Byrd