Vous êtes sur la page 1sur 19

A DIGITAL CLOCK THAT TELLS TIME, DATE AND TEPERARTURE

Prepared for

E.I.E Department Covenant University Ota, Ogun state IN PARTIAL FULFILMENT OF EIE 413(LABORATORY AND MINI PROJECT) Prepared by COMPUTER ENGINEERING (GROUP 5)

Edim Ekong Idam Chiamaka Igbokwe Chibueze Eweniyi Odunayo

(08CJ07988) (08CJ07991) ( ) (08CJ07990)

February 10, 2012

ACKNOWLEDGEMENT All thanks to everyone that was instrumental to making this project a reality. And special thanks to God for staying with us throughout. To the HOD,EIE department, to our supervisor Mrs Ifijeh and all those who assisted us, thank you. And finally to Computer Engineering Group five, it was amazing working with you.

ABSTRACT A digital clock is a type of clock that displays the time digitally, i.e. in cyphers, as opposed to an analog clock, where the time is displayed by hands. Digital clocks are often associated with electronic drives, but the "digital" description refers only to the display, not to the drive mechanism. (Both analog and digital clocks can be driven either mechanically or electronically, but "clockwork" mechanisms with digital displays are rare). To represent the time, most digital clocks use a seven-segment LED, VFD, or LCD display for each of four digits. They generally also include other elements to indicate whether the time is AM or PM, whether or not an alarm is set, and so on. Digital clocks that tell time and temperature are a rare beauty. Working with a PIC16F84 (A) and a DS18S20 temperature sensor greatly reduced the complexities of achieving a clock that tells time and temperature. We employed the use of many other components for the sake of completion of the project but none was as important as the PIC implemented. The PIC 16F84 (A) is the heart of the project, with it we could manipulate variables to bring out the desired output.

CONTENTS Acknowledgements Abstract Table of contents Declaration Certification Bill of Engineering Measurement and Evaluation Chapter 1 1.1 1.2 1.3 1.4 Introduction Motivation Aims and Objectives Methodology

Chapter 2: Literature Review 2.1 Applications and advantages 2.2 Operation of the circuit Chapter 3: System Design 3.1 Circuit diagram and descriptions 3.2 Program code 3.3 Components Used 3.4 Circuit Diagram for Power supply Chapter 4: Testing and Implementation 4.1 Pictorial Diagrams 4.2 Challenges Chapter 5: Conclusion References

DECLARATION We, the members of Group 5,Computer Engineering, hereby declare that the project was carried out by us and has not been used at any other place for any award or recognition.

CERTIFICATION This is to certify that this project is bonafide and was supervised by our lecture and supervisor, Mrs Ifijeh and has not been presented at any other place for awards or recognition.

BILL OF ENGINEERING MEASUREMENT AND EVALUATION

COMPONENTS 12 Pin Connector CONN H12 Bridge Rectifier 30pF Capacitors 470uF Capacitor 0.1uF Capacitors Green LED 4K7 ohms Resistor 220 ohms Resistor 100K ohms Resistor 220V Transformer IC 74HC04 inverter IC 7805 PIC 16F628A IC DS18B20 Thermometer Crystal Oscillator Buttons

QUANTITY

COST PER UNIT

TOTAL COST

CHAPTER 1
1.1 INTRODUCTION This project will be dealing with the digital aspect of building a clock. Digital, that is representing these electrical signals as binary or numbers. From research we have uncovered that all clocks (regardless of technology) have a few required components, for reference lets compare a pendulum clock to the digital clock, my inference are as follows: A source of power to run the clock: In a pendulum clock, the weights or the springs handle this role. An accurate time base that acts as the clock's heartbeat: In a pendulum clock, the pendulum and escapement handle this role. A way to gear down the time base to extract different components of time (hours, minutes, and seconds): In a pendulum clock, gears serve this role. A way to display the time: In a pendulum clock, the hands and face serve this role. A digital clock is no different. It simply handles these functions electronically rather than mechanically. So in a digital clock, there is an electrical power supply (either a battery or 120volt AC power from the wall). There is an electronic time base that "ticks" at some known and accurate rate. There is an electronic "gearing mechanism" of some sort -- generally a digital clock handles gearing with a component called a "counter." And there is a display, usually either LEDs (light emitting diodes) or an LCD (liquid crystal display). Digital clocks typically use the 50 or 60 hertz oscillation of AC power or a 32,768 hertz crystal oscillator as in a quartz clock to keep time. Most digital clocks display the hour of the day in 24 hour format; in the United States and a few other countries, a more commonly used hour sequence option is 12 hour format (with some indication of AM or PM). Emulations of analog-style faces often use an LCD screen, and these are also sometimes described as "digital". To represent the time, most digital clocks use a seven-segment LED, VFD, or LCD display for each of four digits. They generally also include other elements to indicate whether the time is AM or PM, whether or not an alarm is set, and so on. 1.2 MOTIVATION The Digital clock project was born from a need to learn about micro controllers and PICs and their working. Therefore, the construction of a digital clock made it possible to learn all these.

