user6841: I have successfully wrote a sketch for Ethernet Shield and Arduino. If I plug it into computer's USB, it works.
But if I plug into any other power source, like USB power adapter from iPhone or laboratory power source to power socket -- it doesn't work.
LEDs are doing various strange bursts, very different than if powered from computer.
What can be the reason?
UPDATE
I have updated sketch so that it doesn't refer serial:
#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:
// B6-62-C5-CC-48-81
byte mac[] = {
  0xB6, 0x62, 0xC5, 0xCC, 0x48, 0x81
};
IPAddress ip(192, 168, 10, 90);

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

long requestCount = 0;
long upCounts[] = {0, 0, 0, 0, 0, 0};
long downCounts[] = {0, 0, 0, 0, 0, 0};
int currVals[] = {0, 0, 0, 0, 0, 0};
int prevStats[]= {0, 0, 0, 0, 0, 0};
int upThreshold = 1024-32;
int downThreshold = 32;



void setup() {
  // Open serial communications and wait for port to open:
//  Serial.begin(9600);
//  while (!Serial) {
//    ; // wait for serial port to connect. Needed for native USB port 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() {

  for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
    int sensorReading = analogRead(analogChannel);
    currVals[analogChannel] = sensorReading;

    if( prevStats[analogChannel] == 0 ) {
      if( currVals[analogChannel] >= upThreshold ) {
        prevStats[analogChannel] = 1;
        if( requestCount>0 ) {
          upCounts[analogChannel] ++;
        }
      }
    }
    else {
      if( currVals[analogChannel] < downThreshold ) {
        prevStats[analogChannel] = 0;
        if( requestCount>0 ) {
          downCounts[analogChannel] ++;
        }
      }
    }
  }


  // 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");  // the connection will be closed after completion of the response
          client.println("Refresh: 2");  // refresh the page automatically every 2 sec

          client.print("X-Inthemoon-Request-Count: ");  
          client.println(requestCount);
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("X-Inthemoon-Analog-To-Digital: ");  
            client.print("Channel=");
            client.print(analogChannel);
            client.print("; ");
            client.print("Min-Value=0; ");
            client.print("Max-Value=1023; ");
            client.print("Value=");
            client.print(currVals[analogChannel]);
            client.print("; ");
            client.print("Up-Change-Count=");
            client.print(upCounts[analogChannel]);
            client.print("; ");
            client.print("Down-Change-Count=");
            client.print(downCounts[analogChannel]);
            client.println(";");
          }


          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // output the value of each analog input pin
          client.print("Was counting: ");
          if( requestCount>0 ) {
            client.print("YES (request count is ");
            client.print(requestCount);
            client.print(")");
          }
          else {
            client.print("NO");
          }
          client.println("<br />");
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(currVals[analogChannel]);
            client.print(", up changes count is ");
            client.print(upCounts[analogChannel]);
            client.print(", and down changes count is ");
            client.print(downCounts[analogChannel]);
            client.println("<br />");
          }
          client.println("</html>");

          requestCount++;
          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 disconnected");
  }
}

The situation is the same:
https://youtu.be/vypaNOxZ5KI
It is plugged into Samsung tablet USB power of 2A, so insufficient current is unprobable reason.
UPDATE 2
I also tried to remove inclusion of SPI.h
UPDATE 3
If I connect another Arduino board  (but of the same vendor, it is from AliExpress), the behavior is the same.
UPDATE 4
I have compiled blink example and it works in any combination. If I connect Ethernet shield, then it blinks with both LEDs on Arduino board and on Ethernet shield.
UPDATE 5
I bought different Ethernet Board and it doesn't work too.
Please help. Have anybody ever powering Arduino + Ethernet not from USB?

user10394: Sorry I didn't see this earlier but I suspect you have a bad earth, because:

It works with the PC 
You are using a wall wart 
You are wiring your board to another electrical source (Ethernet) 
You are saying the LEDs are flashing differently.

