Hello,
I am trying to implement a device which read voltage and current and send the signal to a server.I completed this task using arduino uno and ENC28j60 Ethernet module with the help of UIPEthernet library. I am getting the signal in the server.but some time it fails .It maybe after running half a day,or after one day.also i get continuous signal for 2 days also.after that it will hang or not sending the data to the server. What might be the problem?.please help .
i here by attach the program .
void setup(){
Serial.begin(9600);
//Serial.println("Starting");
SPI.begin();
// watchdogSetup();
pinMode(Contd,OUTPUT);
pinMode(NotContd,OUTPUT);
digitalWrite(Contd,HIGH);
digitalWrite(NotContd,HIGH);
delay(2000);
digitalWrite(Contd,LOW);
digitalWrite(NotContd,LOW);
start_ethernet();
}
void loop() {
//wdt_reset();
reset_millis = millis();
// put your main code here, to run repeatedly:
if(reset_millis >= reset_period){
Resetuno();
}
dc_volt = 0;
dc_volt = analogRead(A5);//5)/1024);
dc_volt = dc_volt0.0363;
eb_volt = Measure_Vrms(1,800,0.8759,10);//1.1 4.04///
inv_curr = Measure_Irms(4,800,0.039,10); //0.0017
client.connect(server, 80);
delay(1000);
if (client.connected()){//(server, 80)) {
Serial.println("-> Connected");
digitalWrite(Contd,HIGH);
digitalWrite(NotContd,LOW);
failed_data = 0;
client.print( "GET /index.php/add/add_data?");
client.print("dc_volt=");
client.print(dc_volt);
client.print("&");
client.print("eb_volt=");
client.print(eb_volt);
client.print("&");
client.print("inv_volt=");
client.print(inv_volt);
client.print("&");
client.print("inv_curr=");
client.print(inv_curr);
client.print("&");
client.println( " HTTP/1.1");
client.print( "Host: " );
client.println(server);
client.println( "Connection: close");//keep-alive" );// close
client.println();
client.println();
client.stop();
delay(interval);