supriyo
Hi,
I was trying to connect factory io and openplc runtime and for that I have chosen factory io as Modbus server (screenshot attached). After that I build a start stop latching circuit using openplc editor and save it as .st file. Then in the openplc runtime I have uploaded this .st (latching circuit) file and add factory io as a slave device. Then I build a scene in factory io using conveyer belt and start, stop button and assign start, stop and conveyer as per their address.
 
Now the problem is when I'm trying to connect the modbus server with runtime it's connecting but the logic is not working. That means when I press the start button, the conveyer is not moving.
 
But with the same setup when I'm trying to execute a simple logic (for example, one PB and one LED and they are directly connected) that is working with Factory IO.
 
Kindly help me to solve the issue.
Reply 0 0
thiagoralves
From the screenshot, it seems that your stop button on Factory IO is normally closed. Your ladder code expects a normally open stop button. In other words, you will have to press both start AND stop buttons together for your conveyor to run.
Reply 0 0
supriyo
Thank you so much Thiago. It's working fine now.
 
Now I want to control the start and stop button of factory io using Node-red. And for that I have configured the modbus node of Node-red also (screenshot attached). But it's not working.
 
Kindly help me.
Reply 0 0
thiagoralves
You’ll have to ask that on a Node-red forum
Reply 0 0
fg71
From your error it looks like your connection Client <-> Server is not correct.
In other words when you deploy your nodes they become active (I could see that from your first picture)
That doesn't mean the Client is connected to Server. Many times you get a full green icon.
 
And by getting a timeout error when a Client is trying to connect to IP and the respond is not 200
 
Ping the server, if success, check your configuration or use other modbus nodes.
Myself I use node-red-contrib-modbus without any issues.
Reply 0 0
supriyo
 
I have checked the server and it's pinging and I'm also using node-red-contrib-modbus. But it's not working.
 
Can the reason be: I'm choosing FC 5: Force Single Coil in the node-red and I'm using %IX100.0 and %IX100.1 for start and stop?
 
And the timeout error I'm getting is for different nodes.
Reply 0 0
thiagoralves
You can't control the start and stop buttons from any Modbus client based on the way you set up your buttons on Factory IO. They are tied to inputs, which means you can only read them, not write to them. Modbus does not have a function code to write to inputs.
Reply 0 0
fg71
I'm not sure OpenPLC have a memory address to be able to write to like other PLC does that point to memory space and not physical input or output that is read only.
Reply 0 0
thiagoralves
OpenPLC has %MW, %MD and %ML memory regions that are readable and writable through Modbus. But I don't think this is related to OP's question. If I got it correctly, OP is interested in writing to these tags from Nodered, not OpenPLC.
Reply 0 0
supriyo
For my start and stop button when I've used %QX100.1 and %QX100.2 address, it's not working from factory IO also.
 
Basically I can only read from input so I changed my start and stop button address to coils. Now my start button and stop button address are %QX100.1 and %QX100.2. My led address is %QX100.0. I'm using the same modified ladder diagram suggested by you previously. But this time conveyor is not moving in the factory IO when I press the start button.
Reply 0 0
fg71
I believe the panel in FactoryIO for push button is physical input. After all FactoryIO purpose is to simulate sensors and actuators to be used to solve a task. Node-Red could be used as bridge between Client and Server. Meaning a user could write a logic in JavaScript that behave the same as it does in OpenPLC or IEC-61131-3 programming language. When a user switch a button on panel to start. A sensor is activated on conveyor (this signal is communicated on Modbus Tcp protocol). Node-Red get its state and JavaScript function is executed. This function set the state for Client input and brake the connection between sensor and actuator and conveyor (motor) stop.
 
The same approach is possible in Python with functions to simulate plc program.
 
Why OP like to use Node-Red I'm not sure of when IEC-61131-3 programming language is what FactoryIO is all about.
 
I have in the past simulated PID controller in Python using matplotlib and FactoryIO thats why I said on other question about PID that output data or collected data could be used to set the values for inputs. PID controller or in modern system analyze data and optimize the control data.
Reply 0 0
thiagoralves
You wired your push buttons as outputs, which means they won’t ever do anything when you press them on factory IO because they are outputs (they receive action, not make them). In this scenario the only way to start the conveyor is from the PLC side, writing 1 to the PLC coil.
Reply 0 0
fg71
I use FactoryIO as Client and when I push button on the panel (in FactoryIO UI) that is input for my plc program. I do not use FactoryIO as Modbus Server. At least that is what I did when I used the tank simulator.
Reply 0 0
supriyo
 
I want to use openplc runtime as modbus server and for that I have deleted the slave device (factory io). I have changed the addressing also. Now my start button is %IX0.0, stop button- %IX0.1 and conveyor- %QX0.0. And in the factory io I choose modbus client and try to connect to the openplc modbus server. It's connected with the server but in the factory io when I press the start button, conveyor is not moving the way I want. It's moving if I hole the start button.  
 
Pls help me. I don't know where I'm going wrong
Reply 0 0
AndBat
I don't know in deeply how OpenPLC runtime works, but usually is not a good practice to use a QX as input. You can try replacing LED variable with a local one and then use this new variable to write LED.
Reply 0 0
Reply