Run a lead from the GND connector on the board to an Earth point.
(It might be the Ethernet that is at fault, but unless you have access to the switch I don't know how you could ground that properly)

6841: <p>I have successfully wrote a sketch for Ethernet Shield and Arduino. If I plug it into computer's USB, it works.</p>

<p>But if I plug into any other power source, like USB power adapter from iPhone or laboratory power source to power socket -- it doesn't work.</p>

<p>LEDs are doing various strange bursts, very different than if powered from computer.</p>

<p>What can be the reason?</p>

<p><strong>UPDATE</strong></p>

<p>I have updated sketch so that it doesn't refer serial:</p>

<pre><code>#include &lt;SPI.h&gt;
#include &lt;Ethernet.h&gt;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
// B6-62-C5-CC-48-81
byte mac[] = {
  0xB6, 0x62, 0xC5, 0xCC, 0x48, 0x81
};
IPAddress ip(192, 168, 10, 90);

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

long requestCount = 0;
long upCounts[] = {0, 0, 0, 0, 0, 0};
long downCounts[] = {0, 0, 0, 0, 0, 0};
int currVals[] = {0, 0, 0, 0, 0, 0};
int prevStats[]= {0, 0, 0, 0, 0, 0};
int upThreshold = 1024-32;
int downThreshold = 32;



void setup() {
  // Open serial communications and wait for port to open:
//  Serial.begin(9600);
//  while (!Serial) {
//    ; // wait for serial port to connect. Needed for native USB port 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() {

  for (int analogChannel = 0; analogChannel &lt; 6; analogChannel++) {
    int sensorReading = analogRead(analogChannel);
    currVals[analogChannel] = sensorReading;

    if( prevStats[analogChannel] == 0 ) {
      if( currVals[analogChannel] &gt;= upThreshold ) {
        prevStats[analogChannel] = 1;
        if( requestCount&gt;0 ) {
          upCounts[analogChannel] ++;
        }
      }
    }
    else {
      if( currVals[analogChannel] &lt; downThreshold ) {
        prevStats[analogChannel] = 0;
        if( requestCount&gt;0 ) {
          downCounts[analogChannel] ++;
        }
      }
    }
  }


  // 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' &amp;&amp; currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 2");  // refresh the page automatically every 2 sec

          client.print("X-Inthemoon-Request-Count: ");  
          client.println(requestCount);
          for (int analogChannel = 0; analogChannel &lt; 6; analogChannel++) {
            client.print("X-Inthemoon-Analog-To-Digital: ");  
            client.print("Channel=");
            client.print(analogChannel);
            client.print("; ");
            client.print("Min-Value=0; ");
            client.print("Max-Value=1023; ");
            client.print("Value=");
            client.print(currVals[analogChannel]);
            client.print("; ");
            client.print("Up-Change-Count=");
            client.print(upCounts[analogChannel]);
            client.print("; ");
            client.print("Down-Change-Count=");
            client.print(downCounts[analogChannel]);
            client.println(";");
          }


          client.println();
          client.println("&lt;!DOCTYPE HTML&gt;");
          client.println("&lt;html&gt;");
          // output the value of each analog input pin
          client.print("Was counting: ");
          if( requestCount&gt;0 ) {
            client.print("YES (request count is ");
            client.print(requestCount);
            client.print(")");
          }
          else {
            client.print("NO");
          }
          client.println("&lt;br /&gt;");
          for (int analogChannel = 0; analogChannel &lt; 6; analogChannel++) {
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(currVals[analogChannel]);
            client.print(", up changes count is ");
            client.print(upCounts[analogChannel]);
            client.print(", and down changes count is ");
            client.print(downCounts[analogChannel]);
            client.println("&lt;br /&gt;");
          }
          client.println("&lt;/html&gt;");

          requestCount++;
          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 disconnected");
  }
}
</code></pre>

<p>The situation is the same:</p>

<p><a href="https://youtu.be/vypaNOxZ5KI" rel="nofollow">https://youtu.be/vypaNOxZ5KI</a></p>

<p>It is plugged into Samsung tablet USB power of 2A, so insufficient current is unprobable reason.</p>

<p><strong>UPDATE 2</strong></p>

<p>I also tried to remove inclusion of <code>SPI.h</code></p>

<p><strong>UPDATE 3</strong></p>

<p>If I connect another Arduino board  (but of the same vendor, it is from AliExpress), the behavior is the same.</p>

<p><strong>UPDATE 4</strong></p>

<p>I have compiled <a href="https://www.arduino.cc/en/Tutorial/Blink" rel="nofollow">blink example</a> and it works in any combination. If I connect Ethernet shield, then it blinks with both LEDs on Arduino board and on Ethernet shield.</p>

<p><strong>UPDATE 5</strong></p>

<p>I bought different Ethernet Board and it doesn't work too.</p>

<p>Please help. Have anybody ever powering Arduino + Ethernet not from USB?</p>
 10394: <p>Sorry I didn't see this earlier but I suspect you have a bad earth, because:</p>

<ol>
<li>It works with the PC </li>
<li>You are using a wall wart </li>
<li>You are wiring your board to another electrical source (Ethernet) </li>
<li>You are saying the LEDs are flashing differently.</li>
</ol>

<p>Run a lead from the GND connector on the board to an Earth point.<br>
(It might be the Ethernet that is at fault, but unless you have access to the switch I don't know how you could ground that properly)</p>
