Help: relay on schedule


I'd like to know how to control a relay on a schedule, at some specific time, for example: starts at 7:55:00 and ends at 7:59:23. I'm using Arduino Yun and process is used to get the date online.

Any help is welcome.

Thanks in advance.

Have a look at and the use of cron on the *nix side. Cheers.

The secret to this sort of quest is to break it up.

First you need to solve... or go around... the need for the Arduino to know the time of day. Maybe you've got that solved... although going online seems like a hard way to deal with this want. Do you really care about the time of day in human terms? (Rhetorical)

You may need help with turning on a relay? Take care here... there are some non-obvious "gotchas" which can permanently damage your Arduino. First you need to be able to turn an LED on and off when you want the relay on or off. Leave that LED in place, so you will know the Arduino is TRYING to turn the relay on/off when you add that. Once the LED is going on and off, you have an electronics question, the Arduino "stuff" is "done". Oh. Apart from the Arduino-electronics of not exceeding the limits of the current the Arduino pin will tolerate. Relays...

Start with something that turns your LED on/off for the first minute in every five. That will be a lot easier to test/develop/debug. If done right, once THAT's working, it will be "trivial" to change a few setting to get the on/off cycle you want... and you will have fewer (24 hour!) test/develop/debug cycles to go through to reach the working solution.

Oh! "First first" make something that turns the relay on when you press a button, turns it off when you release the button.