Saturday, July 28, 2012

24Hr Digital Clock and Alarm Circuit Using Logic ICs - CD4017 CD4026

[Updated]
06/05/2018 - Added Month and Date Reset Feature


This is my first clock project, and used logic IC such as 4017, 4026 to build this clock circuit. Its include Date, Day, and Hourly alarm.See below picture.

Logic clock preview
Preview

It’s very complicated at first sight. But it is not. First of all you can build main circuit and check it work or not.If the circuit work fine, then add other parts step by step to the circuit.

If it’s not work check all component and connections are correct and also check Seven Segment Displays. In my circuit I used LEDs but it is possible to use Seven Segment Displays.
Add &transistors if you use LED or big Seven Segment Displays because this logic ICs can not handle large current. I connect this circuit with 6v backup battery to prevent time lost when the power is fail. In power failure displays are turned off but time is running using battery power.

Logic clock circuit
Full Circuit Diagram

1Hz Signal Generators

To generate 1Hz clock pulse for this circuit here I used circuit of a ordinary clock machine. you can buy a clock machine very cheap price at electronic shops or you can get it from old clock. In below picture you can see most common circuits of clock circuits. By giving power to this circuit we can able to get 1Hz output across the pins that are connected to coil (motor). (But actually we can get only 0.5Hz pulse in one pin. So get 1Hz we need to connect those pins by two diodes. you can see that in the diagram).

1hz signal generator circuit
Clock circuits

4017 decade counter (1-of-10)

CD4017 pin The count advances as the clock input becomes high (on the rising-edge). Each output Q0-Q9 goes high in turn as counting advances. For some functions (such as flash sequences) outputs may be combined using diodes.

 The reset input should be low (0V) for normal operation (counting 0-9). When high it resets the count to zero (Q0 high). This can be done manually with a switch between reset and +Vs and a 10k resistor between reset and 0V. Counting to less than 9 is achieved by connecting the relevant output (Q0-Q9) to reset, for example to count 0,1,2,3 connect Q4 to reset.

 The disable input should be low (0V) for normal operation. When high it disables counting so that clock pulses are ignored and the count is kept constant.

 The ÷10 output is high for counts 0-4 and low for 5-9, so it provides an output at 1/10 of the clock frequency. It can be used to drive the clock input of another 4017 (to count the tens).

4026 decade counter and 7-segment display driver

CD4026 pin The count advances as the clock input becomes high (on the rising-edge). The outputs a-g go high to light the appropriate segments of a common-cathode 7-segment display as the count advances. The maximum output current is about 1mA with a 4.5V supply and 4mA with a 9V supply. This is sufficient to directly drive many 7-segment LED displays. The table below shows the segment sequence in detail.

 The reset input should be low (0V) for normal operation (counting 0-9). When high it resets the count to zero.

 The disable clock input should be low (0V) for normal operation. When high it disables counting so that clock pulses are ignored and the count is kept constant.

 The enable display input should be high (+Vs) for normal operation. When low it makes outputs a-g low, giving a blank display. The enable out follows this input but with a brief delay.

 The ÷10 output (h in table) is high for counts 0-4 and low for 5-9, so it provides an output at 1/10 of the clock frequency. It can be used to drive the clock input of another 4026 to provide multi digit counting.

cd4026 display chart
4026 display chart

CD4073 triple 3-input AND Gate

CD4073 internal
CD4073 pin

The 4073 has three separate 3-input AND gates which you can use independently.

Truth table

The truth table of each individual gate is:
C B A Output
0 0 0
0 0 1 0
0 1 0 0
0 1 1    0
0    0
1 0 0
1 1 0    0
1 1   1 1

where '0' represents a LOW voltage, and '1' represents a HIGH voltage.

Basic operation

You can investigate the behavior of a single 3-input AND gate using this circuit:

3-input AND gate operation
The inputs of the gate must be connected, either to LOW or to HIGH, and must not be left open circuit. This is the function of the input switches with their pull-down resistors. To avoid loading the output of the gate, a transistor switch indicator circuit should be used. It is good practice with CMOS circuits to insert a decoupling capacitor, 47µF or 100µF, across the power supply. (This helps to prevent the transfer of spikes along the power supply rails.)

