Adjustable timer to control relay.

For a project I need to activate a relay every x seconds. The time interval can be changed by 2 buttons (+ and -). I'm looking for a simple and clear solution. Can someone help me? Thanks.

Switching a relay on and off using seconds does not look good to me. Unless You spend lots of money on a heavy duty long life relay it will worn out sooner than You expect. Why not use a logic N-channel MOSFET transistor instead?

You could use an NE555 for that, and a pot or two.

Hi, thanks for willing to help me. The machine that this will operate is not going to run for a very long time. I don't think this will be a problem. I just need to know how you set a time variable (if it's called like this in Arduino terms) in an Arduino code. I'm looking for a simple way to make this happen. I'm sure there is but I haven't found it.

Using buttons You ought to use "debouncing" technics. Search for "button" here in Forum. One helper, Robin2, has written good code for a variety of usual problems, especially for buttons.

Ok, I'll give it a look. Thanks for the help!

Keep in mind you'll need two timers - the adjustable one controlled by +- and a fixed short duration one to actuate the relay.

Spend some time to understand the workings of the first five demos in IDE ->file/examples/digital.

A basic outline might be:

if timer1 at preset
set a boolean variable which a. energizes the relay and b. allows the relay timer2 to run.
reset timer1

if timer2 enabled, drive the relay on, else relay off.
if timer2 at preset reset boolean variable.

Don't try to make this all happen on your first try. Select a small piece, like just getting timer1 to run and reset, and get that working then add another small working piece to that, etc. Serial.print() selected values/variables so you can see what the sketch is doing as it runs.