I'm trying to set up my Raspberry Pi to read data from a PLC over Modbus TCP and sending this data over to cloud using MQTT. Now, I'm able to read the data from PLC and send the same to the cloud using MQTT separately. However, when I try to do both the things i.e. reading data over MB and sending over MQTT, it doesn't work. Could anyone help me with this, please?
Here's a configuration of my setup:
PLC (192.168.0.113)- MB TCP Slave
RP Ethernet (192.168.0.120) - MB TCP Master
RP WiFi (192.168.1.170)
Wifi Router (192.168.1.254) - connected to Internet
when I connect Ethernet cable b/n PLC and Raspberry Pi - I can read PLC data via Modbus
when I disconnect the Ethernet cable - MQTTout node sends the data to cloud. It shows status as 'Connected'
when I connect the Ethernet cable back - I can read PLC data via Modbus but MQTTout node turns to 'Disconnected' status and stops the comm with the cloud
So, in short when I try to do both (Modbus and MQTT) connections at a time, MQTTout node loses it's connection with the Cloud. Hope, I explained it clearly
Below is my ipconfig and route output on raspberry Pi
bdw, I tried removing the default gateway for 'eth0' interface and guess what, it worked! I'm grateful for your support, Thanks a lot!
But I still don't understand, having different subnets for 'wlan0' and 'eth0', it should work just fine. How does removing default gateway can help? (sorry for a network specific question on this forum, but I'm kind of newbie in this area)