Need to learn how to code an engine hour meter

Hello,

I am new to Arduino and I am having a hard time figuring out how to create a hour meter. I am using an uno with . I have that hooked up to engine. I would like to create a hour meter that records the engine run-time hours (cumulative hours).

with the help of google i made one program ,Here is my code:-

double startTime = 0;  
double stopTime = 0;  
double runTime = 0;  
double totTime = 0;  
int EngineLed = 13; // this could be a relay to turn on the ENGINE  
  
// for this example we will use a high on the pumpcommand pin to mean run the ENGINE  
int EngineCommand = 8; // input pin to indicate Engine running  
boolean EngineLastState = false; // if it was in the main loop it would be reset every time thorough the code  
boolean EngineRunning = false; // if it was in the main loop it would be reset every time thorough the code  
// the setup routine runs once when you press reset:  
  
void setup()  
{                 
  Serial.begin(9600); // initialize serial port to 9600 baud  
  // initialize the digital pin as an output.  
  pinMode(EngineLed, OUTPUT);  
  pinMode(EngineCommand, INPUT);  
  digitalWrite(EngineCommand, HIGH); // turn on pull up resistor  
  totTime = 0 ; // this is where you could read from an EEPROM to continue after a restart  
  Serial.println("Engine Control at Your Command on pin 8");  
  Serial.println("Gnd to Stop, High/Open to run");  
  Serial.println("no debounce on input so you might get extra triggers");  
}  
  
// the loop routine runs over and over again forever:  
void loop()  
{  
  EngineLastState = digitalRead(EngineCommand); // read if the engine should be on, this could also come from a command  
  // MUST use double == in order to do a comparison vs an assignment  
  if (EngineRunning == false && EngineLastState==HIGH)  
  {  
    // turn on the Engine / we will only do this once as the engineRunning will prevent entering here again  
    // until it is reset by the command telling us to stop the engine  
     digitalWrite(EngineLed, HIGH);  
     EngineRunning = true;  
     runTime = 0; // reset as were just turning on again and its already added to accumilator  
     startTime = millis();  
     Serial.print("Engine on, Starting Timer. ");  
   }  
   else if (EngineRunning == true && EngineLastState ==LOW) // sense LOW prevents entering this more than once  
   {  
     //Turn off the engine but only do the sequence once to prevent messing up the counters  
     digitalWrite(EngineLed, LOW);  
     EngineRunning = false;  
     stopTime = millis();  
     runTime +=(stopTime - startTime)/1000; // last run time in seconds  
     totTime += runTime; // addd to accumilator  
     Serial.print("Engine off after ");Serial.print(runTime);Serial.print(" seconds. ");  
     Serial.print("Total time = ");Serial.println(totTime);  
   }  
}

But problem is that when i switched off and switched ON the arduino, Engine run hours start from zero.Old readings are deleted. I want new running hours will added to old reading and serial monitor will display cumulative hour(old reading + new reading) even i switch off and switch on the arduino.

please,if anyone could help me it would be greatly appreciated.

Thanks.

Store the total hours in EEPROM when you stop the engine and read it in setup when you power up again.

Store the total hours in EEPROM when you stop the engine and read it in setup when you power up again.

Also worth considering to save if/when the input power fails (e,g flat battery or other runtime issue).

With power fail save to eeprom there was a combined capacitor on the input line and in software a voltage monitor. Which if the power dropped below a certain trigger micro voltage, then in the micro seconds of volt decay it could complete an eeprom write. Can't remember where it is but a search may find it.

Although thinking it through, you are dealing with hours so a write to eeprom every hour isn't going to wear the eeprom out before the engine is worn out !

I would not want to lose up to 59 minutes of operation on every run. My preference would be to save to EEPROM every minute.

On that basis then about 1500 hours engine time before eeprom wore out. Allowing some cycles for reads.

Stop/starting for a few minutes causes extra so say 1000 hours engine running with numerous stop starts.

1500 hours before the EEPROM goes out of warranty. It will work a lot longer than that.

You can always use an external EEPROM chip, if you are worried. Or save the data every 5 minutes, and last 12 times as long.

Or use the first byte of EEPROM to tell where you're storing the total and move it down after fifty thousand writes.

or a 20c capacitor, 3 resistors and a diode to save whenever you like, or when the power fails/ is pulled out.
I use this in every project. I allows me to save more than 2K of EEPROM.

