I'm trying to program an uno board to control an outlet

I'm trying to build an areoponics garden and I couldn't find a commercial timer that I could program to run on an interval of 15mins on, 5min pause, 24/7. So I bought an arduino uno, a 5v 8 channel relay srd-05vdc-sl-c, two 15amp outlets, a 3-pronged power cord, and 14gauge straided wire. I am using all this to power a 16w/120v submersible water pump.

I have been looking around for an already written program that I could use, but I always find ones that include code for other peripherals and like a temp sensor or humidity sensor, and I don't know how to remove those sections without affecting anything else. I essentially need help writing code that turns on the outlet/relay for 15min and 5mins pause 24/7

Cross posting your questions is very disrespectful, please ask your questions only at one place.

You will not find a program that fits your requirements, you need to learn some programming skills.
.

Start with the blink-without-delay example that comes with the IDE. Understand it and next modify it so you can set a start time and a duration. Pin 13 will (when your sketch is completed) be connected in some way to a relay that then will be controlled by the time / duration.

You might want to use a RTC for a more accurate time. In that case you can store a start time and an end time in eeprom, compare it with the RTC time and take action when they match; you can also store a number of start- and end times if needed. You can still use pin 13.

In the final project you can use a different pin, but pin 13 is useful as you can debug without the relay being connected.

Vikinggardener91:
I'm trying to build an areoponics garden and I couldn't find a commercial timer that I could program to run on an interval of 15mins on, 5min pause, 24/7.

Have you looked at Rockwell?

Try this. It'll bother some folks because of the delay statements, but the program is SOOO simple, it's hard to justify doing it any other way. Attach digital pin 2 to your relay.

void setup(){
  pinMode(2, OUTPUT);
}

void loop() {
  digitalWrite(2, HIGH);
  delay(900000); // on for 15 mins
  digitalWrite(2, LOW);
  delay(300000); // off for 5 mins
}

A common 8-channel relay board is active LOW, so...

void loop() {
digitalWrite(2, LOW); // relay on
delay(900000); // stick your head in the sand for 15 mins
digitalWrite(2, HIGH); // relay off
delay(300000); // stick your head in the sand 5 mins
}

Maybe not so wise if you want to control eight relays.
Leo..

Good catch. I always have to test them before I set the values in my code. I've used a bunch of active high relays in the past and always seem to get surprised when I use a more typical optically isolated one and things work backwards.

Thank you all so much for the help. I am sorry that I split my project into two threads I didn't mean any disrespect, its just that in the past when I have put multiple questions into one thread people have gotten upset at me for that.

I bought the 8 channel relay because it was part of the schematics for the first tutorial that I looked at, but as I mentioned before he also had a humidity sensor hooked up to it so I started looking for simplier ones, but was struggling to find one.

patduino:
Try this. It'll bother some folks because of the delay statements, but the program is SOOO simple, it's hard to justify doing it any other way. Attach digital pin 2 to your relay.

void setup(){

pinMode(2, OUTPUT);
}

void loop() {
 digitalWrite(2, HIGH);
 delay(900000); // on for 15 mins
 digitalWrite(2, LOW);
 delay(300000); // off for 5 mins
}

Why would the delay bother some people?

If that's all you have to do in your sketch, delay() will work.
The point is you have 8 relays, that might suggest you may have more than one relay operating at a time.
If so, since delay() freezes program operation for that amount of time, you won't be able to do more than one thing at a time.

.

Too often novice programmers use delay statements to control the on/off behavior of lights, relays, etc., and wonder why their programs stop responding to button presses or serial commands. Since you aren't doing that, delays are acceptable. BUT - if you ever want to use one of the other 7 relays for something, you'll need to revisit this approach. (Search the forum for "blink without delay" for an example.)

If you use this snippet, be sure to reverse the logic (HIGH/LOW) as Wawa notes. Your relay is most likely 'active low' which means the relay will activate when the control signal is LOW. A simple test will let you know what flavor you have.

pat.