Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: pietro.odaglia on February 13, 2020, 08:26:47 AM

Title: Synchronized I/Os over Modbus (?)
Post by: pietro.odaglia on February 13, 2020, 08:26:47 AM
Hi all,

I am trying to wrap my head around the following problem:
I have multiple devices controlled over i2c that I want to operate according to the position of the 3 axes of a my cnc setup.

To visualize the problem one could imagine to have the following situation:
- 4 nozzles attached to a CNC setup
- the CNC moves the nozzles around over a plane
- according to the current position, each nozzle is turned either on or off

As I see it, one would need two sets of data:
1) toolpaths, fed to Mach3 as gcode
2) 2D matrix of 0s and 1s representing the raster "image" to be printed, loaded on a PLC
and
3) a way to communicate the position of the axes from Mach3 to the PLC and, consequently, operate the devices nozzles consistently

Given that all the assumptions above make sense, would Modbus be the best channel for transmitting such information?
Or do you know of any better way to reach a similar result?

Thanks,
Pietro
Title: Re: Synchronized I/Os over Modbus (?)
Post by: joeaverage on February 13, 2020, 01:19:11 PM
Hi,
Modbus is not a realtime communication protocol thus there could be a timing error of tens of milliseconds between
your machine (under Mach control) being at a given location and your nozzles responding to being at that location.
Is the timing of the nozzels critical?

Craig
Title: Re: Synchronized I/Os over Modbus (?)
Post by: joeaverage on February 13, 2020, 01:35:17 PM
Hi,
you might be interested in some of the features of Mach4. In addition to six coordinated axes Mach4 can have up to six Out-of-Band (OB) axes.
The OB axes are jogged from either your Gcode or from a script which monitors machine position. The timing uncertainty diminishes
from tens or even hundreds of milliseconds with Mach3 and Modbus to sub millisecond with Mach4. Note there would be no need for a PLC
but you would require an external motion controller like an ESS or UC300 that had enough outputs to utilise the OB's.

Craig
Title: Re: Synchronized I/Os over Modbus (?)
Post by: pietro.odaglia on February 13, 2020, 06:55:15 PM
Hi Craig, thanks for the input.
I briefly checked what features Mach4 offers. The OB Axes you mentioned might be interesting but, as far as I understand, the limit is 6 (industrial version) and they will output step/dir signals, which I should then intepret somewhere and translate to device specific instructions (or?).
Is there a faster way than Modbus to communicate the axis position to an external PLC in Mach3/4 (without adding encoders)?

Pietro
Title: Re: Synchronized I/Os over Modbus (?)
Post by: joeaverage on February 13, 2020, 11:08:09 PM
Hi,
firstly Mach4Hobby DOES have all six OB axes and yes they are step/direction. If you require plain on/off outputs for your nozzles then you need not
use OB axes at all. Mach (3 or 4) has plenty of digital outputs.

Quote
Is there a faster way than Modbus to communicate the axis position to an external PLC in Mach3/4 (without adding encoders)?

No. Part of the issue is that Mach (3 or 4), in fact ALL Windows PC CNC solutions, have a motion buffer. Thus Mach may have issued
trajectory data but will not be enacted for some variable time later, thus at any given time mach does not know precisely where the machine
is, it knows where it will be a time slice nnnnn.mm but not right now.

The second part of the issue is that Modbus is a serial communication protocol and a fairly slow one at that. Any sense of simultaneity
between signals is lost.

Using Brains (in Mach3) or equivalently PMC (in Mach4) allows much tighter control, possibly within milliseconds.

Craig
Title: Re: Synchronized I/Os over Modbus (?)
Post by: TPS on February 14, 2020, 01:53:55 AM
just a thought, maybe i am thinking to easy.
why not turning the nozzles on/off by customized M call's

for example:

G1 X10 F100
M200 'turn nozzle 1 ON
G1 X20
M201 'turn nozzle 1 OFF


Title: Re: Synchronized I/Os over Modbus (?)
Post by: pietro.odaglia on February 15, 2020, 04:44:13 AM
Quote
firstly Mach4Hobby DOES have all six OB axes and yes they are step/direction

I didn't check personally, but here https://www.machsupport.com/wp-content/uploads/2014/06/Mach%20Version%20Differences_doc_a9.pdf (https://www.machsupport.com/wp-content/uploads/2014/06/Mach%20Version%20Differences_doc_a9.pdf) it says 1 OB for hobby, 6 for industrial.

In any case, thanks for your support. I'll check further the macro approach, but I think the most straightforward way is indeed to plug in a few encoders and start from there.

Pietro
Title: Re: Synchronized I/Os over Modbus (?)
Post by: joeaverage on February 15, 2020, 04:49:39 AM
Hi,
that link is out of date, Mach4Hobby has six OB axes.

Craig