UM348X

UM348X  pin
The UM348X series is a mask-ROM-programmed multi instruction melody generator, implemented in the CMOS technology. They are designed to play the melody according to the previously programmed information and capable of generating 16 songs with 3 instrument sounds, the piano, the origin and the mandolin.

The devices also included a per-amplifier which provide simple interface to the driver circuit. The UM348X series is intended for applications such as toys, door bells, music boxes, melody clock/timers and telephones


Month and Date Reset

Month and Date Reset Circuit
Month and Reset Circuit
This is a newly added circuit and use 16F628A micro-controller. you have to program it before use. the purposes of this circuit are show month and reset date according to the month. Ex: Jan 31, Feb 28, Etc. PIC use its internal oscillator and circuit is very simple. To save pins, Month shows binary format.
Ex: 1=0001, 2=0010, 3=0011, etc.
For power supply and more details please refer device datasheet. 


Code

/******************************************************************************* Month and Date Reset - 16F628A Copyright (C) 2014 Praneeth Kanishka This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses >> Email: scorpionzblog@gmail.com >> Web : http://scopionz.blogspot.com *******************************************************************************/ int count=1, month=1, date=1; const char day_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; // Interrupt Service Routine (ISR) void interrupt() { if (INTCON.INTF) // Check for interrupt { PORTA.F2=1; count=count+1; delay_ms(5); PORTA.F2=0; if(count>day_month[month]) { count=1; if(++month>12) month=1; PORTA.F3=1; Delay_ms(5); PORTA.F3=0; PORTA.F2=1; Delay_ms(5); PORTA.F2=0; } PORTB = month<< 0x07="" a0="" clear="" cmcon="" comparators="" delay_ms="" disable="" flag="" if="" intcon.intf="0;" intcon="0b10010000;" interrupt="" interrupts="" main="" month="" nable="" option_reg.intedg="0;" pcon.oscf="1;" porta.f2="0;" porta="0x00;" portb="month<<4;" rb0="" trisa="0x03;" trisb="0x01;" void="" while="" z="">12) month=1; PORTB = month<< count="" delay_ms="" if=""> day_month[month]) { count=1; PORTA.F3=1; Delay_ms(5); PORTA.F3=0; } PORTA.F2=1; Delay_ms(50); PORTA.F2=0; Delay_ms(400); } } }

Posted By :

Please Note: All contents provided on this blog are for non-commercial purposes only.
Any question..? Feel Free to Ask!

