soura
Can I use OpenPLC runtime on a Raspberry Pi to send out data(serial) to a REST API end point or HTTP end point natively?
Reply 0 0
fg71
I have Raspberry Pi 5 but have never used OpenPLC runtime on it. But other approach would be to send data to Node-Red (it could also been running on Raspberry Pi) and let Node-Red to do the REST API for you. In Node-Red you could configure with nodes to build a flow. In other words you build your payload from data from OpenPLC runtime. And do HTTP request from REST API.
 
To get data from OpenPLC runtime you could use modbus tcp or access Raspberry Pi directly in Node-Red.
Reply 1 0
soura
I have Raspberry Pi 5 but have never used OpenPLC runtime on it. But other approach would be to send data to Node-Red (it could also been running on Raspberry Pi) and let Node-Red to do the REST API for you. In Node-Red you could configure with nodes to build a flow. In other words you build your payload from data from OpenPLC runtime. And do HTTP request from REST API.
 
To get data from OpenPLC runtime you could use modbus tcp or access Raspberry Pi directly in Node-Red.
So to break the above up, it basically are 2 devices: 1 PLC(OpenPLC based) generating the data and Raspberry Pi based Node-Red/python code which sends the data to the API endpoint. I would want it directly from OpenPLC to external endpoint. Is that possible with OpenPLC runtime?
Reply 0 0
fg71
So to break the above up, it basically are 2 devices
No, its the same device (raspberry pi). Both are access from same IP but use a different port.
Reply 1 0
thiagoralves
OpenPLC does not have any functionality to send HTTP requests. The easiest approach would be to have a Python application running on the same machine that makes the bridge between the OpenPLC application (taking Modbus) and your REST API
Reply 1 0
fg71
To make it simple for you.
 
  1. Start to get to use to or get knowledge about Node-Red.
  2. Inside Node-Red you could build flow with Modbus Client and Server in the same flow.
  3. You could simulate a injection (Modbus Client send some data)
  4. From the Modbus Server payload you could filter its data and build your RESTful API.
  5. When you have all this working in Node-Red you could learn how to connect OpenPLC to Node-RED with Modbus.
  6. In other words OpenPLC is your Modbus Client and inside Node-Red you have Modbus Server.
Reply 0 0
kortenbach
OpenPLC does not have any functionality to send HTTP requests. The easiest approach would be to have a Python application running on the same machine that makes the bridge between the OpenPLC application (taking Modbus) and your REST API
Hi Thiago,
I remember that we talked about running Arduino code and open PLC on the same microcontroller. That might also work(?)
Reply 0 0
Reply