PaulS:
You can always use an external EEPROM chip, if you are worried. Or save the data every 5 minutes, and last 12 times as long.

sir i have made some changes by using internal EEPROM.Here is the code:-

#include <EEPROM.h>
//#include <Wire.h> 
//#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 

// Pin 13 has an LED connected on most Arduino boards.  
double startTime = 0;  
double stopTime = 0;  
double runTime = 0;  
double totTime;// = 0;  
int EngineLed = 13; // this could be a relay to turn on the ENGINE  
 //int totTime; 
// for this example we will use a high on the pumpcommand pin to mean run the ENGINE  
int EngineCommand = 8; // input pin to indicate Engine running  
boolean EngineLastState = false; // if it was in the main loop it would be reset every time thorough the code  
boolean EngineRunning = false; // if it was in the main loop it would be reset every time thorough the code  
// the setup routine runs once when you press reset:  
  
void setup()  
{
  //lcd.begin(16,2);
  //lcd.backlight();//Power on the back light                 
  Serial.begin(9600); // initialize serial port to 9600 baud  
  // initialize the digital pin as an output.  
  pinMode(EngineLed, OUTPUT);  
  pinMode(EngineCommand, INPUT);  
  digitalWrite(EngineCommand, HIGH); // turn on pull up resistor  
  totTime = EEPROM.read(0) ; // this is where you could read from an EEPROM to continue after a restart  
  //EEPROM.write(0,0);
 // lcd.setCursor(0,0); //we start writing from the first row first column
     //lcd.print("running minutes:");
  
  Serial.println("Engine Control at Your Command on pin 8");  
  Serial.println("Gnd to Stop, High/Open to run");  
  Serial.println("no debounce on input so you might get extra triggers");  
}  
  
// the loop routine runs over and over again forever:  
void loop()  
{  
  EngineLastState = digitalRead(EngineCommand); // read if the engine should be on, this could also come from a command  
  // MUST use double == in order to do a comparison vs an assignment  
  if (EngineRunning == false && EngineLastState==HIGH)  
  {  
    // turn on the Engine / we will only do this once as the engineRunning will prevent entering here again  
    // until it is reset by the command telling us to stop the engine  
     digitalWrite(EngineLed, HIGH);  
     EngineRunning = true;  
     runTime = 0; // reset as were just turning on again and its already added to accumilator  
     startTime = millis();  
     Serial.print("Engine on, Starting Timer. ");  
   }  
   else if (EngineRunning == true && EngineLastState ==LOW) // sense LOW prevents entering this more than once  
   {  
     //Turn off the engine but only do the sequence once to prevent messing up the counters  
     digitalWrite(EngineLed, LOW);  
     EngineRunning = false;  
     stopTime = millis();  
     runTime +=(stopTime - startTime)/60000; // last run time in minute 
     totTime += (runTime); // addd to accumilator  
     EEPROM.update(0,totTime);
     Serial.print("Engine off after ");Serial.print(runTime);Serial.print(" MINUTE. ");  
     Serial.print("Total time = ");Serial.println(totTime);  
    // lcd.setCursor(1,3); //we start writing from the first row first column
    // lcd.println(EEPROM.read(0)); //16 characters poer line
     
     
   }  
}

i give the engine running input signal to 10 hrs continously pin no:8.(monitored by external stop watch)
after 10 hrs i connected my laptop and checked the serial monitor,but its showing zero hours.

READ()

Reads a byte from the EEPROM

Try EEPROM.get() and EEPROM.put()
In your code - you can use .put() in place of both .write() and .update()
GET
PUT

wildbill:
Store the total hours in EEPROM when you stop the engine and read it in setup when you power up again.

sir i have made some changes by using internal EEPROM.Here is the code:-

#include <EEPROM.h>
//#include <Wire.h> 
//#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 

// Pin 13 has an LED connected on most Arduino boards.  
double startTime = 0;  
double stopTime = 0;  
double runTime = 0;  
double totTime;// = 0;  
int EngineLed = 13; // this could be a relay to turn on the ENGINE  
 //int totTime; 