Drop your Comments below. Please report broken links to here
  1. how the hell download the file

    ReplyDelete
    Replies
    1. Register -> check your inbox for confirmation email -> activate account by clicking link -> Login -> Download

      Delete
    2. Where do I register to download the file?
      I need for my work of digital electronics
      From: Brazil

      Delete
    3. You can able to download files without registering

      Delete
  2. The seconds display continues to count up to 99 then starts again to 0. Should it be counting up to 60 then back to 0. The minute display is not counting. Just to make sure, is the circuit correct or I have miss somewhere in the connections. Please help

    ReplyDelete
    Replies
    1. Seconds should be counting up to 59 then back to 0. Check reset pin (15) of U2 and connection of 4073.

      Delete
  3. What software this circuit simulated on?

    ReplyDelete
  4. How to modified 24 hr to 12hr ? And which display use for day date

    ReplyDelete
    Replies
    1. 4017 and leds are used to indicate day and U8 and U9 shows date.

      Delete
  5. How to modified 24 hr to 12hr?? Pls help

    ReplyDelete
    Replies
    1. U5:C reset the hours. if all the inputs are 1(5v) then output is 1, so 4026 will reset. in this clock it's 24. And if you want to use this as a 12hr clock you have to another things to do. because if U7 and U6 are reset, it start to count from zero. but in 12hr mode it must be one. so you have to give additional clock signal when both U7 and U6 are zero. Use your knowledge about gates. it is not a hard task.

      Delete
  6. Sir I have comlate circuit but some problem
    1) after 23 59 59 clock reseted and hr display direct 04 hr
    2) and clock make using 555 but it is not accurate pls guide me for perfect 1 htz

    ReplyDelete
    Replies
    1. 1) Check reset pin(15) of U6
      2) I used circuit of ordinary clock machine

      Delete
  7. Hi there! Quick question that's totally off topic. Do you
    know how to make your site mobile friendly? My site looks weird when browsing from my apple iphone.
    I'm trying to find a theme or plugin that might be able
    to correct this issue. If you have any suggestions, please share.
    Thanks!

    ReplyDelete
  8. Awesome blog! Is your theme custom made or did you
    download it from somewhere? A design like yours with a few simple tweeks would really make my blog jump out.
    Please let me know where you got your design. Cheers

    ReplyDelete
    Replies
    1. It is download from internet and customize. try google to search template.

      Delete
  9. Hello sir! Thank you for this blog post as we're using this as the basis of our digital clock circuit. However. we cannot find UM3487 IC for our alarm circuit. What are the other alternatives for that IC? We're thinking of using a buzzer as a replacement but we're still uncertain of its capabilities. Thank you!!! :)

    ReplyDelete
  10. Hello! Thank you so much for your blog post. We are currently using this as our basis for our digital alarm clock circuit prototype in school. But we cannot find any UM348X IC. Can you suggest any alternative for that IC? Thank you!

    ReplyDelete
  11. I have once again make it but now 1st digit of second continue run also not get clock pulse I have make it big display so use uln2003 when I touch power supply digit running stop pls help me

    ReplyDelete
  12. scorpionZ can you explain what circuit to use as the alarm circuit and what does the motor in the 1hz generator symbolize.

    ReplyDelete
    Replies
    1. Used UM3484 IC and circuit can be download from given link.
      In the clock machine O1 and O2 are connected to the magnetic coil. It will rotate wheels on clock machine. here I used old clock machine circuit to give 1Hz pulse to clock and O1 or O2 can directly connected to the clock circuit.

      Delete
  13. I have prepared old quart based circuit used for clock but without any clock given second digit run fast and when touch any part of circuit it has been stopi used common anode 1.5" display.and uln 2003 for amplifie

    ReplyDelete
  14. another issue is that the counter which displays the date is counting to 99 is there a way to count to 30 or 31

    ReplyDelete
    Replies
    1. Its not a big issue. because if we reset counter at 31 it display 0, not 1. And also some months have 30. So its difficult to setup a circuit. Just reset date at end of the month and it will show 1 in new month.

      Delete
  15. do you still have this file available for download?

    ReplyDelete
  16. I have just completed the circuit and it's working nice thanks for the diagram

    ReplyDelete
  17. Sir i have completed whole circuit and it worked properly im facing errors about pin is not in child module plzz reply soon

    ReplyDelete
  18. How do I get the diagram and hex file of the modified clock of pic16f84. 12 hours hex file.

    ReplyDelete
  19. i also made clock with ic 4026 but can u tell me what what truth table and boolean expression for that? or can u tell me boolean for ic 4026 seven segment?

    ReplyDelete
    Replies
    1. Boolean is applicable for logic Ics. 4026 is a counter & SSD driver.

      Delete
  20. Excuse me, in the compressed file of your download link, there are three Proteus files, but there is no Proteus file of 1Hz generator that I really want. If you can, can you send it to me?

    ReplyDelete
    Replies
    1. Those ICs are not include in the proteus. You can uses generator symbol to get 1Hz pulse in proteus.

      Delete
  21. Hey, can u explain why we connect u6,u7, and u11 from ic 4026 to input 4073 for reset 59 to 00 and u6, u7(1), u7(2) to reset 24 hour to 00?

    ReplyDelete
    Replies
    1. Not 59, it's 60.
      Did you see any clock shows xx:60 or 24:xx :)

      Delete
    2. Yes can u tell me why we connect to u6,7,11 to make it 00 for minute and u7(1),u7(2),u6 for hour?

      Delete
  22. Hello, I wanted to know how I can make the clock work only with the alarm and without the day counter

    ReplyDelete

 

on line

Labels

Recent comment

Visitors

Free counters!
Copyright © 2012 - Scorpionz™.,All rights reserved | Powered by Blogger