Arduino nano + enc28j60 +BS18B20

i have arduino nano (clone from ebay) enc28j60 and ds18b20 , I connect arduino nano with pc and it works great, I tested 4 days without problem but when i connect arduino nano with power supply after 2 or 3 hours stop response , when i ping i have no response … what can i do to fix ?

my code is :

#include <UIPEthernet.h> // Used for Ethernet
#include <OneWire.h>     // Used for temperature sensor(s)
byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x30, 0x32 };                                       
IPAddress ip(172,16,82,152);                        
EthernetServer server(80);
EthernetClient client;
OneWire  ds(3);
void setup() {
   Ethernet.begin(mac, ip);
  server.begin();
  }
void loop() {
    client = server.available();
    if (client) 
  {  
   boolean currentLineIsBlank = true;
        while (client.connected()) 
    {
      if (client.available()) {
        char c = client.read();
        if (c == '\n' && currentLineIsBlank) 
        {
          TemperaturesToXML();
          break;
        }
               if (c == '\n') {
           currentLineIsBlank = true;
        }
        else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
      delay(10);
     client.stop();
     }
}
void TemperaturesToXML(void) {
  byte counter;
  byte present = 0;
  byte sensor_type;
  byte data[12];
  byte addr[8];
  float celsius, fahrenheit;
    ds.reset_search();
    while ( ds.search(addr)) {
    ds.reset();
    ds.select(addr);
    ds.write(0x44); 
    delay(850);  
    present = ds.reset();
    ds.select(addr);    
    ds.write(0xBE);
    for ( counter = 0; counter < 9; counter++) 
    {           // we need 9 bytes
      data[counter] = ds.read();
    }
    int16_t raw = (data[1] << 8) | data[0];
    if (sensor_type) 
    {
      raw = raw << 3;
      if (data[7] == 0x10) {
      raw = (raw & 0xFFF0) + 12 - data[6];
      }
    } 
    else 
    {   
      byte cfg = (data[4] & 0x60);   
      if (cfg == 0x00) raw = raw & ~7;
      else if (cfg == 0x20) raw = raw & ~3;
      else if (cfg == 0x40) raw = raw & ~1;
    }
    celsius = (float)raw / 16.0;
    client.print(celsius);
  } 
    return;
}

calathin: I connect arduino nano with pc and it works great, I tested 4 days without problem but when i connect arduino nano with power supply after 2 or 3 hours stop response

This would suggest that the code is fine but the power supply isn't, and yet you tell us everything about the former and nothing about the latter. Perhaps you could be a bit more forthcoming about the power supply. Please don't tell us it is a 9v PP3 battery.

i used power supply usb 5 volt DC 1A (not one , a lot ) with no success , then i connect power supply from my old pc but again with no success ...

calathin: connect power supply from my old pc

Connect where?

from old power supply i connect 5 volt(yellow and black) dc through usb to power the arduino nano

It sounds like you might have cobbled a cable a bit roughly. You might try putting the 5v on pin 27, as mentioned in the data sheets.

calathin: from old power supply i connect 5 volt(yellow and black) dc through usb to power the arduino nano

5V from a pc atx is usually the Red one,Yellow is +12V

have you measured 5V on the yellow wire?

12V on the usb connector could damage the Nano.

sashijoseph: Yellow is +12V

While I said "cobbled a cable a bit roughly" I didn't mean that roughly, but I reckon what you say is right, and likely to result in a serious problem....... I don't know what overvoltage protection a Nano has - if any.

sorry the red cable not yellow … i do new test and i have good news … but i dont know what is the different . i connect usb charger (5 dc volt 1A) and after pc usb hub ( 4 ports) i connect 4 arduino nano with enc28j60 and bs18b20 , it is up 4 days + without any problem . But what change with pc hub and i dont have problems ?

calathin: but i dont know what is the different ............... what change with pc hub and i dont have problems ?

You probably just got a little bit better at putting things together.