// for this example we will use a high on the pumpcommand pin to mean run the ENGINE  
int EngineCommand = 8; // input pin to indicate Engine running  
boolean EngineLastState = false; // if it was in the main loop it would be reset every time thorough the code  
boolean EngineRunning = false; // if it was in the main loop it would be reset every time thorough the code  
// the setup routine runs once when you press reset:  
  
void setup()  
{
  //lcd.begin(16,2);
  //lcd.backlight();//Power on the back light                 
  Serial.begin(9600); // initialize serial port to 9600 baud  
  // initialize the digital pin as an output.  
  pinMode(EngineLed, OUTPUT);  
  pinMode(EngineCommand, INPUT);  
  digitalWrite(EngineCommand, HIGH); // turn on pull up resistor  
  totTime = EEPROM.read(0) ; // this is where you could read from an EEPROM to continue after a restart  
  //EEPROM.write(0,0);
 // lcd.setCursor(0,0); //we start writing from the first row first column
     //lcd.print("running minutes:");
  
  Serial.println("Engine Control at Your Command on pin 8");  
  Serial.println("Gnd to Stop, High/Open to run");  
  Serial.println("no debounce on input so you might get extra triggers");  
}  
  
// the loop routine runs over and over again forever:  
void loop()  
{  
  EngineLastState = digitalRead(EngineCommand); // read if the engine should be on, this could also come from a command  
  // MUST use double == in order to do a comparison vs an assignment  
  if (EngineRunning == false && EngineLastState==HIGH)  
  {  
    // turn on the Engine / we will only do this once as the engineRunning will prevent entering here again  
    // until it is reset by the command telling us to stop the engine  
     digitalWrite(EngineLed, HIGH);  
     EngineRunning = true;  
     runTime = 0; // reset as were just turning on again and its already added to accumilator  
     startTime = millis();  
     Serial.print("Engine on, Starting Timer. ");  
   }  
   else if (EngineRunning == true && EngineLastState ==LOW) // sense LOW prevents entering this more than once  
   {  
     //Turn off the engine but only do the sequence once to prevent messing up the counters  
     digitalWrite(EngineLed, LOW);  
     EngineRunning = false;  
     stopTime = millis();  
     runTime +=(stopTime - startTime)/60000; // last run time in minute 
     totTime += (runTime); // addd to accumilator  
     EEPROM.update(0,totTime);
     Serial.print("Engine off after ");Serial.print(runTime);Serial.print(" MINUTE. ");  
     Serial.print("Total time = ");Serial.println(totTime);  
    // lcd.setCursor(1,3); //we start writing from the first row first column
    // lcd.println(EEPROM.read(0)); //16 characters poer line
     
     
   }  
}

i give the engine running input signal to 10 hrs continously pin no:8.(monitored by external stop watch)
after 10 hrs i connected my laptop and checked the serial monitor,but its showing zero hours.

PaulS:
You can always use an external EEPROM chip, if you are worried. Or save the data every 5 minutes, and last 12 times as long.

Sir
any possibility to use sd card module for fixing the problem.i have sd card module and i have tried to make a program.but i dont know how retrieve the data from sd card and assign the latest value to variable.

i have tried to make a program.but

didn’t post it.

i dont know how retrieve the data from sd card

And we don’t know what data, or how you have saved it in some file on the SD card.

and assign the latest value to variable.

Well, first, you need to have “the latest data” in the same form as the variable you want to store it in.

PaulS:
didn’t post it.

#include <SD.h> //Load SD library
int chipSelect = 4; //chip select pin for the MicroSD Card Adapter
File myfile; // file object that is used to read and write data
// Pin 13 has an LED connected on most Arduino boards.  
double startTime = 0;  
double stopTime = 0;  
double runTime = 0;  
double totTime ;// = 0;  

int EngineLed = 13; // this could be a relay to turn on the ENGINE  
 //int totTime; 
// for this example we will use a high on the pumpcommand pin to mean run the ENGINE  
int EngineCommand = 8; // input pin to indicate Engine running  
boolean EngineLastState = false; // if it was in the main loop it would be reset every time thorough the code  
boolean EngineRunning = false; // if it was in the main loop it would be reset every time thorough the code  
// the setup routine runs once when you press reset:  
  
