Ethernet Troubleshooting
30 abril, 2019 por
Ethernet Troubleshooting
Serzh Ohanyan

Troubleshooting of Ethernet, available only for M-Duino family, step by step:

  • Ensure that the controller is powered between 12-24 Vdc. Just with USB is insufficient to power to power up the Ethernet communication. 

  • For the Ethernet communication protocol there isn't any switch that affects it. So it does not matter the configuration of the switches to implement Ethernet communication. 

  • For Ethernet communication protocol, the defined Arduino Mega pin is pin 10, which is connected and already assembled to the WX5500 Ethernet controller. W5500 IC communicates to the Mega board via SPI bus already assebmled too. You can access easly to Ethernet port in our Ethernet PLCs, it is located at the top of the communications layer. 


IMPORTANT: Make sure to download the Arduino based PLC boards for Arduino IDE. 

Software Configuration

Once the hardware configuration is done, it is possible to proceed with the software configuration and also its usage. Firstly it is necessary to include the Ethernet2.h library provided by Industrial Shields (has the same functionality as Ethernet.h and also the same usage).

*Attention do not use old libraries like MDuino.h or Ardbox.h, these libraries are deprecated and can cause mapping issues to your controller.


For versions V7 or earlier you must use the <Ethernet.h> library. 


Software Example 

To see that Ethernet works correctly, in this example we define an M-Duino as a client and connect to an operating server, Google. If the connection was successful, "Connected to server" is printed, otherwise "Connection failed!". 


// use Ethernet.h if you have a M-Duino V7 version or +
#include <Ethernet2.h>

byte mac[] = {0xBE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // mac address for M-Duino
byte server[] = {8, 8, 8, 8}; // Google 
int tcp_port = 53; // DNS port
char character;
bool ping = false;
int start_time;

EthernetClient client;

void setup(){
  Serial.begin(9600);
  Ethernet.begin(mac); // IP given by DHCP
  Serial.println(Ethernet.localIP()); // print M-Duino ip
  Serial.println("Connecting...");
  if (client.connect(server, tcp_port)){ // Connection to server
    Serial.println("Connected to server");
  } 
  else Serial.println("Connection failed!"); 
}

void loop(){
}


Be sure about...

  • Define an IP for the M-Duino. 

  • That the server you want to connect is active. 

  • Connect to the right port. 

Ethernet Troubleshooting
Serzh Ohanyan
30 abril, 2019
Compartir
Archivar

¿Buscas tu controlador lógico programable ideal?

Echa un vistazo a esta comparativa de producto de varios controladores industriales basados en Arduino.

Comparamos entradas, salidas, comunicaciones y otras especificaciones con las de los equipos de otras marcas destacadas.


Comparación PLC industrial>>>

¿Quieres más información?

¡Rellena el formulario!

¡Cuéntame más!