1.3 AIMS AND OBJECTIVES The project was aimed at: Getting experience in the areas of working of PICs and microcontrollers. Gaining knowledge about basic digital systems. Learning about assembly language programming. Improving our knowledge of real time and simulated circuits.

1.4 METHODOLOGY At the heart of the clock there is a piece that can generate an accurate 60-hertz (Hz, oscillations per second) signal. There are two ways to generate this signal: 1. The signal can be extracted from the 60-Hz oscillations in a normal power line. Many clocks that get their power from a wall socket use this technique because it is cheap and easy. The 60-Hz signal on the power line is reasonably accurate for this purpose. 2. The signal can be generated using a crystal oscillator. Obviously, any battery-operated clock or wristwatch will use this technique instead. It takes more parts, but is generally much more accurate. To represent the time, most digital clocks use a seven-segment LED, VFD, or LCD display for each of four digits. They generally also include other elements to indicate whether the time is AM or PM, whether or not an alarm is set, and so on. Digital clocks that run on mains electricity and have no battery must be reset every time the power is cut off or if they are moved. Even if power is cut off for a second, most clocks will still have to be reset. This is a particular problem with alarm clocks that have no "battery" backup, because even a very brief power outage during the night usually results in the clock failing to trigger the alarm in the morning. To reduce the problem, many devices designed to operate on household electricity incorporate a battery backup to maintain the time during power outages and during times of disconnection from the power supply. More recently, some devices incorporate a method for automatically setting the time, such as using a broadcast radio time signal from an atomic clock, getting the time from an existing satellite television or computer connection, or by being set at the factory and then maintaining the time from then on with a quartz movement powered by an internal rechargeable battery.

CHAPTER 2
LITERATURE REVIEW 2.1 APPLICATIONS AND ADVANTAGES The major addition to our digital clock is present in the hexadecimal code. This code has been written not only to tell the time but also to display the room temperature and the date. It displays the temperature through the use of a DS18B20 IC that is technically a thermometer or a temperature sensor. Because digital clocks can be very small and inexpensive devices that enhance the popularity of product designs, they are often incorporated into all kinds of devices such as cars, radios, televisions, microwave ovens, standard ovens, computers and cell phones. Digital clocks are faster and have a high degree of accuracy and precision. 2.2 OPERATION OF CIRCUIT When you first power the device the clock is mentained for 8 seconds. Then the date for 2 seconds and temperature will be displayed for 3 seconds. The clock has four buttons, with one button you enter in set mode, with another button you increase values, the third button will be used to decrease values and you can put or not, the reset. If you don't want a reset button just connect the pin to +5V/+3V. You can change: * ho -> hour, from 0 to 23 * nn -> minutes, from 0 to 59 (I could not display m so I used n twice for it) * dn -> date month (JA FE |upperscore|A AP |upperscore|Y JU JL AU SE oc no dE or- 01 02 03 04 05 06 07 08 09 10 11 12, depending on dt setting) * dd -> date day, from 1 to days/month -> calculated based on month and year * dy -> date year, from 0 meaning 2000 to 99 meaning 2099 (not displayed in time/date mode but needed to calculate days per month) * dt -> date type can be 1 or 2, if date type equals 1 then letters are used for month, else numbers are used * tt -> time in seconds for showing time/clock, from 2 to 59, you cannot set

