ethernet cable middle man

hi, i spliced an ethernet cable that goes from my laptop to the router and hooked it up as a middle man to my arduino, first i tried using rx to get data from the ethernet cable to try to output its network activity but i get garbage data, and than i tried pulsein method with an unsigned number and it gave me to many random values that dont help me in detected network activity through the ethernet cable, im trying to read the network cable so i can make an application that rings everytime it detects something go through the network line, and it must be done through the cable, so does anyone know how to make the arduino interpret ethernet data, and even if you cant make a driver to get it to understand the data atleast something that can detect a difference between network activity and no network activity with a value, thanks

You might be able to detect network activity, but I doubt it. You certainly will not be able to capture any of it, or determine what is being sent or received.

I have a seeed ethernet shield if that helps

Which Arduino are you using? If it is any of the 16MHz units, it isn't fast enough to process normal network traffic to determine what is being sent or received by the other network devices. I'm not certain you can put a Wiznet controller into promiscuous mode.

Arduino uno:

char myByte;
void setup() {
Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(15,OUTPUT);
}

void loop() {
if(Serial.available() > 0){
myByte = Serial.read();
Serial.print(myByte);
}
}

with this code I can communicate between 2 arduinos through tx-rx

when its connected to the ethernet ground and positive i get unfinished byte looking data. like when you interpret a byte at the wrong interval.

You did not answer SurferTims question on your Arduino model.

What you want to do is impossible as he said.
Seed ethernet shields have 10Mbit/s as lowest transfer rate.
Since you need to capture each bit you need to capture 10,000,000 bits per second, which cannot be done with a 16MHz Arduino. I even doubt that you can do something like that with 84MHz Arduino Due. It may be done with a 160MHz clocked ESP8266 CPU, but even for that you need a "TCP Proxy" like program first (that transparently passes traffic between client and server). Without that no Ethernet traffic will happen at all.

Hermann.

Thanks for the info hermann helped alot whats ur paypal

so right now im using the built in webserver example from seeed, which i can output headers from, I want to know how I can output all of its communication between the router and the arduino shield, here is the code i am using to start the server on my uno:

#include <SPI.h>
#include <EthernetV2_0.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,1, 117);

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

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
pinMode(SDCARD_CS,OUTPUT);
digitalWrite(SDCARD_CS,HIGH);//Deselect the SD card
 // 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("Connnection: 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("<center>");
         // 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("</center>");
         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");
 }
}

So as i said, i want to go a little lower end than just seeing headers, I want to see the router to ethernet shields communication of initializing its dhcp, ip etc. Thanks

I wonder if you have ever examined ethernet data. There is never a time when there is not activity if other devices are using it and they are active.

There are programs for your PC that can show you this.

Paul

Any ideas? anyone got a function list like ethernet.read(); or something that can do this. :confused:

Hey good idea but id like to learn how to do this with with my new chipsets. Arduino + seeed. I can see there is alot of activity on the ethernet indicator. And no i have 0 experience with ethernet but i have a basic undestanding of tcp.

so how am i supposed to put this chip into sexual mode or promiscous mode or whatever. am i supposed to short out a certain pin on the chip?

I see you can get a 30 day trial use of OMNIPEEK software for your PC. that will give you a pretty good idea of what you are looking at on Ethernet.

Paul

Thanks

8bitbacon:
so how am i supposed to put this chip into sexual mode or promiscous mode or whatever. am i supposed to short out a certain pin on the chip?

I haven't seen a way to do it. Even if you could, a normal 16MHz Arduino won't be able to keep up with even a minimal traffic flow.

The chip already keeps up with alot of traffic flow its 100mbps chip i did an html itrration of like 10000 and it printed all of it

Do you really expect a 16MHz processor to keep up with 100mbps network? Your w5100 keeps up because it only sends an ACK for each packet when you empty the rx buffer. There is quite a delay between packets.

Please don't let me stand in your way. Give it a try and see how you do.

I have the v2 it has apparently double buffer for the w5200. i just need it to show everything

8bitbacon:
I have the v2 it has apparently double buffer for the w5200. i just need it to show everything

Just everything? That should be easy!

So i saw that theres certain pins for tcp theres one for udp one for mac and some other stuff u know anything about that?