ok I changed the pins to 7 8 9 and it still disconnect after a couple of minutes we also have on the same switch 3 other arduinos with w5100 ethernet shield from china I noticed from the debug that they all have the exact same mac address as soon as I switch them off it stopped disconnecting
uno
[0] MAC: FE-64-78-5E-6B-B2
[513] IP: 192.168.1.106
[514] Connecting to mqtt.mydevices.com:1883
[1143] Connected
[1328] Publish: topic 4, channel 65534, value Arduino Uno, subkey , key
[1339] Publish: topic 6, channel 65534, value ATmega328P, subkey , key
[1416] Publish: topic 7, channel 65534, value 16000000, subkey , key
[1489] Publish: topic 5, channel 65534, value 1.2.0, subkey , key
[1560] Publish: topic 8, channel 65534, value W5100, subkey , key
[4638] Publish: topic 1, channel 1, value 0, subkey null, key counter
[4646] Publish: topic 1, channel 2, value 0, subkey null, key counter
[4721] Publish: topic 1, channel 3, value 0, subkey null, key counter
[13825] Connection ok
[19845] Publish: topic 1, channel 1, value 0, subkey null, key counter
[19854] Publish: topic 1, channel 2, value 0, subkey null, key counter
[19929] Publish: topic 1, channel 3, value 1, subkey null, key counter
[24518] Connection ok
[35053] Publish: topic 1, channel 1, value 0, subkey null, key counter
[35063] Publish: topic 1, channel 2, value 0, subkey null, key counter
[35138] Publish: topic 1, channel 3, value 1, subkey null, key counter
[35213] Connection ok
[45768] Connection ok
[50284] Publish: topic 1, channel 1, value 0, subkey null, key counter
[50293] Publish: topic 1, channel 2, value 0, subkey null, key counter
[50368] Publish: topic 1, channel 3, value 1, subkey null, key counter
[56463] Connection ok
[63484] Disconnected
[63485] Connecting to mqtt.mydevices.com:1883
[63955] Connected
[64141] Publish: topic 4, channel 65534, value Arduino Uno, subkey , key
[64153] Publish: topic 6, channel 65534, value ATmega328P, subkey , key
[64230] Publish: topic 7, channel 65534, value 16000000, subkey , key
[64305] Publish: topic 5, channel 65534, value 1.2.0, subkey , key
[64376] Publish: topic 8, channel 65534, value W5100, subkey , key
[65951] Publish: topic 1, channel 1, value 0, subkey null, key counter
[65960] Publish: topic 1, channel 2, value 0, subkey null, key counter
[66036] Publish: topic 1, channel 3, value 2, subkey null, key counter
[67615] Connection ok
[78150] Connection ok
[81161] Publish: topic 1, channel 1, value 0, subkey null, key counter
[81170] Publish: topic 1, channel 2, value 0, subkey null, key counter
[81246] Publish: topic 1, channel 3, value 2, subkey null, key counter
[88845] Connection ok
[96370] Publish: topic 1, channel 1, value 0, subkey null, key counter
[96379] Publish: topic 1, channel 2, value 0, subkey null, key counter
[96454] Publish: topic 1, channel 3, value 2, subkey null, key counter
[99539] Connection ok
[110074] Connection ok
[111580] Publish: topic 1, channel 1, value 0, subkey null, key counter
[111590] Publish: topic 1, channel 2, value 0, subkey null, key counter
[111666] Publish: topic 1, channel 3, value 3, subkey null, key counter
[120771] Connection ok
[126792] Publish: topic 1, channel 1, value 0, subkey null, key counter
[126802] Publish: topic 1, channel 2, value 0, subkey null, key counter
[126878] Publish: topic 1, channel 3, value 3, subkey null, key counter
[131469] Connection ok
[142004] Publish: topic 1, channel 1, value 0, subkey null, key counter
[142015] Publish: topic 1, channel 2, value 0, subkey null, key counter
[142090] Publish: topic 1, channel 3, value 3, subkey null, key counter
[143166] Disconnected
[143166] Connecting to mqtt.mydevices.com:1883
[143639] Connected
[143834] Publish: topic 4, channel 65534, value Arduino Uno, subkey , key
[143848] Publish: topic 6, channel 65534, value ATmega328P, subkey , key
[143926] Publish: topic 7, channel 65534, value 16000000, subkey , key
[144002] Publish: topic 5, channel 65534, value 1.2.0, subkey , key
[144074] Publish: topic 8, channel 65534, value W5100, subkey , key
[145650] Connection ok
[156185] Connection ok
[157690] Publish: topic 1, channel 1, value 0, subkey null, key counter
[157701] Publish: topic 1, channel 2, value 0, subkey null, key counter
[157776] Publish: topic 1, channel 3, value 4, subkey null, key counter
[166882] Connection ok
[172902] Publish: topic 1, channel 1, value 0, subkey null, key counter
[172913] Publish: topic 1, channel 2, value 0, subkey null, key counter
[172989] Publish: topic 1, channel 3, value 4, subkey null, key counter
[177580] Connection ok
[188114] Publish: topic 1, channel 1, value 0, subkey null, key counter
[188125] Publish: topic 1, channel 2, value 0, subkey null, key counter
[188200] Publish: topic 1, channel 3, value 4, subkey null, key counter
[188277] Connection ok
[198834] Connection ok
[203350] Publish: topic 1, channel 1, value 0, subkey null, key counter
[203360] Publish: topic 1, channel 2, value 0, subkey null, key counter
[203436] Publish: topic 1, channel 3, value 5, subkey null, key counter
[209531] Connection ok
[218562] Publish: topic 1, channel 1, value 0, subkey null, key counter
[218572] Publish: topic 1, channel 2, value 0, subkey null, key counter
[218647] Publish: topic 1, channel 3, value 5, subkey null, key counter
[219723] Disconnected
[219724] Connecting to mqtt.mydevices.com:1883
[220258] Connected
[220442] Publish: topic 4, channel 65534, value Arduino Uno, subkey , key
[220456] Publish: topic 6, channel 65534, value ATmega328P, subkey , key
[220534] Publish: topic 7, channel 65534, value 16000000, subkey , key
[220610] Publish: topic 5, channel 65534, value 1.2.0, subkey , key
[220683] Publish: topic 8, channel 65534, value W5100, subkey , key
[222259] Connection ok
[232794] Connection ok
[234299] Publish: topic 1, channel 1, value 0, subkey null, key counter
[234309] Publish: topic 1, channel 2, value 0, subkey null, key counter
[234386] Publish: topic 1, channel 3, value 5, subkey null, key counter
[243491] Connection ok
[249511] Publish: topic 1, channel 1, value 0, subkey null, key counter
[249522] Publish: topic 1, channel 2, value 0, subkey null, key counter
[249597] Publish: topic 1, channel 3, value 6, subkey null, key counter
[254188] Connection ok
mega
[0] MAC: FE-64-78-5E-6B-B2
[4526] IP: 192.168.1.106
[4527] Connecting to mqtt.mydevices.com:1883
[5156] Connected
[5342] Publish: topic 4, channel 65534, value Arduino Mega, subkey , key
[5354] Publish: topic 6, channel 65534, value ATmega2560, subkey , key
[5430] Publish: topic 7, channel 65534, value 16000000, subkey , key
[5504] Publish: topic 5, channel 65534, value 1.2.0, subkey , key
[5574] Publish: topic 8, channel 65534, value W5100, subkey , key
[8653] Publish: topic 1, channel 1, value 0, subkey null, key counter
[8662] Publish: topic 1, channel 2, value 0, subkey null, key counter
[8735] Publish: topic 1, channel 3, value 1, subkey null, key counter
[17840] Connection ok
[23861] Publish: topic 1, channel 1, value 0, subkey null, key counter
[23870] Publish: topic 1, channel 2, value 0, subkey null, key counter
[23945] Publish: topic 1, channel 3, value 1, subkey null, key counter
[28535] Connection ok
[39071] Publish: topic 1, channel 1, value 0, subkey null, key counter
[39080] Publish: topic 1, channel 2, value 0, subkey null, key counter
[39155] Publish: topic 1, channel 3, value 1, subkey null, key counter
[39230] Connection ok
[49787] Connection ok
[54303] Publish: topic 1, channel 1, value 0, subkey null, key counter
[54312] Publish: topic 1, channel 2, value 1, subkey null, key counter
[54387] Publish: topic 1, channel 3, value 2, subkey null, key counter
[60483] Connection ok
[67504] Disconnected
[67505] Connecting to mqtt.mydevices.com:1883
[67990] Connected
[68175] Publish: topic 4, channel 65534, value Arduino Mega, subkey , key
[68189] Publish: topic 6, channel 65534, value ATmega2560, subkey , key
[68267] Publish: topic 7, channel 65534, value 16000000, subkey , key
[68341] Publish: topic 5, channel 65534, value 1.2.0, subkey , key
[68413] Publish: topic 8, channel 65534, value W5100, subkey , key
[69988] Publish: topic 1, channel 1, value 0, subkey null, key counter
[69997] Publish: topic 1, channel 2, value 1, subkey null, key counter
[70072] Publish: topic 1, channel 3, value 2, subkey null, key counter
[71652] Connection ok
[82188] Connection ok
[85198] Publish: topic 1, channel 1, value 0, subkey null, key counter
[85208] Publish: topic 1, channel 2, value 1, subkey null, key counter
[85282] Publish: topic 1, channel 3, value 2, subkey null, key counter
[92883] Connection ok
[100409] Publish: topic 1, channel 1, value 0, subkey null, key counter
[100419] Publish: topic 1, channel 2, value 1, subkey null, key counter
[100495] Publish: topic 1, channel 3, value 3, subkey null, key counter
[103581] Connection ok
[114117] Connection ok
[115622] Publish: topic 1, channel 1, value 0, subkey null, key counter
[115634] Publish: topic 1, channel 2, value 1, subkey null, key counter
[115709] Publish: topic 1, channel 3, value 3, subkey null, key counter
[124816] Connection ok
[130837] Publish: topic 1, channel 1, value 0, subkey null, key counter
[130847] Publish: topic 1, channel 2, value 1, subkey null, key counter
[130923] Publish: topic 1, channel 3, value 3, subkey null, key counter
[135515] Connection ok
[146051] Publish: topic 1, channel 1, value 0, subkey null, key counter
[146061] Publish: topic 1, channel 2, value 1, subkey null, key counter
[146136] Publish: topic 1, channel 3, value 4, subkey null, key counter
[147212] Disconnected
[147213] Connecting to mqtt.mydevices.com:1883
[147687] Connected
[147872] Publish: topic 4, channel 65534, value Arduino Mega, subkey , key
[147887] Publish: topic 6, channel 65534, value ATmega2560, subkey , key
[147965] Publish: topic 7, channel 65534, value 16000000, subkey , key
[148041] Publish: topic 5, channel 65534, value 1.2.0, subkey , key
[148114] Publish: topic 8, channel 65534, value W5100, subkey , key
[149689] Connection ok
the uno and the mega have different w5100 shields but with exact same MAC I will now set the MAC addresses manually.
Please beware of these chinese w5100 they gave us alote of trouble 1st wrong resistor now same mac.
the counters and code works fine though thanks for the help!