0 or 1 for this setting * td -> time in seconds for showing date, from 0 to 59, if 0 is used then the date is not shown * tE -> time in seconds for showing temperature, from 0 to 59, if 0 is used then the temperature is not shown * Sh -> calibrate the clock by adjusting second high (see below) * Sl -> calibrate the clock by adjusting second low (see below) When setting up the day for month take in consideration the month and year and days/that month in that year. You cannot set 31 day for February for example. The two middle points are not blinking when date/temperature are shown and also when set mode is on. If both td and tE are set to 0 then the time will be the only one displayed. In the case DS18S/B20 is missing you can set tE to 0. The clock has a battery backup and will work silently with power supply turned off. I didn't test the oscillator and if the clock loses precision in this situation. Settings Default settings are saved in EE chip internal memory. When you change hour/minutes/.. (h/m/dd/dm/dY/dt/tt/td/te/Sh/Sl) all of them will be saved. If power is off you will not have to change them again when powering the device back on. Clock calibration 1 (see also Calibration details.doc, maybe helps) The clock can be calibrated through software. This is useful if the clock lost or gain seconds during a period of time. This can happen for various reasons (crystal, capacitors, PIC?, temperature). The idea is to make the second last longer or less. One second lasts 1000000 microseconds. This is a big number for my display where I can write only 4 numbers, but.. if we represent this number in hexadecimal will have this value: 0F4240. Calibrations means adjusting around 1000000 so I dropped 0F, you cannot set that, but you can adjust 42(Sh) and 40(Sl) from 00 to FF. This gives you a large possibility to adjust your second. Adjusting examples: -> lost 30 seconds / 24 hours => 30/86400=0.000347 1000000-(1000000*0.000347)=999653(decimal)=F40E5(hexadecimal) => Set 40 for Sh and E5 for Sl. -> lost 2 seconds / 1 hour => 2/3600=0.000555 1000000-(1000000*0.000555)=999445(decimal)=F4015(hexadecimal) => Set 40 for Sh and 15 for Sl.

-> gain 15 seconds / 60 days => 15/5184000=0.000002 1000000+(1000000*0.000555)=1000002(decimal)=F4242(hexadecimal) => Set 42 for Sh and 42 for Sl. A longer the period of time being tested will have a better accuracy for the clock. Clock calibration Other way to calibrate the clock is adjusting Sh and mostly Sl like below. First you need to know two values: one that makes the clock run faster and one that makes the clock run slower. Let's say our two values are: 999840(clock runs faster=FAST) and 999884(clock runs slower=SLOW). Repeat changing the second length to (FAST+SLOW)/2 until FAST=SLOW(+/-1). This should make your clock very accurate.

CHAPTER 3
SYSTEM DESIGN 3.1 CIRCUIT DIAGRAM AND DESCRIPTION
U8
DS18B20 +5V

C1
1 2 30pF

27.0

D1
LED-GREEN
K E1 D1 C1 DP1 E2 D2 G2 F1 C2 DP2

X1
CRYSTAL 1

C2
2 30pF +5V

+5V

3 2 1

VCC DQ GND

E1 D1 C1 DP1 E2 D2 G2 F1 12

R5
4k7 17 18 1 2 3 6 7 8 9 10 11 12 13
2

2
3

U1:B
74HC04
5

U1:C
74HC04
13

U1:D
74HC04
2 1

U7
16 15 4 OSC1/CLKIN OSC2/CLKOUT MCLR RA0 RA1 RA2 RA3 RA4/T0CKI RB0/INT RB1 RB2 RB3 RB4 RB5 RB6 RB7 PIC16F84A

C2 DP2

U1:A
74HC04

R4
4k7
1

1 1 1 1 1 1 1 1

R8 R9 R10 220 R11 220 R12 4k7 R13 220 R14 220 R15 220
220 220

2 2 2 2 2 2 2 2
12 11 10 9 8 7 6 5 4 3 2 1

R1
4k7
1

J1
CONN-H12

R3
4k7

+5V

+5V

R2
4k7 VIN

R104
100k

+5V

TR1
1 3

BR1
VB V=8.95985 1

U2
7805 VI
GND

VO

+5V

+88.8 +88.8
AC Volts

+88.8
1
Volts

DF02M

2 TRAN-2P2S

4
2

C3
470uF
2

C5
0.1uF
2

AC Volts

C4
0.1uF

3.2 PROGRAM CODE :020000040000FA :10000000642B00340034FF3FC4000308C200A10881 :100010000319A003A10B1928A008031D19280F30EC :10002000A0002308A1002408A2070318A10A291C84 :1000300029170B1142088300C40E440E09001E0844 :100040009F000A30A8009F0B34281608A600BC2188 :1000500027089000250891001508A600BC21270854 :1000600092002508930008009F0B5C281708A60043 :10007000BC2127089000250891001808A600BC2183 :100080002708920025089300310B080018080F3E3E :10009000920018081B3E930008002D08A600BC2102

