Arduino Mega 2560 R3+ Shield Ethernet w5100 ( Resolvido )

Bom pessoal,

já revirei o google e sites, blogs arduino procurando a solução.

Minha intenção é fazer o shield conectar a minha rede. Alguém já o fez conectar? No Youtube e tutoriais com o UNO funciona rapidinho e simples. No Mega mandam fazer ligação em outros pinos 50,51,52 e 53 e eu os fiz, mas quando faço o exemplo webserver o mesmo não funciona na rede, não consigo acesso ao navegador, e não consigo respostas de ping.

Sinceramente estou com poucas ideias para solucionar este problema. Alguém pode ajudar?

Quero simplesmente fazer ele funcionar na rede e exibir alguma informação. Nem isso estou conseguindo fazer com este shield.

Tira os fios... se olhares para o esquema do Shield e do Arduino reparas que a comunicacão entre eles é feita pelos 6 contactos com a marca ICSP...

Eu nunca usei o shield com um arduino mega, mas li isto:

Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). This is on digital pins 11, 12, and 13 on the Duemilanove and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. These pins cannot be used for general i/o. On the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won't work.

Se pudéssemos ver o teu código talvez conseguíssemos perceber o que se passa.

Obrigado por responder,

Vamos lá, tentei vários códigos e realmente com o mega tem algumas coisas que fogem do padrão e da simplicidade, como estou aprendendo estou tendo dificuldade em encontrar informação.

Segue o código que é o WebServer do exemplo que vem no software arduino. Só mudei o ip para a classse usada na rede em minha casa.

/*
  Web Server
 
 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield. 
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)
 
 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe
 
 */

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0, 30);

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
                    // add a meta refresh tag, so the browser pulls again every 5 seconds:
          client.println("<meta http-equiv=\"refresh\" content=\"5\">");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("
");       
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
}

Já tirei os fios como mostra as fotos em anexo a este post e os pinos 13,12,11,10 estão conectados de volta e os Pinos ICSP eu testei continuidade e estão todos ok.

Podem continuar me ajudando a resolver o básico da comunicação?

Eu consegui resolver.

O estranho foi que o shield ethernet só funcionou quando eu retirei ele do arduino mega compilei e enviei o codigo e depois desliguei e novamente unifiquei o shield ao arduino mega. Para minha surpresa funcionou bonitinho. o modulo ethernet. Segue o linnk e a biblioteca que usei.

http://www.seriallink.com.br/forum/viewtopic.php?f=90&t=2016#.UYFgOLXvvzw

http://www.seriallink.com.br/lab/arduino/EthernetSupW5100.zip

Curso Arduino Automation Aula 1 - Ethernet Shield (seriallink.com.br) - YouTube - O cara fala pra K!!!lho mas ajuda bem os iniciantes como eu a entender melhor o arduino.

Muito bom Newbie, também estava batalhando a procura dessa solução e realmente funcionou da forma que você descreveu! Mas percebi que não é necessário desconectar a Ethernet Shield apenas compilar, desconectar a USB e ligar novamente já basta
Uma duvida, você conectou a Shield normalmente ou também deslocou os pinos 11, 12 e 13?

Muito obrigado!

shssilva,
Você conectou o shield ethernet nos pinos de 11, 12 e 13 mesmo?

Já configurei o IP no exemplo Webserver mas ainda não consegui fazer o shield funcionar nem no Mega2560 nem no Uno. Os Leds do shield acendem mas não consigo acessá-lo pelo navegador.

Pessoal,
Resolvi meu problema simplesmente trocando o roteador.

  1. Eu usava uma rede com roteador da VIVO mas troquei de rede, com um roteador da NET;
  2. Conectei o Ethernet Shield W5100 normalmente sobre a placa Mega 2560 (sem tirar nem alterar nenhum pino fisicamente);
    RESULTADO: Tudo funcionou perfeitamente.

Acredito que seja alguma configuração do roteador da VIVO que seja necessário habilitar . Ainda não verifiquei isso, mas se alguém souber, poste aí.

faraujos:
Pessoal,
Resolvi meu problema simplesmente trocando o roteador.

  1. Eu usava uma rede com roteador da VIVO mas troquei de rede, com um roteador da NET;
  2. Conectei o Ethernet Shield W5100 normalmente sobre a placa Mega 2560 (sem tirar nem alterar nenhum pino fisicamente);
    RESULTADO: Tudo funcionou perfeitamente.

Acredito que seja alguma configuração do roteador da VIVO que seja necessário habilitar . Ainda não verifiquei isso, mas se alguém souber, poste aí.

qual versão do arduino vc usou? com certeza essa IDE ja tem a biblioteca que internamente troca os pinos.