void setup()  
{
  Serial.begin(9600);
  pinMode(EngineLed, OUTPUT);  
  pinMode(EngineCommand, INPUT);  
  digitalWrite(EngineCommand, HIGH);
  pinMode(chipSelect, OUTPUT); // chip select pin must be set to OUTPUT mode
  if (!SD.begin(chipSelect)) { // Initialize SD card
    Serial.println("Could not initialize SD card."); // if return value is false, something went wrong.
  }
 
 /* if (SD.exists("myfile.txt")) { // if "file.txt" exists, fill will be deleted
    Serial.println("myFile exists.");}
    if (SD.remove("myfile.txt") == true) {
      Serial.println("Successfully removed file.");
    } else {
      Serial.println("Could not removed file.");
    }*/
  
  Serial.println("Engine Control at Your Command on pin 8");  
  Serial.println("Gnd to Stop, High/Open to run");  
  Serial.println("no debounce on input so you might get extra triggers");  
}  
  //lcd.begin(16,2);
  //lcd.backlight();//Power on the back light                 
   // initialize serial port to 9600 baud  
  // initialize the digital pin as an output.  
   // turn on pull up resistor  
  //totTime = EEPROM.read(0) ; // this is where you could read from an EEPROM to continue after a restart  
  
  //EEPROM.write(0,0);
 //lcd.setCursor(0,0); //we start writing from the first row first column
     //lcd.print("running minutes:");
  // the loop routine runs over and over again forever:  

void loop()  
{  
  EngineLastState = digitalRead(EngineCommand); // read if the engine should be on, this could also come from a command  
  // MUST use double == in order to do a comparison vs an assignment  
  if (EngineRunning == false && EngineLastState==HIGH)  
  {  
    // turn on the Engine / we will only do this once as the engineRunning will prevent entering here again  
    // until it is reset by the command telling us to stop the engine  
     digitalWrite(EngineLed, HIGH);  
     EngineRunning = true;  
     runTime = 0; // reset as were just turning on again and its already added to accumilator  
     startTime = millis();  
     Serial.print("Engine on, Starting Timer. ");  
   }  
   else if (EngineRunning == true && EngineLastState ==LOW) // sense LOW prevents entering this more than once  
   {  
     //Turn off the engine but only do the sequence once to prevent messing up the counters  
     digitalWrite(EngineLed, LOW);  
     EngineRunning = false;  
     stopTime = millis();  
     runTime +=(stopTime - startTime)/60000; // last run time in minute 
     totTime += (runTime); // addd to accumilator  
     Serial.print("Engine off after ");Serial.print(runTime);Serial.print(" MINUTE. ");  
     Serial.print("Total time = ");Serial.println(totTime);  
    
     myfile = SD.open("myfile.txt", FILE_WRITE); // open "file.txt" to write data
  if (myfile) {
    myfile.println(totTime); // write number to file
    myfile.close(); // close file
    Serial.print("Wrote on card: "); // debug output: show written number in serial monitor
    Serial.println(totTime);
  } else {
    Serial.println("Could not open file (writing).");
  }
   myfile = SD.open("myfile.txt", FILE_READ); // open "file.txt" to read data
  if (myfile) {
    Serial.println("--- Reading start ---");
    char character=totTime;
    while ((character = myfile.read()) != -1) { // this while loop reads data stored in "file.txt" and prints it to serial monitor
      Serial.print(character);
    }
    myfile.close();
    Serial.println("--- Reading end ---");
  } else {
    Serial.println("Could not open file (reading).");
  }
  delay(5000); // wait for 5000ms
     
     
     
     //EEPROM.update(0,totTime);
     // lcd.setCursor(1,1); //we start writing from the first row first column
     //lcd.println(totTime); //16 characters poer line
  }
  }

problem is that once i switched off and on the the power, variable value become zero.latest value will not showing.could you please help me for making the program for recalling the latest value of variable.

PaulS:
You can always use an external EEPROM chip, if you are worried. Or save the data every 5 minutes, and last 12 times as long.

Finaly i make one program for my engine hour meter project and add gsm module also for knowing the current running hour through sms.Here is the code:-
if i send the text sms “hmr” to gsm ,the module will reply current running hour.

all working fine when i open the serial monitor.if i closed the serial monitor gsm not responds.

#include <stdlib.h >
#include <SoftwareSerial.h>
#include <EEPROM.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 
SoftwareSerial GPRS(10, 11);
String textMessage;
String val;
int EngineLed = 13; 
const uint8_t ledPin1        = 7;
const uint8_t EngineCommand = 8;   


