convert 6 minutes to 30 seconds for relay to go on and off after 2 hr interval

// DS1307 - Version: Latest

// ADS1147 - Version: Latest

/*
DS1307 RTC (Real-Time-Clock) Example

Uno A4 (SDA), A5 (SCL)
Mega 20 (SDA), 21 (SCL)
Leonardo 2 (SDA), 3 (SCL)
*/

#include <Wire.h>
#include <DS1307.h>
#define RELAY1 7 //Defining the pin 7 of the Arduino for the 4 relay module
#define RELAY4 4 //Defining the pin 4 of the Arduino for the 4 relay module

DS1307 rtc;

void setup()
{
pinMode(RELAY1, OUTPUT); //Defining the pin 7 of the Arduino as output
pinMode(RELAY4, OUTPUT); //Defining the pin 4 of the Arduino as output

/init Serial port/
Serial.begin(9600);
/while(!Serial); wait for serial port to connect - needed for Leonardo only/

/init RTC/
Serial.println("Init RTC...");

/only set the date+time one time/
//rtc.set(10, 23, 13, 22, 4, 2018); /08:00:00 24.12.2014 //sec, min, hour, day, month, year/

/stop/pause RTC/
// rtc.stop();

/start RTC/
rtc.start();
}

void loop()
{
uint8_t sec, min, hour, day, month;
uint16_t year;

/get time from RTC/
rtc.get(&sec, &min, &hour, &day, &month, &year);

if(hour%2 == 0)
{
if(min>1 && min<6)
{
digitalWrite(RELAY1,LOW); // This will Turn ON the relay 1
digitalWrite(RELAY4,LOW); // This will Turn ON the relay4
}
else
{
digitalWrite(RELAY1,HIGH); // This will Turn the Relay Off
digitalWrite(RELAY4,HIGH); // This will Turn the Relay Off
}
}

else
{
digitalWrite(RELAY1,HIGH); // This will Turn the Relay Off
digitalWrite(RELAY4,HIGH); // This will Turn the Relay Off
}

/serial output/
Serial.print("\nTime: ");
Serial.print(hour, DEC);
Serial.print(":");
Serial.print(min, DEC);
Serial.print(":");
Serial.print(sec, DEC);

Serial.print("\nDate: ");
Serial.print(day, DEC);
Serial.print(".");
Serial.print(month, DEC);
Serial.print(".");
Serial.print(year, DEC);

/wait a second/
//delay(1000);
}

I am sorry but I can make no sense of the title of this thread.

What problem are you trying to solve ?

i want to power ON my 1 hp water pump for 30 seconds and then power it OFF after the 30 seconds is up, and start the pump ON again after 2 hours..Please help. My friend wrote the codes for me. He wrote the code so that the pump will be ON for 5 minutes.

aashish79:
i want to power ON my 1 hp water pump for 30 seconds and then power it OFF after the 30 seconds is up, and start the pump ON again after 2 hours..Please help. My friend wrote the codes for me. He wrote the code so that the pump will be ON for 5 minutes.

Have you any idea on how the code works?. Could you describe it in two paragraphs?

Regards.

the codes are for powering a 1 hp submersible water pump ON and OFF using an arduino uno, a 4 channel relay and a ds1307 rtc.

i want to fill my water reserve tank at home from the water well. but i have very limited amount of water being collected at the well. so as to maximize the collection time i want use the arduino to help me switch the pumps on and off after every 2 hours for 30 seconds which probably gives me 60 liters of water.

i have no idea about programming. my friend wrote the code for me but he made the relay switch ON for about 5 minutes. Running the water pump ON for 5 minutes will burn the coils in the pump without any water in the well. so i want to decrease the pump running time from 5 minutes to 30 seconds. Please Help and thanks in advance

Since it’s the only thing in the first post, I figured it was worth posting PROPERLY in </> code tags !

//DS1307 - Version: Latest 

// ADS1147 - Version: Latest 

/*
  DS1307 RTC (Real-Time-Clock) Example

  Uno       A4 (SDA), A5 (SCL)
  Mega      20 (SDA), 21 (SCL)
  Leonardo   2 (SDA),  3 (SCL)
 */

#include <Wire.h>
#include <DS1307.h>
#define RELAY1 7 //Defining the pin 7 of the Arduino for the 4 relay module
#define RELAY4 4 //Defining the pin 4 of the Arduino for the 4 relay module

DS1307 rtc;

// ———————————-
void setup()
{
  pinMode(RELAY1, OUTPUT); //Defining the pin 7 of the Arduino as output 
  pinMode(RELAY4, OUTPUT); //Defining the pin 4 of the Arduino as output
  
  /*init Serial port*/
  Serial.begin(9600);
  /*while(!Serial); wait for serial port to connect - needed for Leonardo only*/

  /*init RTC*/
  Serial.println("Init RTC...");

  /*only set the date+time one time*/
  //rtc.set(10, 23, 13, 22, 4, 2018); /*08:00:00 24.12.2014 //sec, min, hour, day, month, year*/

  /*stop/pause RTC*/
  // rtc.stop();

  /*start RTC*/
  rtc.start();
}

// ———————————-
void loop()
{
  uint8_t sec, min, hour, day, month;
  uint16_t year;

  /*get time from RTC*/
  rtc.get(&sec, &min, &hour, &day, &month, &year);
  
  if(hour%2 == 0)
  {
    if(min>1 && min<6)
    {
      digitalWrite(RELAY1,LOW); // This will Turn ON the relay 1
      digitalWrite(RELAY4,LOW); // This will Turn ON the relay4
    }
    else
    {
      digitalWrite(RELAY1,HIGH); // This will Turn the Relay Off
      digitalWrite(RELAY4,HIGH); // This will Turn the Relay Off
    }
  }
  else
  {
    digitalWrite(RELAY1,HIGH); // This will Turn the Relay Off
    digitalWrite(RELAY4,HIGH); // This will Turn the Relay Off
  }
  
  /*serial output*/
  Serial.print("\nTime: ");
  Serial.print(hour, DEC);
  Serial.print(":");
  Serial.print(min, DEC);
  Serial.print(":");
  Serial.print(sec, DEC);

  Serial.print("\nDate: ");
  Serial.print(day, DEC);
  Serial.print(".");
  Serial.print(month, DEC);
  Serial.print(".");
  Serial.print(year, DEC);

  /*wait a second*/
  //delay(1000);
}

You might try changing

if(min>1 && min<6)

to

if(sec>1 && sec<30)

It's about 10 lines down from
void loop()

Due_unto:
You might try changing

if(min>1 && min<6)

to

if(sec>1 && sec<30)

It's about 10 lines down from
void loop()

Hi,
Frankly, I do not see the point on (trying to) helping somebody that does not understand nothing of the code.
Regards

Thanks a lot. Will change from mins to secs.