I want a timer which will of for 2 seconds in a day and drive relay .Iam planning to use CD 4060 for this purpose. Iam not able to get how to choose R1 and C1 values for the same.Can anyone help me out on this.

  • 1
    \$\begingroup\$ Something like CD4060 is a poor choice for accurate timekeeping; an RTC chip is a much better option. \$\endgroup\$ – Nick Johnson Oct 29 '15 at 11:05
  • \$\begingroup\$ I hate to say this, but have you considered Arduino? \$\endgroup\$ – Dmitry Grigoryev Oct 29 '15 at 12:58
  • \$\begingroup\$ @kishor: Never mind an upvote or an accept, don't I even get a simple "thank you"? \$\endgroup\$ – EM Fields Nov 1 '15 at 18:59

There are about 86400 seconds in a day, so if you want 86398 seconds to go by and then drive a relay for the 2 seconds left and then start all over again, there's no easy way to do it with just a 4060, and there's absolutely no way you can do it with an RC based clock. Sorry 'bout that...

However, all is not lost! Following is a circuit which will count up to 86400 then reset itself and start counting up to 86400 again, and turn a relay on for 2 seconds when the counter resets.

So, you'll have the relay turn ON for two seconds at precisely the same time each day, subject to the vagaries of the clock, and you can get a clock as precise or as sloppy as you like.


Since there are 86400 seconds in a day, if we start at zero and count 1Hz clock cycles, 24 hours will have elapsed when the count reaches 86400.

86400 decimal is 15180 hex, which is binary\$ \ \ \ \style{color:black;font-size:100%}{0001\ \ 0101\ \ 0001\ \ 1000\ \ 0000}\$

with the MSB on the left, so we'll need a 17 bit binary counter for all that to fit into.

The CD4040 is a nice little no-frills vanilla CMOS 12 bit binary ripple counter, so if we cascade two of them that'll give us 24 bits. A little overkill, but nothing to get hung about.

Next, in order to know when we've gotten to 86400, all we have to do is AND all of the outputs from the counters which are ONES when the count reaches 86400. There are only five, and the only time they'll all be true is when the count reaches 86400, so four 2 input AND gates wired as shown on the schematic will do the decode.

Then, in order to start the cycle anew and turn the relay ON, we send the decode to the counters' RESET pins and SET a dflop which is used as a clocked RS latch.

The latch then drives Q1, which will turn the relay ON until U2Q2 goes high for the first time since the RESET occurred, which will take two one-second clock cycles. When that happens, the low on the dflop's "D" will be clocked through to the dflop's Q output, which will de-energize the relay.

In the meantime, the counter will be counting, and when the decode goes true again the counter will be reset and the relay will be energized, starting the cycle anew.

If you'd like to simulate the circuit, here's a link to the files you'll need.

Just copy all of the files into the same folder and, if you have LTspice installed, left-click on the .asc file. LTspice should then start up and display the schematic.

To run the simulation, left-click on the running man icon on the toolbar and the simulation should run.

In order to show how it works, and yet converge on a solution quickly, I've shortened the decode to 16 clocks while maintaining the 2 clock output for the relay.

enter image description here

  • \$\begingroup\$ Actually there are exactly 86400 seconds in a day (most days unless the calendar geeks are adjusting the clocks). Also there very well could be ways to get pretty close. One could build something with two CD4060 chips. Use one with a trimpot adjusted oscillator of nominally 3106.89 kHz dividing by 2^^14. Take the Q14 output to clock the second CD4060 and let it also divide by 2^^14. The Q14 of the second counter chip can be used to trigger an RC generated 2 second delay to fire the relay. If needed this 2 second pulse could also be trimpot adjusted. \$\endgroup\$ – Michael Karas Oct 29 '15 at 14:04
  • \$\begingroup\$ 3106.89 kHz with a screwdriver adjustment to about 1 part in 300000? That's just a little better than 4 PPM using analog components open-loop. Good luck with that! ;) In the meantime, I've edited my answer with what I think is a much more reasonable approach which uses a 1Hz clock. An Abracon ASTMK-0.001kHz-LQ-DCC-H-T goes for 1.93 USD in onesies from DigiKey and it's a 300 PPM part. Not too shabby, and you don't have to wait 24 hours to see if that last trimpot tweak was too much or not enough. \$\endgroup\$ – EM Fields Oct 29 '15 at 21:19
  • 1
    \$\begingroup\$ @EMFields The ASTMK-0.001kHz-LQ-DCC-H-T looks like nice part. According to the datsheet, unless I'm misreading it, it looks to me like the original tolerance is ±20 ppm and the frequency tolerance is ±75 over a temperature range of -10°C to +70°C and 3.3V -- about three times better than your 300 ppm number. \$\endgroup\$ – tcrosley Oct 30 '15 at 6:44
  • \$\begingroup\$ @tcrosley: You're right, of course. Mea culpa since I didn't check the Abracon data sheet, and I thought I got that 300 ppm number from the DigiKey selection matrix, but checking back it quotes stability at +/- 100 ppm from -40 ~ 85C, so I don't know where that 300 ppm came from. Nice catch; thanks. :-) \$\endgroup\$ – EM Fields Oct 30 '15 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.