Hi. I am connecting an Arduino, ethrnet shield, xbee-shield with an xbee that reads reservoir levels from four reservoirs, and sends the data to a Logo!8 Siemens PLC through an ethernet Modbus connection. All devices is connected through a 5 port switch. Everything works 100%! However, it only connects when my desktop PC is also connected in the network. It also keeps working for a while if I disconnect the desktop PC. But when I restart the Arduino without the desktop PC connection it would not connect at all. Do anyone by any change know why? The PC should not be part of the connection and it's only purpose is to load the program files to the individual devices. The Arduino, the Logo, and the HMI.
Even if my laptop is connected it would not connect.
The system has been running now for about 24 hours without my PC. It looks to me like the system only needs my computer to start the modbus and ethernet connection and then it can run without it.
New discovery, it needs not the computer but the main Netgear router. The local ethernet is connected from my PC to the Netgear router via lan connections. I use it to connect to other devices like a printer and these projects. So when the Netgear router is connected the Arduino system starts up, but without it not.
void EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet);
is in Ethernet.h. you don't have to put it in the sketch
Thank you for your assistance as well. My project is installed and running 100%. There are a few other aspects at play to complete still. I shall in due course publish my project for everyone to view. I have seen a lot of questions, especially on the Siemens forums about the modbus connections between the Arduino and the Siemens PLC. The answer or fix was actually very simple yet is hidden under a misconception of how the ethernet instructions works!
The graphs on the display below is actual reservoir levels of four reservoirs, and is read with ultrasonic sensors feeding info int xbee radios, then transmitted to one receiving xbee radio, that is feeding an Arduino UNO using a xbee-shield, that in return sends this values to the LOGO!8 PLC via an Arduino ethernet shield. It happens in real-time, and is running 24/7. The PLC now determine according to these reservoir levels which reservoir to fill. This unit/system is in a water purifying plant with one 35KW pump and some control valves that will pump water where and when to fill a selected reservoir. No reservoir will be allowed to have less than 60% of water.
This system has so many advantages! See Picture attached.
WP level control now fully functional on all reservoirs.
R1 shows empty, because it is empty for repairs!