Skip to main content
1 of 2

How to make MQTT and ArduinoModbus libraries working on the same Ethernet port?

I have a SAMD51P20 based Arduino PLC with WIZnet W5500 based Ethernet shield. I'm using these libraries:

#include <Ethernet.h>
#include <MQTT.h>
#include <ArduinoModbus.h>

MQTT and Modbus-TCP clients run fine individually, but running them at the same time creates problems with both of them.

Is there a software solution to this problem, e.g. using separate sockets for MQTT and Modbus-TCP. WIZnet W5500 has 8 sockets available, but I don't see an API to select a socket for MQTT and Modbus-TCP client.

If not software, is there a hardware solution?