Read out PLC data over MODBUS every Xs and send over MQTT?
Sacirovic last edited by Sacirovic
I have a proof of concept project in mind for a potential client within the brewery industry.
Fist here's a simple context diagram of what I'd like to achieve:
Image link: https://pasteboard.co/GDoCYPq.png
The client has two air compressors running to supply compressed air for manufacturing PET-bottles. Once created/blown up, they are cleaned (more air used), filled (water, soda,beer), packed and shipped. In summary, it's pretty important that these machines are running 24/7. Each machine is controlled by a PLC, that ensures the physical they run correctly by reading inputs (temp, pressure) and monitoring these values against treashold values that must not be breached or the PLC shuts down the machine.
Read out the PLC process data over modbus every Xs and send it to a remote micro service (mqtt/Jason). Display the data on a dashboard in near real-time for remote readout. Monitor data against the same treasholds, alert the operations of a potential failure before the machine is shut down.
I am confident on the software side of things, hardware/modbus not so much...
To my eyes the unipi looks like it can fulfill all of the above, am I wrong?
Would I need a unipi per PLC or can I read more than one with a the single rs485/modbus connection?
Can I read the data of the PLC using nodered (nodered supports modbus) or will I need something more?
Modbus is a simple and easy to use request-response protocol. If you want to place Neuron in the place of RPi3 in your diagram, than it is ok. You should be able to implement the solution using NodeRed if it is possible for Nodered to open linux serial line to access Modbus RTU. All the IOs of Neuron can be acessed via Modbus TCP running on RPi except 1Wire - that has to be solved in a different way.
If you want to have more AIs, take a look at the Neuron 500 series and its Modbus RTU extensions: https://www.unipi.technology/news/model-line-neuron-5xx-in-stock-now-91
Just remember that if you want to have a 24/7 you must protect the SD card from writing as much as possible - have the FS mounted as readonly or you can start with the image for Mervis and disable the mervis services (mervisconfigtool, mervisrt, ...)
Sacirovic last edited by Sacirovic
Thank you for your reply, just a clarification on:
"You should be able to implement the solution using NodeRed if it is possible for Nodered to open linux serial line to access Modbus RTU."
This went over my head, can you elaborate a bit more? Essentially id like to use something like node-red-contrib-modbus. Will I not be able to do that? I'm aware it might come out a bit naive and it's simply not that easy.
To read out a value from the PLC to the UniPi over Modbus RTU, will I only need a UniPi with NodeRed (+flow) on top or is there more to it? Example I might look at for reading values over Modbus RTU?
I was thinking of using the Neuron M203 as a POC and move over to the Neuron 500 series as the pilot hardware. I assume the Neuron M203 supports both Modbus RTU & TCP? Otherwise i need to hurry and cancel my order of the M203 :)
@Sacirovic Yes, the lib for Nodered supports both Modbus TCP (for communication with Neuron IOs) and Modbus RTU for communication with external modbus devices connected to RS485. We do not have any example for NodeRed but there are some nice youtube videos from the guy that wrote the library...
To get it working you will need a Raspbian lite and this: https://github.com/UniPiTechnology/neuron_tcp_modbus_overlay After installation this will provide the TCP Modbus server and the RS485 available at /dev/extcomm/0/0