Arduino Repeat Cycle Timer





Introduction: Arduino Repeat Cycle Timer

This is an arduino based repeating cycle timer. The times are set in the sketch and cannot be modified during operation.

It is durable, reliable, simple and cheaper than a comparable unit.

This relay is rated for 10 amps. The relay will melt if you exceed the maximum load. a space heater, water pump or large fan will draw more current and should be used carefully.

Step 1: Arduino Repeat Cycle Timer

The parts list:

Arduino: 26$

1 Channel Relay: 5$

Project Box: 6$

Re-purposed Xbox 360 cord: Free$

Cable Grip: 2.5$

Jumper wire kit: 13$

Outlet: 1$

I've used some risers for the relay and rigged my own risers for the Arduino from a Windex bottle straw and some nuts and bolts

Step 2: Install Into Box and Wire

i'd like to make a fancy wiring diagram with and add it here but....

The 12v wiring is

3.3v to VCC

Gnd to gnd

Pin 2 to IN

For the 120 v I've included a image of how I've wired the relay. you just run the common wire into the centre of the relay and then connect the N/C (normally closed) side of the terminal block to the outlet.

maybe ill update my Instructable with some diagrams in the future but for now this is what you get.

first I used a drill and file to create a hole for USB port and dc barrel jack to fit

second I marked the arduino's holes on the bottom of the project box for the risers to go into.

I've used a lighter and hair dry to soften the plastic when reaming or threading any holes to avoid the plastic cracking

I've also used a lighter the soften the risers into the plastic

I've also added a few air holes to allow heat to escape the box and used the cord grip to secure the power source the relay will get hot

I then used my dremel to cut the lid of the box to allow the 120v outlet fit.

Step 3: The Code

Here is the code

Change the offTime and onTime values to adjust the cycle times they are in milliseconds here's a link to a converter

I have plagiarized this code from other arduino projects and it works. the other project included multiple simultaneous functions and inputs this one does not.

I am aware of the the option to use delay instead of complex timer values and math.



    • Oil Contest

      Oil Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest

    12 Discussions

    Great project. I really like the project box. For safety I might break the Black "HOT" cable through the relay instead of the White "Neutral"

    5 replies

    what difference would it make ?

    For safety reasons and I would change the normally close to the normally open connection and change the program with the inverse times as well

    As someone who went to school to become an apprentice electrician, NEVER EVER switch a neutral. There is a good chance that if something goes wrong, YOU WILL DIE as the hot is still energized.

    you will not die i'm a power engineer and i've been shocked enough times

    It would make a difference between "DEAD or ALIVE"!!!!!! If you brake the "neutral" the "HOT/black" is still alive, and if you are gounded to something & touch that lead/black = DEAD YOU ARE!!!!

    I think a 5v switched 120v solid state relay would be better for longevity and you could get a higher output capicity

    But if you have taken a "doze" of say: 120VAC/60Hz @ 50mA, you wouldn''t be here among us writing your stupid messages, (there maybe a "heavenly" internet there through which you could communicate with us living people down here, please send me the "url to heaven", so I could communicate with THE GREAT MASTER OF UNIVERSUM himself) :) :)

    1. You say "120V at 15A", 15Amps = 15,000mA. They estimate that You can't hold 120ACV with a Amperege of a 10mA, (READ 10milliamps), without damage. So Your 15A could kill about ~1,000 people at one stroke, (20mA/person)

    2. It doesn't matter which side you "cut" your "load", the heat generated is allways the amount of power going thrue the wires. P=U*I => where P=power=Watt, U=Potential niveau difference=Volt, I=Current=Ampere. Wery often the the result of, (UxI), Power (W) results in "heat" (heaters), or in "motion" (motors)....etc.

    Re: "what difference does it make?"

    In the USA, it's the convention and required the National Electrical Code.

    It's doubtful these low cost relay modules meet any electrical standards.

    The below info is from a medical source. Skin resistance does play a roll.

    1 mA;
    Barely perceptible

    16 mA; Maximum current an average man can grasp and “let go”

    20 mA Paralysis of respiratory muscles

    100 mA; Ventricular fibrillation threshold

    2 A; Cardiac standstill and internal organ damage

    15/20 A; Common fuse breaker opens circuit

    This is an awesome Arduino timer.

    This would be a really cool way to make a simple automation system.