char outstr[15];
int addr_secnd=0;
int addr_minute=1;
int addr_hrs1=2;
int addr_hrs2=3;
int addr_hrs3=4;
int addr_hrs4=5;
int addr_hrs5=6;
int addr_hrs6=7;

int secnd = 0;
int minute = 0;
int hrs1 = 0;
int hrs2 = 0;
int hrs3 = 0;
int hrs4 = 0;
int hrs5 = 0;
int hrs6 = 0;

int value_secnd;
int value_minute;
int value_hrs1;
int value_hrs2;
int value_hrs3;
int value_hrs4;
int value_hrs5;
int value_hrs6;


void setup() {
  pinMode(EngineLed, OUTPUT);  
  pinMode(EngineCommand, INPUT_PULLUP);
  pinMode ( ledPin1, OUTPUT );
  GPRS.begin(9600);
  lcd.begin(16,2);
  lcd.backlight();
  Serial.begin(9600);
  value_secnd = EEPROM.read(addr_secnd);
  value_minute = EEPROM.read(addr_minute);
  value_hrs1 = EEPROM.read(addr_hrs1);
  value_hrs2 = EEPROM.read(addr_hrs2);
  value_hrs3 = EEPROM.read(addr_hrs3);
  value_hrs4 = EEPROM.read(addr_hrs4);
  value_hrs5 = EEPROM.read(addr_hrs5);
  value_hrs6 = EEPROM.read(addr_hrs6);
 Serial.println("================================");
 Serial.print("secnd:");
 Serial.println(value_secnd);
 Serial.print("minute:");
 Serial.println(value_minute);
 Serial.print("hrs1:");
 Serial.println(value_hrs1); 
 Serial.print("hrs2:");
 Serial.println(value_hrs2);
 Serial.print("hrs3:");
 Serial.println(value_hrs3);
 Serial.print("hrs4:");
 Serial.println(value_hrs4);
 Serial.print("hrs5:");
 Serial.println(value_hrs5);
 Serial.print("hrs6:");
 Serial.println(value_hrs6);
 Serial.println("================================");
 GPRS.print("AT+CNMI=2,2,0,0,0\r");
  delay(100);
 }