:1000A000080029122830920025089100080027082E :1000B00091002508920008009F0B7B280C309300CC :1000C000AD1F7128291629309000AD09AD0A4D20C9 :1000D0002708003C03195120291A572003309E009D :1000E0007A282D08A600BC21270890002508910039 :1000F0002830920008009F0B90281630B30018306B :10010000B400FF30B50076212A30900019309100FC :100110001608A600BC2127089200250893000800B5 :100120009F0BA5281530B3003C30B400FF30B5005C :1001300076212B3090002B3091001508A600BC21B1 :10014000270892002508930008009F0BC628183046 :10015000B3000D30B4000030B5007621A91DB228DF :10016000C02295212C3090002B3091001808A60059 :10017000BC212708920025089300310B08001808BD :100180000F3E920018081B3E930008009F0BDB28CF :100190001730B3001A08B4000030B50076212C30B7 :1001A00090002C3091001708A600BC21270892006F :1001B0002508930008009F0BF6281930B30064301F :1001C000B400FF30B5007621A91DEA28C022952190 :1001D0000A30A8002C3090002D3091001908A6009C :1001E000BC21270892002508930008009F0B0B29CB :1001F0003130B3000330B4000030B50076212C302C :1002000090002E3091003108A600BC2127089200F2 :100210002508930008009F0B20292E30B3003C30A6 :10022000B4000130B50076212E3090002E309100C0 :100230002E08A600BC21270892002508930008007C :100240009F0B35292F30B3003C30B400FF30B50090 :1002500076212E3090002C3091002F08A600BC2172 :10026000270892002508930008009F0B4A29303088 :10027000B3003C30B400FF30B50076212E30900042 :100280001D3091003008A600BC21270892002508E7 :10029000930008009F0B61292330B3000030B400A5 :1002A000FF30B5007621183090002A3091001030D0 :1002B000A8002308A600BC21270892002508930067 :1002C00008002430B3000030B400FF30B5007621C0 :1002D000183090002F3091001030A8002408A6009C :1002E000BC2127089200250893000800A9187B2943 :1002F00029198829080033088400800A000834027C :10030000031D08003308840035088000800A0800B7 :1003100033088400800300083502031D08003308F9 :10032000840034088000800308001A08A500A50393 :100330002508170203190800A50B98299F291A08F8

:10034000A500A503250897000800831289008316DD :1003500008148312080883120800831608158B13EB :100360008B1BAF2955308900AA308900881483126D :10037000081208118B170800A501A7010830BF005B :10038000A60DA50D280825020318A500A70DBF0B73 :10039000C0290800371005180800371486018501A8 :1003A00008001E30850037180800831606178615CA :1003B000061583120301013E8522061FF5211F2227 :1003C00016228316061386110611831208003718A9 :1003D0000800422B0800371808004B2B0800291092 :1003E00001309E002E089B0008009D08031D080098 :1003F0002918FE2903309E00940129149E0A3030EA :100400009D001E080F3C031D082AEF2188239B2313 :100410001F207F2208009D08031D0800291C0800DA :100420000619132A202A86190800172A0B2AA9144C :10043000A91530309D001F20A910A91108000B2A12 :100440002915A91530309D001F202911A911080078 :10045000B20138081B3C0319312A9C193214312A85 :10046000282A1E3085003908A521321C1C0686006A :10047000380885000430BF00FF308522BF0B3C2ABE :100480009D080319442A9D030800371808009008A6 :1004900003194F2A1008B9001D30B8003022110886 :1004A000B9001B30B80030221208B9001730B8006C :1004B00030221308B9000F30B80030220800291389 :1004C000940A14083C3C03198C229B0B7D2A9E0A3B :1004D0001E08043C0319EF211E032E3E8400000871 :1004E0009B009B080319672A1E08013C0319E7219A :1004F0001E08033C0319EB211F207F22C52B1E0B76 :10050000832A8922842A9C010800FF3E031D852A34 :10051000080008309C0608009401950A15083C3C28 :1005200003199B221608183C03199E2218080D3C3B :100530000319A9221F289501960A08009601970A17 :100540001A081702031D080001309700980AC022FC :10055000080001309800990AC02208001D309A0056 :100560000430A8001908A600BC212508003C031986 :10057000BD2208001F309A0008001E309A000800B3 :1005800020309A001808043C0319BA221808063CC7 :100590000319BA221808093C0319BA2218080B3C9F :1005A0000319BA221808023C0319AE220800831668 :1005B0000514831208008316051083120800DB223D :1005C00005100301AB3E8522D7220301033E85229D :1005D0000800BF010301103E8522051C3F140301E2

