DDesigning a Binary Clock using logic gates
Jacob John ∗ School of Computer Science and Engineering (SCOPE)Vellore Institute of Technology, VelloreEmail: ∗ [email protected] Abstract —Wrist watches have been a common fashion acces-sory addition for several people. However, the concept of usinga seven-segment digital display or sometimes, even an analogindicator hasn’t changed for a number of years. This projectaims to test and design a binary clock, also referred to as clocks or even
8, 4, 2, 1 clocks (due to theirdisplay configuration), that could change this everlasting displayfor watches. Specifically, digital logic and design engineers wouldfind interest in this topic due to sophistication involved in reading-out the time. This project will do so using a by showing eachdecimal digit of sexagesimal time as a binary value. This designwill be primarily functioning on logic gates and would involve theuse of several basic components that include, but are not limitedto, integrated circuits (or ICs), Light emitting diodes (LEDs) andresistors.
Index Terms —binary clock, logic gates, bread board, sexages-imal, integrated circuits
I. I
NTRODUCTION
A. Standard Seven Segment Display
A seven-segment display, in digital electronics, is a formof electronic display device used as a means to represent adecimal digit using a seven individually lit segments. Theimage below shows a standard seven segment display withoutthe decimal point:
Fig. 1. A standard seven segment display without decimal point [6]
As shown in the figure, the segments of the display areillustrated and referred by the
A,B,C,D,E,F and G . An engineercan choose to select for which set of inputs will each segmentLED will light up for using these characterizing letters,
A-G .Using this concept, a binary clock or a “complete” clockcan be represented using 3 seven segment displays, 1 two-decimal point/colon display and 1 two segment display. Timeuses a sexagesimal concept which can also be referred to asthe base 60 concept in digital technology. This is because theminutes and seconds part of a clock only ranges from 0-59,while repeating the cycle and incrementing the preceding place by a value of 1. The first digit of the hours place can berepresented by a two segment display as the most significantdigit maximum value of hours (i.e. 12) is 1. Furthermore, sincethe minutes place can range from , 2 seven segmentsdisplays are required. Finally the colon or the two-decimalpoint display is used as a minutes to seconds separator. Hence,the final outcome for the display is as follows:
Fig. 2. A standard seven segment display of a 12-hour digital clock
Note : Although, The circuit designed in this project willutilize a hours place, a minutes place and a seconds place forthis project, it is not displayed in the figure above. This isto allow for a less complicated explanation for the principleof the seven segment displays used in 12 hour digital clocks.Furthermore, majority of 12 hour digital clocks only employa hours place and a minutes place.
B. Binary Clock Display
A binary clock displays the time of day in a binary format.It uses a similar concept of HH:MM:SS or an hours place,minutes place and a seconds place like standard 12 or 24 hourclocks usually do. However, each decimal digit of sexagesimalor base 60 time, will be represented as a binary value. Similarclocks based on gray code and BCD logic also exist, but ourmain focus is on the use of binary values.
Fig. 3. BCD on the left and traditional binary (as used in this clock) on theright displaying 11:45:38 in 12 hour format [7]
The binary clock in this project will be utilizing the tradi-tional binary format (on the left image of Fig. 3). Time forseconds, hours and minutes are calculated by adding up the lit a r X i v : . [ c s . OH ] F e b p LEDs to the corresponding power of 2. On the illustrationon the right, in the circuit for the seconds part the LEDs for , and are lit up. Hence, the seconds part is .For the minutes part, the LEDs for , , and are litup. Hence, the output is
32 + 8 + 4 + 1 = 45 . Finally, for thehours section, the LEDs for , and are lit up. Hence,the output is . Using this process we obtain11:45:38. This traditional clock is also a form of a 24 hourclock.The circuit on the left follows a different approach, ratherthan adding digits using powers of 2 in a horizontal fashion,we take the sum in a vertical fashion. Each segment representstwo parts–first the tens part and then the ones part. Thefirst segment is the hours segment. In the figure, the tenspart of the hours segment is one. This is because the LEDcorresponding to only 1 is lit up. Similarly, the ones part isalso 1. Thus the hours segment corresponds to 11. Using thesame logic as discussed for the hours segment, the tens partof the minutes segment is 4. However, in the ones part of theminutes segment since 2 LEDs are lit up, we need to add thesetwo numbers, i.e., . Hereby forming the number 45.Finally, the seconds segment represents 38, thus we obtain thetime 11:45:38. This is the representation we will be proceedingwith. II. I NVESTIGATION
A. Circuit Diagram
The following circuit is a schematic of the logic diagramfor the binary clock which is going to be implemented.
Fig. 4. Logic circuit using logic gates for a binary clock [7]
B. Components Required
The components required for this circuit are as follows: × × × × × Switch ( But ton ) , f o r s e t t i n g and r e s e t t i n g t h etime2 ×
100 nF C a p a c i t o r4 ×
47 k Ω R e s i s t o r s17 × Ω R e s i s t o r s3 ×
10 k Ω R e s i s t o r s1 × Arduino c h i p
C. Feasibility Study
All the resistors, IC, Clock crystal, capacitor, LEDs andbread board are also available locally. So all the required partscan be acquired easily and are within our scope. The pricesin the table below are in
Indian Rupees (INR or | ). Estimated Costs
Component Name Quantity CostBread Board 2 | | | | | | | Grand Total | Note : The costs are highest bound estimates that includeextra components as well.
Note : IN | ETHODOLOGY
A. Initial preparation
Traditionally, time is displayed in a 24 hour format ondigital clocks as mentioned earlier. Furthermore, constructinga counter that display a 24 hour format is easy as the clockalways resets ‘0’ on the 24th count, also common referredto as midnight. Meanwhile, 12 hour clocks resets to ‘1’ onthe 13th count or 1 o’clock. When designing a basic counterusing registers, such as a 3-bit or 4-bit asynchronous up and/ordown counters, the count traditionally resets back to 0. This isbecause JK edge triggered flip flops that are sensitive to pulsetriggering and thus providing a continuous clock pulse to aasynchronous circuit is a very tedious task. Thus, making thecounter design far more complicated for a 12 hour clock.This project is going to be using logic gates and binaryripple counters to make a 24 hour binary clock due to thedifficulty we may face while constructing a 12 hour binaryclock. As shown in Fig. 3, the final binary clock should displaytime in binary format, which will represent time as 24 hourdigital clock would, i.e., HH:MM:SS.
B. Counting up
The display section of the 12 hour clock utilizes three74HC393 ICs. 74HC393 is a dual 4-bit binary ripple counterthat contains two 4-bit binary counters with individual clocks.Furthermore, it also contains two master resets to clear each4-bit counter individually. [2] This allows for resetting of thecounter once the final count is reached. A circuit diagram forthis IC is given below: ig. 5. 74HC393: Dual 4-bit binary ripple counter [2]
The two 4-bit binary counters can be used to produce asingle a single 8-bit counter. For this project however, only 6bits are needed for minutes and for seconds while 5 bits arerequired for the hours part. Furthermore, two AND gates or74HC08 quad AND gate ICs are used to reset the counters.Resetting will take place once the desired binary number hasreached it’s highest value. In the case of minutes and forseconds, the resetting should take place at ‘60’, so that ‘60’is not actually displayed on the clock. For hours, on the otherhand, resetting should place at ‘24’. The schematic this projectis using is displayed as Fig. 5 of this report.1 Hz pulses are fed into the clock input of the seconds74HC393 IC as shown in Fig. 7. The counters are triggeredby a HIGH-to-LOW transition of the clock inputs. [2] This isalso known as negative edge triggering in the case of a flipflop, specifically, known as a register as it is sensitive to pulsetransitions. The reason for choosing a 1 Hz frequency for theclock pulse is because the counter would increment by 1 everytime the clock pulse transitions, which is every second. Thusmaking it suitable for a binary clock . Fig. 6. 74HC393 seconds counter being fed with a 1Hz clock pulse [7]
The counter above is the seconds counter which counts up to‘59’ and then resets back to ‘0’ on the 60th count. This can bedone with the use of an AND gate and a simple combinational logic. Since the maximum count is produced when the fourpins- 8, 9, 3 and 4 are active or when ,the output of the AND gate will only be HIGH when thesefour pins have a HIGH output. This will send a LOW to HIGHsignal to the
RES1 of the counter, which will clear or reset thecounter. On the other hand, the clock inputs require a transitionfrom HIGH to LOW to the advance the clock.
Fig. 7. The most significant ouput of the Seconds counter being connectedto the clock of the minutes counter [7]
The negative edge triggering of the clock input be usedto our advantage. The most significant output, i.e. 32 willbe connected to the clock count of the next counter. Thismeans that on the count of 32, the output will be HIGH. Butnothing will happen yet as even the AND gate is waiting forthe inputs connected to it to become HIGH. Once they do, thecounter resets and all the outputs connected to it, including 32,becomes LOW. This will create a negative edge trigger andthe clock will go to the next stage. The same way, the minutealso triggers the hours clock. When the time reaches 23:59:59the next clock pulse will reset the whole clock to zero and forone second at midnight the display will be completely blank.
C. Setting the clock
In this clock, only two push buttons are used for setting thetime instead of three. These two push buttons will be used toset the hours, minutes and seconds part of the binary clock.The hours are set initially. Once the hours are set, the minutespart will be zeroed. Next, the minutes part will be set. Oncethe minutes part is set, the seconds part will be zeroed.In order to try and set the clock as accurately as possibly,one should adopt an unconventional approach. Set the time ofone minute before when you want the clock to start from. Thenwait for the signal and then press the set button for the minutespart. This will start the clock with the seconds counting fromzero. ig. 8. Setting the binary clock [7]
The set is connected to the clock input of hours as shownin the diagram above. Every time the set button is pressed onthe hours part, a HIGH start is produced on the clock input ofthe hours counter. This is similar to the HIGH from the ‘32’output of the previous stage when it becomes active. The inputis primed but nothing happens. Once the button is released,a LOW state is produced on the clock input and the counteradvances by one. The HIGH produced when the set button ispressed is also fed to the reset pins of the previous (minutes)stage to zero its outputs. This is done because the clock inputmay be LOW if the time showing is early (which is OK) orHIGH due to the ‘32’ priming signal if the time is late (whichis not OK). Resetting the outputs of the previous counter toLOW prevents any conflict between the clock pulse from thecounter and the ‘SET’ pulse from the push button.
Fig. 9. A 74HC14 hex inverting Schmitt trigger IC is used to eliminate switchcontact bounce [7]
A 74HC14 hex inverting Schmitt trigger IC is used toeliminate switch contact bounce. When a mechnical switchcloses, the switch elements will often bounce, before makingfinal contact. This would otherwise produce unwanted clockset pulses in the binary clock circuit. [3]
D. 1 Hz Clock input
An Arduino chip was used to produce a 1Hz input for thefirst stage or the seconds stage of the clock. This is becausea clock crystal PCB wasn’t available. This increased the costsof the project significantly but we managed to keep it withinthe specified budget. The following code was used to generatea 1 Hz clock pulse using the ardunio chip: void s e t u p ( ) { / / i n i t i a l i z e d i g i t a l p i n 13 as an o u t p u t pinMode ( 1 3 ,OUTPUT) ; } / / t h e loop f u n c t i o n r u n s over and over a g a i nf o r e v e r void loop ( ) { d i g i t a l w r i t e ( 1 3 ,HIGH) ; / / t u r n t h e LED on (HIGH i st h e v o l a t a g e l e v e l ) d e l a y ( 5 0 0 ) ; / / w a i t f o r a second d i g i t a l w r i t e ( 1 3 ,LOW) ; / / t u r n t h e LED o f f (LOW i st h e v o l t a g e l e v e l ) d e l a y ( 5 0 0 ) ; / / w a i t f o r a second } IV. F
UTURE E NHANCEMENTS
This project could proceed further on to develop a binaryclock for smart watches. Smart watches, or wearable comput-ers, are digital or computerized wrist watches, with function-ality that go beyond time keeping. Watches such as the Apple iWatch and the Samsung
Gear consists of a small but high-resolution LCD screen to display notifications, calculations,etc. Such companies also provide “Watch” support for anapplication during development. A smart watch applicationcould be designed to display the time in a binary format for tech-savvy enthusiast. Considering that smartwatches are usually worn by people who’re proficient intechnology, the binary clock could be a successfully idea.Another extension could be to make the entire watch smallenough to fit as a wristwatch. This can be done with the useof smaller ICs and a soldering kit. The aim of this projectcould be to make a economically priced watch for engineers.This would also require much smaller LEDs and since LEDshave a high light intensity, it could be easily viewable in alow-light environment as compared to regular seven-segmentdisplays on economical digital wrist watch displays that use acheap back-light to present time.A
CKNOWLEDGMENT
The author would like to thank his Professor
Yokesh Babu for helping him decide our project and to obtain the resourceshe required and also for his invaluable insight in our day today working of the project. Furthermore, I would also liketo thank him for his continuous criticism and for setting uson the right path with our project and for the new ideas Ireceived from him. I would also like to thank our friends whohelped us with the Implementation stage of the project andalso gave us mental support. Finally we would like to thank
Vellore Institute of Technology for providing us with such achance and the required facilities to aid us in our project.R
EFERENCES[1] “74HC/HCT08 Quad 2-input AND Gate.”
Philips Semiconductors, Dec. 1990. Web. 20Apr. 2017.[2] “74HC/HCT393 Dual 4-bit Binary Ripple Counter.”
Philips Semiconductors, Dec.1990. Web. 20 Apr. 2017.3] “74HC14 HEX INVERTERS WITH SCHMITT TRIGGER INPUTS.”
Diodes Incorporated, Jan. 2013. Web. 2 May 2017.[4] Hareendran, T.K. “Quartz 1Hz Generator.”
Electroschematics.com
Elec-tro Schematics, n.d. Web. 20 Apr. 2017.[5] Iideetee. “Binary Clock”
Instructables.com
Instructables, 12 May 2016.Web. 17 Apr. 2017.[6] Mano, M. Morris., and Michael D. Ciletti.
Digital Design: With aIntroduction to the Verilog HDL
24 Hour Binary Clock24 Hour Binary Clock