attiny85 + 4060 + 32k quartz

First of all let me thank you all for sharing your knowledge here, I learned much from this forum.

I would like to seek for advice on how to make simple timer whose purpose would be turning on device during lower electricity price which is 8 hours per day, using relay of course.

I did this using arduino uno and DS3231 RTC but then I thought about it and figured its quite an overkill in hardware for such a trivial function so I thought on using parts mentioned in the title

32k clock crystal on oscillator input to 4060 should give 500 ms period on the output of the O13 (most significant pin of 4060 14 stage binary counter)

My question is following: would you recommend interrupt for detecting raising 2Hz pulse edge or something else? Would you use attiny85 8 bit counters or simple while loop counting pulses to 57600/115200

Or maybe I missed something and there is even simpler solution to this?

I hope my question is clear, Im here to give any more details if needed.

Could you clock the tiny off the 32 khz crystal, and just rely on that? I don't see how this would be less accurate than what you're proposing, and it's simpler.

druid: 32k clock crystal on oscillator input to 4060 should give 500 ms period on the output of the O13 (most significant pin of 4060 14 stage binary counter)

Or maybe I missed something and there is even simpler solution to this?

I hope my question is clear, Im here to give any more details if needed.

Just throw atiny 85 at it: here Set up an interrupt for the pulse, count it, and do a UNIX kind of seconds since date. Or, get a bit more complex and use IR to set the pseudo-clock, here.

Ray

My Projects

Thank you both very much, I will try that.

If I understood correctly, I should set attiny85 fuse according to datasheets low freq oscillator part and set timer1 prescaler to 128 so I have counter overflow at exactly one second 2^8*128 = 32768 which is the exact oscillator frequency. And from 1 second, I could work my way out with the code

Am I right?

The reason for using the DS3231 - in a module already built - is that it has a lithium battery backup which will keep it running during power outages - up to a year if correctly operated.

Basically, that immediately trumps matters of cost and so-called "simplicity; in fact, the DS3231 is if anything, simpler, it contains the power changeover circuit - and the crystal - in one chip.

It is not "overkill" - it is the simpler solution.

If you want to frig around with other bits and pieces, well, go ahead, but if you actually want to get the job done, use the proper equipment.

Paul__B: The reason for using the DS3231 - in a module already built - is that it has a lithium battery backup which will keep it running during power outages - up to a year if correctly operated.

Basically, that immediately trumps matters of cost and so-called "simplicity; in fact, the DS3231 is if anything, simpler, it contains the power changeover circuit - and the crystal - in one chip.

It is not "overkill" - it is the simpler solution.

If you want to frig around with other bits and pieces, well, go ahead, but if you actually want to get the job done, use the proper equipment.

so you would recommend DS3231+attiny? Or there is a way to program DS SQW output to give 8 hours high 16 hours low output on its own (without micro-controller) I must say this would be the most elegant solution. Only DS3231 and relay...but is it possible?

You would need to program it with the UNO - and then disconnect it, then the DS3231 can go on its own.

One more question about stand alone use of DS3231. Setting alarms with Uno is easy, but my question is following: After the alarms are triggered do they stay defined indefinitely or you have to set them again, which can be done only over I2C bus? And if alarms stay defined forever how to program SQW output to go hihg on first and LOW on second alarm? At my disposal is DS3231 module with AT24C32 memory chip on it. Link

I couldn't find any documentation on how I should do this, any recommendation is much appreciated.