:1005E000613E85220800811F0800011F0800811E4E :1005F0000800811F0800F92AF322DB220510000001 :100600000000000000000000D72203010F3E8522F9 :100610001B2BDB22051003010E3E8522D722000092 :10062000000000000000000000001B2B0830BF008D :100630002B1C092BFC2AAB0C031CAB13BF0B182B78 :1006400008000830BF00F32283160510831205103E :100650000000000000008316051483120000000053 :1006600000000000051C362BAB17372BAB13030122 :100670000F3E85223F0B3D2B0800AB0C031CAB1338 :10068000BF03232BDF22E922CC30AB0016234430FA :10069000AB001623EA29AD01DF22E9223F1CEE2937 :1006A000CC30AB001623BE30AB00162321232B0821 :1006B000AC0021232B08AD00DF22AC0CAC172D1EA3 :1006C000AC132C08AD00EE29883083168100831608 :1006D0008601013085008312860185018030A900E2 :1006E00094019C0130309D0088238F23C0222E0866 :1006F0009B0001309E001F20CA21E721A0308B0003 :100700000F30A0002308A100A10A2408A200C22BD8 :100710000B30BF003A30B60003308A0008003608BC :10072000A521B3003F08B123840033088000B6033D :10073000BF0B8F2B08003F08B123BE23360883125E :1007400089008312330883128800AD211F30AA006C :100750000301FF3E8522AA0BA82BB603BF0B9B2BE0 :10076000080082070034163415341734183419344D :1007700031342E342F3430342334243484000008B0 :10078000B3000800CA21291B5F2AD1214522C22BB0 :10079000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F69 :1007A000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F59 :1007B000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F49 :1007C000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F39 :1007D000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F29 :1007E000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F19 :1007F000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F09 :104200001800DB00A800C8004B004C000C00D900CF :104210000800480009000E003C008A002C002D0018 :1042200098002D0019000900190098009800090055 :104230004C008E008F008A0009002C000900290024 :104240004A001A003E001A002C00AE008E002C001E :104250006900EF000F008F008A004A002E003F0027 :104260000E002E00190002000B00010008000200E1 :10427000030042004000FF00FF00FF00FF00FF00BE

:02400E00F13F80 :08400000FF3FFF3FFF3FFF3FC0 :00000001FF 3.3 BILL OF ENGINEERING MEASUREMENT AND EVALUATION COMPONENTS 12 Pin Connector CONN H12 Bridge Rectifier 30pF Capacitors 470uF Capacitor 0.1uF Capacitors Green LED 4K7 ohms Resistor 220 ohms Resistor 100K ohms Resistor 220V Transformer IC 74HC04 inverter IC 7805 PIC 16F628A IC DS18B20 Thermometer Crystal Oscillator Buttons QUANTITY COST PER UNIT TOTAL COST

3.4 CIRCUIT DIAGRAM FOR POWER SUPPLY

CHAPTER 4
TESTING AND IMPLEMENTATION 4.1 PICTORIAL DIAGRAMS 4.2 CHALLENGES Time constraints. Conversion from simulated to real time systems. Challenges with team work. Financial constraints. Component malfunctions.

CHAPTER 5
CONCLUSION 5.1 CONCLUSION Clocks and Watches are basically devices used to measure or indicate the passage of time. A clock, which is larger than a watch, is usually intended to be kept in one place; a watch is designed to be carried or worn. Both types of timepieces require a source of power and a means of transmitting and controlling it, as well as indicators to register the lapse of time units. If we happen to take our bedside clock or watch apart, one thing we will notice is that there are probably not 15 TTL ICs inside. In fact, we may not be able to find a chip at all. In most modern clocks and watches, all of the functions of the clock (including the alarm and any other features) are all integrated into one low-power chip (in a watch, the chip and display together consume only about a millionth of a watt). That chip is probably embedded directly into the circuit board. We might be able to see a blob of black plastic protecting this chip. That one tiny chip is an integrated circuit with programs written into it for it to perform a function, hence Programmable Integrated Circuits (PICs).

REFERENCES
www.wikipedia.com, Digital Clock. How Stuffs Work-Digital Clock.

Vous aimerez peut-être aussi