Can linuxCNC be (easily) made to send commands over ethernet to my CNC machine?

More
19 Jun 2023 15:34 - 19 Jun 2023 19:16 #273856 by mlw19mlw91
EDIT: Here's the important stuff first:

I have a CNC machine that communicates over ethernet.  I have found documentation on the communication protocols and I can "reverse engineer" them.  I don't want to use a mesa or any other card if it can be avoided.

I've attached thorough documentation, and here's a brief description:  

File Attachment:

File Name: EMCOETHERN...6-19.zip
File Size:513 KB

Captured and preprocessed data were analysed to determine a hexadecimal repre-
sentation of commands sent from the front-end PC to the back-end PC responsible for
different tasks. Additionally, reply and auxiliary patterns were identified and suggested.
After establishing a connection, the back-end PC sends a command, which indicates that it
is ready to receive initialisation settings files. The front-end PC replies with eight files, each
prefixed with an 8-bit command, except the last one. The back-end PC replies with a series
of commands and files and finally indicates the end of the initialisation process. Most other
tasks are accomplished in a much simpler form, usually a request followed by a reply in
one or two packets ranging from 8 to 40 bits each. Furthermore, during the connection,
the two PCs broadcast auxiliary packets. These auxiliary packets can be seen as repeated
patterns in the communication stream. Depending on the state of the machine, this pattern
can represent the current mode of the lathe, a timer, or a ping indicator.
Here's also a link you can read the academic journal article at:
Machines | Free Full-Text | Digitising a Machine Tool for Smart Factories (mdpi.com)


The DNC documentation is available here: 
www.emco-world.com\fileadmin\pim\Description_of_the_DNC_interface__Binary_mode__01.pdf
www.emco-world.com\fileadmin\pim\Description_of_the_DNC_interface__ASCII_mode__01.pdf

According to the research paper, these machines use a fully featured back end PC running a realtime flavor of linux.  I presume it may even be possible to install linuxcnc on the back end PC and eliminate the need for a 2nd pc.  How difficult do you think that that might be as well?
The same (or a very similar PC) is also used in a lathe that has a front end PC, but you can actually install a different OS on the backend pc, and that's all that you need.  
www.emco-world.com\fileadmin\user_upload\_Group\Manuals\Digitalanzeige\Installation_von_Digitalanzeige_an_Maschinen_C40_FB450_FB600_EM14D_17D_20D.pdf


Original: 
I have a CNC machine that communicates over ethernet.  I have found documentation on the communication protocols and I can "reverse engineer" them.  I don't want to use a mesa or any other card if it can be avoided.

Before I bother with that though, about how much of a difficulty is it to kindof modify linuxcnc or hal to communicate over ethernet with custom commands?

Also, so the machine sends an acknowledgement message every time it recieves and executes a packet.  The original controller waits for this signal before sending another packet.  The machine also responds with positional data (periodically) and some other information.  So there's going to be a little more to it than simply controlling the machine, as I'd also want to utilize the communication from the machine to linuxcnc.  

I found someone who has made their own server to communicate with these machines, so I know it's possible.  I have some programming experience with python and Arduinos, have setup linuxcnc before (using the wizard).  Not sure on the best course of action
Attachments:
Last edit: 19 Jun 2023 19:16 by mlw19mlw91. Reason: added additional information and files

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

More
19 Jun 2023 16:45 #273862 by tommylight
LinuxCNC does control machines through ethernet/ethercat/CIA405 etc etc.
From what little info you gave us, my reply would have been just a simple NO.
More info, what machine, what protocol, what controler, how are things wired, etc etc.
If you have no info, pictures or video should help, we are pretty good at figuring things out of those.
The following user(s) said Thank You: mlw19mlw91

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

More
19 Jun 2023 19:08 - 19 Jun 2023 19:22 #273867 by mlw19mlw91
^ Not expecting help, but that's appriciated!  
I've gone and updated my original post to have the important stuff first.  

I'm going into IT so networking is my thing, but one of my biggest concerns was, how I can utilize the signals coming back from the machine in LINUX CNC, and how I would make linuxCNC transmit packets without commands, like the initial handshake.  Learning a new programming language is to do this is exciting, not sure which I would be best off using though.

I mean in theory, I should be able to have my own server communicating with the machine, and linuxcnc communicating with the server?  
Attachments:
Last edit: 19 Jun 2023 19:22 by mlw19mlw91. Reason: additional information

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

More
19 Jun 2023 21:15 #273876 by rodw
I don't know if it's broken or not but the NML messaging system was originally designed to be client/server
www.nist.gov/ctl/smart-connected-systems...-configuration-files

It's my understanding that normal use runs the client (HMI GUI) and the Linuxcnc server on the same PC.

There are some config files here but it's hard to find documentation about this.
github.com/LinuxCNC/linuxcnc/tree/master/configs/common

You might just need to build a broker that maps from your commands to NML
The following user(s) said Thank You: mlw19mlw91

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

More
20 Jun 2023 00:02 #273885 by mlw19mlw91
Some more questions on alternative methods of conversion:
the machine's controller seems to be a PCI device on the control PC.  I know that linuxCNC is capable of using parallel ports, I'm curious if it'd be possible to use the control hardware built into the original back-end pc.  On my wifi router, I can use a shell to access the GPIO pins directly, for example, and make the lights flash or whatever.  And it's just as easy as writing a pin high.  Is linuxCNC like this?  can it auto discover connected devices and their IO pins?  In python for example, I can use some code to discover all of the input output devices on any PC.  Curious if linuxCNC can do that.  

