I'm working on a project where the aim is to connect a number of machines with different PLCs to Node-red and send alarm signals via mqtt. The PLCs are Mitsubishi, old and new ones.
My experience of PLCs are basically zero. What's the best method for extracting alarm signals from PLCs to Node-Red?
Disclaimer: You are solely responsible for anything you may muck up in the PLC. By going online with the PLC, you are assuming full responsibility for anything that happens to your PLC or associated equipment or persons. Do not come back into this forum stating that I/me/we/them/they broke your PLC or caused any other type of calamity. Going into this without any knowledge of PLCs is a tall task, frankly scary if your PLCs are used for mission critical applications.
There really is no "best method", just the one that you are comfortable with and will work in your situation.
Before you go much further down this road, check these:
Do you have the Mitsubishi PLC software, I believe it is GxWorks?
Do you have copies of the PLC programs on your PC?
Can you get training on Mitsubishi PLCs, or is there someone you know who can help?
If you answered no to either of those questions, you need to solve that first.
If yes to all, then read below.
Not very familiar with Mitsubishi PLCs, but there is a node you can download to node-red called node-red-contrib-mcprotocol.
This claims to be able to read/write data over ethernet to/from your PLC.
That's great if your PLCs have ethernet, or rather that is one box checked. The next thing is if there are variables in the PLC that are granted access to be read/wrote from ethernet. Generally, PLCs don't have all of their data set to be read/wrote from external sources by default. The user typically has to go in and tell the PLC which variables it should grant external access. Again, I am not familiar with Mitsubishi, so you will need to check for yourself.
Its possible that your PLCs have ModbusTCP support, there is a node for that as well. Again, it will require you to setup which variables to grant access.
@rolfStudent. I presume from your name that you are a student, are you? In that case you should try and learn Modbus communication with PLC on a test bench before you try it out on the actual machine. I have assumed that Mitsubishi PLC uses Modbus protocol, does it? If not then it is a different ball game.
I haven't used Mitsubishi PLCs but the general protocol used by most PLCs is the same. Assuming that the PLC uses Modbus protocol to comunicate, there are two methods of Reading and Writing to and from PLC a) ModbusRTU b) ModbusTCP. ModbusRTU is used to communicate over serial ports such as RS232 or RS485 for example and ModbusTCP is over Ethernet. There are Bits, Word and Dword that can be read or written to the PLCs. On the PLC there are Inputs (Input Registers, Bit), Outputs (Coils, Bits), Analog I/O (Holding Registers, Word or Dword). First you should see how you can read and write from the PLC and then go a step further about mqtt.
Tell us how do you intend to physically connect the PLC to Node-RED? Is your Node-RED platform on Windows or Linux? and then what type of ports are available on the PLC? RS232 or RS485 or Ethernet? A line diagram would help to understand what you intend to hardwire. Try to work on Node-RED - one PLC first, subsequently you can link more PLCs to the same network with just a different device address on each.