Clock timing

How would I set the arduino to turn pumps on and off with a relay at certain times of day instead of time periods. The time period method works but if the arduino gets reset it loses its time schedule.

I would always go for a Real Time Clock like the DS1307 and use the TimeAlarms library. All is explained here in the Playground.

Even a real time clock will reset or lose time on a full power down. You need a memory backup battery, most applications use one of those watch batteries. Just enough to keep the internal processor and memory active while waiting for the main power to be returned.

harddrive123:
You need a memory backup battery, most applications use one of those watch batteries.

Yep, I use one of these.

As I write this, the time is showing on my Arduino server page here.

Hi Arczi,
I think it's all been said! Just use a DS1307 RTC with a back-up battery, like a CR2032. This will keep the RTC ticking over for months even without any other power, some modules from China via eBay, etc now carry a rechargable CR2032, but not sure if that's good or not!

Controlling the pumps with relays via FET's should'ent be a problem, but perhaps you have sorted this bit out, if not just say and I'm sure one of us will help.

Regards

Mel.

A CR2032 should last 10 years with a DS1307, as it has 4 times the necessary capacity
and the shelf life is 10 years or more.

MarkT:
A CR2032 should last 10 years with a DS1307, as it has 4 times the necessary capacity
and the shelf life is 10 years or more.

@MarkT,
Yes I’m sure your right regarding the CR2032 life span with the DS1307, in fact to save space I have used the much smaller CR1220 and that is still working a good 2 years on…

See picture.

Regards

Mel.