Still thinking of all the possibilities to control the machine.  I see that the MESA card uses a custom driver and does not merely transmit over regular TCP / internet protocol.  I'm curious if I could just write a similar driver to send the packets we need over TCP.  

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

More
20 Jun 2023 07:40 - 20 Jun 2023 07:58 #273906 by Aciera
Just so we are on the same page,
Looking at the provided 'Description of the DNC interface' documentation tells me that this is used for communication for some kind of remote machine panel. So basically you could do this with any python gui with the challenge of sending the signals over the DNC interface.
You don't need or even want LinuxCNC for any of this since you are not replacing the controller.

LinuxCNC would replace the backend PC that (presumably) contains the controller and would communicate with the motor drives through the PCI device you mentioned.
To interface LinuxCNC to that PCI device you would need to write a driver (likely in C or maybe C++) which would be a quite advanced task and likely near impossible without full documentation of the hard- and firmware of the PCI device.
Last edit: 20 Jun 2023 07:58 by Aciera.

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

More
20 Jun 2023 09:09 #273909 by rodw
Just to clarify, the Linuxcnc PC is the motion controller so it works in real time. In other environments that use Windows that cannot be real time, the motion controller is often another hardware device connected by Ethernet or USB. So a copy of Linuxcnc must be at the machine.

You should be able to run a service in the Linuxcnc controller that receives your protocol commands and convert it to the relevant NML commands much like a Linuxcnc GUI does.

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

More
22 Jun 2023 17:40 #274059 by mlw19mlw91
Have I missed a stupidly simple option?  Not sure on best course of action.  Python sounds usable for me.  

I should mention that the DNC interface may not necessarily be suitable for direct control of the mill, as that may use a slightly different protocol.  The DNC protocol document does seem to describe parts of the packets I captured, but in some manuals, they seem to suggest that the DNC machine still requires the front-end windows PC.  Some of the manuals from EMCO are saying different things but not explicitly.  Some seemed to suggest that the instructions themselves were sent directly to the back-end pc, while others suggested that the g-code was interpreted on the front-end PC then sent to the backend pc in simpler instructions, such as "axis X 1 step positive direction", etc.  This theory would kindof make sense with the interchangeable controls.  For example, Fanuc, siemens, and Heidenheim all use slightly different flavors of g-code, no?  It seems unlikely to me that all different flavors of g-code would be processed differently on the back-end pc.  I think it would make more sense that the g-code is interpreted on the front-end pc then sent as simpler instructions to the back-end pc.  So I was thinking that I could use linuxcnc to send a packet commanding the correct axis one step at a time.

So I've been told that this is a possibility, but not sure it's necessary or worthwhile:

To make LinuxCNC output raw binary data over Ethernet TCP, you can use the Remote Machine Interface (RMI) feature of LinuxCNC. RMI allows you to exchange data between LinuxCNC and external programs or devices using a TCP/IP connection.Here are the steps to configure LinuxCNC to output raw binary data over Ethernet TCP:

  1. Ensure that you have LinuxCNC installed and running on your machine. Make sure your LinuxCNC configuration and machine setup are properly configured and operational.
  2. Create a custom component in LinuxCNC's configuration. A component is a module that handles data exchange between LinuxCNC and external programs/devices. You'll need to write a custom component that can handle the raw binary data output.
  3. Write the custom component using the HAL (Hardware Abstraction Layer) language. HAL allows you to define custom connections, signals, and functions for data exchange within LinuxCNC. In your custom component, you'll define an output signal that represents the raw binary data.
  4. In your custom component, use the
    netout
    function to send the raw binary data to the TCP/IP connection. The
    netout
    function allows you to send data to a remote program or device over TCP/IP.
  5. Configure the TCP/IP connection settings in your custom component. Set the IP address and port number of the remote program or device that will receive the raw binary data.
  6. Load and run your custom component within LinuxCNC. You can do this by adding the custom component to your LinuxCNC configuration file or using the LinuxCNC command-line options.
  7. Start the remote program or device that will receive the raw binary data over TCP/IP. Make sure it is listening on the specified IP address and port number.
  8. Once both LinuxCNC and the remote program/device are running, LinuxCNC will output the raw binary data over the TCP/IP connection. The remote program/device can then receive and process the data as per your requirements.
Note that implementing a custom component for raw binary data output requires programming skills in the HAL language. It's recommended to refer to the LinuxCNC documentation and resources for detailed guidance on writing custom components and working with the RMI feature.

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

More
22 Jun 2023 18:04 #274066 by tommylight
DNC,
www.cnccookbook.com/dnc-software-machine-monitoring-free-rs232/
-
Personally, i would retrofit it and have a normal machine.
That is an old and very not reliable way of running machines, so i would promptly get rid of it.
Not helping, am i ? :)

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

More
22 Jun 2023 18:05 #274067 by Aciera

So I've been told that this is a possibility, but not sure it's necessary or worthwhile:

Where did you get this from? Is this the result of some Chat GPT query?
I've never heard of such a 'Remote Machine Interface' feature. 

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

Time to create page: 0.180 seconds
Powered by Kunena Forum