void loop() {
 if ( digitalRead(EngineCommand) == LOW)//used a toggle switch for engine command,  switch in low means engine start meter will record the time 
 {
  digitalWrite(ledPin1,HIGH);
  Meter();
 }
else {
  //Serial.println ("engine stop");
  digitalWrite(ledPin1,LOW);
 }
if (GPRS.available() > 0) {
    delay(1000);
    textMessage = GPRS.readString();
    Serial.print(textMessage);
    if(textMessage.indexOf("hmr")>=0){
    //String message = (outstr);
    Serial.println(outstr);  
     GPRS.println("AT+CMGF=1");
      delay(1000);
      GPRS.println("AT+CMGS=\"+917987553768\""); 
      delay(500);
      GPRS.println(outstr);
     delay(1000);
      GPRS.println((char)26);
      delay(500);
      Serial.println("HMR REQUEST");
     delay(500);
    }
    
    delay(100);
  }
}
  
 void Meter(){
  value_secnd = value_secnd+1;
  EEPROM.update(addr_secnd,value_secnd);

if(value_secnd==60){
  secnd=0;
  EEPROM.update(addr_secnd,secnd);
  value_minute = value_minute+1;
  EEPROM.update(addr_minute,value_minute);
}
value_secnd = EEPROM.read(addr_secnd);
Serial.print("\t");
Serial.print("secnd:");
 Serial.println(value_secnd);
Serial.print("\t");

if(value_minute==60){
  minute = 0;
  EEPROM.update(addr_minute,minute);
  value_hrs1 = value_hrs1 + 1;
  EEPROM.update(addr_hrs1,value_hrs1);
}
value_minute = EEPROM.read(addr_minute);
Serial.print("minute:");
 Serial.println(value_minute);
Serial.print("\t");

if(value_hrs1==10){
  hrs1 = 0;
  EEPROM.update(addr_hrs1, hrs1);
  value_hrs2 = value_hrs2 + 1;
  EEPROM.update(addr_hrs2,value_hrs2);
}
value_hrs1 = EEPROM.read(addr_hrs1);
Serial.print("hrs (1):");
 Serial.println(value_hrs1);
Serial.print("\t");

if(value_hrs2==10){
  hrs2 = 0;
  EEPROM.update(addr_hrs2, hrs2);
  value_hrs3 = value_hrs3 + 1;
  EEPROM.update(addr_hrs3,value_hrs3);
}
value_hrs2 = EEPROM.read(addr_hrs2);
Serial.print("hrs (2):");
 Serial.println(value_hrs2);
Serial.print("\t");


if(value_hrs3==10){
  hrs3 = 0;
  EEPROM.update(addr_hrs3, hrs3);
  value_hrs4 = value_hrs4 + 1;
  EEPROM.update(addr_hrs4,value_hrs4);
}
value_hrs3 = EEPROM.read(addr_hrs3);
Serial.print("hrs (3):");
 Serial.println(value_hrs3);
Serial.print("\t");

if(value_hrs4==10){
  hrs4 = 0;
  EEPROM.update(addr_hrs4, hrs4);
  value_hrs5 = value_hrs5 + 1;
  EEPROM.update(addr_hrs5,value_hrs5);
}
value_hrs4 = EEPROM.read(addr_hrs4);
Serial.print("hrs (4):");
 Serial.println(value_hrs4);
Serial.print("\t");

if(value_hrs5==10){
  hrs5 = 0;
  EEPROM.update(addr_hrs5, hrs5);
  value_hrs6 = value_hrs6 + 1;
  EEPROM.update(addr_hrs6,value_hrs6);
}
value_hrs5 = EEPROM.read(addr_hrs5);
Serial.print("hrs (5):");
 Serial.println(value_hrs5);
Serial.print("\t");

if(value_hrs6==10){
  hrs6 = 0;
  EEPROM.update(addr_hrs6, hrs6);
  
}
value_hrs6 = EEPROM.read(addr_hrs6);
Serial.print("hrs(6):");
Serial.println(value_hrs6);
Serial.print("\t");

int x1=EEPROM.read(addr_hrs6);
int x2=EEPROM.read(addr_hrs5);
int x3=EEPROM.read(addr_hrs4);
int x4=EEPROM.read(addr_hrs3);
int x5=EEPROM.read(addr_hrs2);
int x6=EEPROM.read(addr_hrs1);
int x7=EEPROM.read(addr_minute);

String val = String(x1)+String(x2)+String(x3)+String(x4)+String(x5)+String(x6)+String(x7);

float value1 = (val.toFloat())/100;
Serial.println(value1);
char outstr[15];
dtostrf(value1,5, 2, outstr);
Serial.print(outstr);
Serial.print("\t");
/*if (GPRS.available() > 0) {
    delay(1000);
    textMessage = GPRS.readString();
    Serial.print(textMessage);
    if(textMessage.indexOf("hmr")>=0){
    //String message = (outstr);
    Serial.println(outstr);  
     GPRS.println("AT+CMGF=1");
      delay(1000);
      GPRS.println("AT+CMGS=\"+917987553768\""); 
      delay(500);
      GPRS.println(outstr);
     delay(1000);
      GPRS.println((char)26);
      delay(500);
      Serial.println("HMR REQUEST");
     delay(500);
    }
    
    delay(100);
  }*/
Serial.print("HM:");
Serial.print(value_hrs6);
Serial.print(value_hrs5);
Serial.print(value_hrs4);
Serial.print(value_hrs3);
Serial.print(value_hrs2);
Serial.print(value_hrs1);
Serial.print(",");
Serial.print(value_minute);
Serial.print(":");
Serial.print(value_secnd);

lcd.clear();
lcd.setCursor(0,0);
lcd.print(value_hrs6);
lcd.print(value_hrs5);
lcd.print(value_hrs4);
lcd.print(value_hrs3);
lcd.print(value_hrs2);
lcd.print(value_hrs1);
//Serial.print(",");
lcd.setCursor(0,1);
lcd.print(value_minute);
lcd.print(":");
lcd.print(value_secnd);
digitalWrite(EngineLed,HIGH);
delay(1000);
digitalWrite(EngineLed,LOW);

    }

In this program hour meter working fine.GSM MODULE 800L responds only when serial monitor open in IDE.
please let me know where i did mistakes.expecting favourable reply.