Help with DS3231 RTC module

Hi,

I want to switch a relay every 8 hours. so I want to use an RTC module to count the time. I want to get an input to the Arduino board every 8 hours from the RTC module so I can switch the relay. Can you program The RTC module to give out output at a specific time?

Or does the Arduino need to constantly read the RTC and I need to write some condition to calculate time elapsed?

You write a sketch that reads the time from the RTC.

Usually I use the 1 second output from the RTC to interrupt the Arduino then read time from the RTC.

When the correct time is read, you do your stuff.

DS3231 RTCs are very good.

Seem

nipzMegaMind:
Or does the Arduino need to constantly read the RTC and I need to write some condition to calculate time elapsed?

Reading data from DS3231 is not that difficult and you can place a check like increment some integer (Counter) after every 1 hour and when this Counter equals to 8 that means you have reached your required time and need to perform the action and then reset the counter for next reading.

Most RTC modules such as the DS3231 and MCP7940 have an alarm function with one or more alarms.

One alarm is enough, as you just set it to 8 hours later the moment it wakes you up.

Thanks, guys.
I'm going to use the alarm on the RTC module

The DS3231 makes for a very nice sleep controller for an Arduino project.

Put the Arduino to sleep and have the DS3231 wake it up using its Interrupt alarm output.

Sleep time from seconds to one month.

srnet:
The DS3231 makes for a very nice sleep controller for an Arduino project.
Put the Arduino to sleep and have the DS3231 wake it up using its Interrupt alarm output.

I'd be very keen to investigate that; do you have a link to a known-good project please?

I dont know of a 'project' that provides a tutorial on this but its basically just a combination of setting an alarm and using an interrupt to wake up an Arduino, standard stuff really.

A Google search on;

'arduino ds3231 alarm interrupt'

Points to a few examples.

srnet:
I dont know of a 'project' that provides a tutorial on this

I didn't ask for a tutorial; I simply asked if you knew of a "known-good" project, which, thanks, you don't, so that's answered. (And of course, I'm quite capable of investigoogling, but it's always nice to know from someone else's experience if site X's solution is known to work, while site Y's (read as: instructable's :wink: )looks ok but is actually crap.)

Review the URL in post #1.