epgodoy
Hello guys,
Modbus TCP/IP is already available for SCADA communication on OpenPLC. Unfortunately, Modbus TCP/IP is not currently supported by IoT infrastructure. Moreover, there aren’t many standard IoT protocols at all, IoT devices may use a range of communication options. 
MQTT is a protocol created for M2M and IoT equipment. It is open, simple and lightweight, and it works on top of TCP/IP, so it’s PLC friendly. I have seen some recent PAC (Programmable Automation Controllers) being released with MQTT option.
So, my question would be how to implement MQTT communication for the OpenPLC in the same way Modbus TCP/IP is currently available?
Thanks 
thiagoralves
I don't have much experience with MQTT, but to add any protocol to OpenPLC all you need to do is create a new .cpp file that will handle the protocol messages and translate that into changes to OpenPLC internal registers. For example, the modbus.cpp file handles all Modbus requests and read from/write to the bool_input, bool_output, int_input or int_output buffers, depending on the request. These buffers are OpenPLC's internal registers and are directly mapped to all physical I/Os.

There is also a TCP server already implemented on the server.cpp file. You can use that code for the underlying TCP if you want. You just need to create a new thread that will call the startServer(int port) function.
Reply 1 0
an87ton
Hello,
I am searching for an example, how to setaup mqtt communication. The idea is to read data from modbus device and then forward the data via mqtt to a broker. Then this data i handled by other software. I will appriciate if somebody just navigate me to some simple solution.
thnaks!
Reply 0 0
DannyvanLeeuwen
Something like this:  https://github.com/gavinying/modpoll.git
Reply 1 0
balun
Something like this:  https://github.com/gavinying/modpoll.git
Yeah, it works well. 
Reply 0 0
Reply