Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 39

Chapter 01

Introduction

9
1.1 Introduction

A digital clock is no different than an analog clock. It simply handles the timing functions
electronically rather than mechanically. A digital clock is a type of clock that displays the
time digitally, i.e. in the LCD, LED or Seven Segment display, as opposed to an analog
clock, where the time is displayed by hands. Electronic clocks have predominately
replaced the mechanical clocks as they are much reliable, accurate, maintenance free,
portable and cost effective. In this project work a multipurpose digital clock is developed
which not only shows the time operations but also indicates the room temperature. The
whole controlling operation is maintained by a PIC microcontroller 16F877A which not
only communicates with a Real Time Clock IC but also calculates the whole time
functions and displays it with Seven Segment and LCD displays. Another Arduino is used
to enhance the number of ports and synchronizes with main controller IC to display the
days in the LED. A real-time clock (RTC) is used to keep track of the current time.
Although the term often refers to the devices in personal computers, servers and embedded
systems, RTCs are present in almost any electronic device which needs to keep accurate
time for precise work to be maintained. A digital clock displays the time using numbers
and it has many applications like cars, railway stations, houses, offices, etc. in order to
provide accurate time and date. In this type of applications, normally we use RTC (Real
Time Clock) ICs to display the time and date accurately. The circuit displays the time on
LCD. For this clock, we can set the time at any instant. Here, the clock can work in either
24 hour mode or 12 hour mode and the RTC chip is configured by programming
Arduinocontroller. I will demonstrate two circuits of Digital Clocks using Arduino
Microcontroller: one uses the RTC DS12C887 and the other uses the RTC DS1307.Now-
a-days people prefer digital clocks more than an analog clock because of their elegant
outlook, inexpensiveness, small size and accuracy. As a result many smart digital clocks
are manufactured by different popular companies. Because of its low price and tiny size, it
is often incorporated into all kinds of devices such as cars, radios, televisions, microwave
ovens, standard ovens, computers and cell phones to enhance the quality of that device. In
this particular project, design of a smart multipurpose clock is provided. This clock is
designed with two PIC microcontrollers and a Real Time Clock (RTC) IC. The display
section is designed with Seven Segment display and LED. A temperature sensor is also
integrated with the system to show the current temperature in LCD Display.

10
1.2 Historical Background

The first digital pocket watch was the invention of Austrian engineer Josef Pall Weber
who created his "jump-hour" mechanism in 1883. Instead of a conventional dial, the jump-
hour featured two windows in an enamel dial, through which the hours and minutes are
visible on rotating discs. The second hand remained conventional. By 1885 Pall Weber
mechanism was already on the market in pocket watches by Carteret and IWC; arguably
contributing to the subsequent rise and commercial success of IWC. The principles of
Pallweber jump-hour movement had appeared in wristwatches by the 1920s (Carteret) and
are still used today (Chronoswiss Digester). While the original inventor didn't have a
watch brand at the time, his name has since been resurrected by a newly established watch
manufacturer.[1]

Plato clocks used a similar idea but a different layout. These spring-wound pieces
consisted of a glass cylinder with a column inside, affixed to which were small digital
cards with numbers printed on them, which flipped as time passed. The Plato clocks were
introduced at the St. Louis World Fair in 1904, produced by Ansonia Clock Company.
Eugene Fitch of New York patented the clock design in 1903. 13 years earlier Josef
Pallweber had patented the same invention using digital cards (different from his 1885
patent using moving disks) in Germany (DRP No. 54093). [3] The German
factory AktiengesellschaftfürUhrenfabrikationLenzkirch made such digital clocks in 1893
and 1894.The earliest patent for a digital alarm clock was registered by D.E Protzmann
and others on October 23, 1956, in the United States. Protzmann and his associates also
patented another digital clock in 1970, which was said to use a minimal amount of moving
parts. Two side-plates held digital numerals between them, while an electric motor and
cam gear outside controlled movement.

In 1970, the first digital wristwatch with an LED display was mass-produced. Called the
Pulsar, and produced by the Hamilton Watch Company, this watch was hinted at two years
prior when the same company created a prototype digital watch for Kubrick's 2001: A
Space Odyssey.[5] Throughout the 1970s, despite the initial hefty cost of digital watches,
the popularity of said devices steadily rose. Over the years, many different types of digital
alarm clocks have been developed.

11
1.3 Objectives

The main objective of the digital clock is to display the time digitally using LCD display.
The main objective is -
 To Study of Microcontroller System .
 To Design Construct & Implement of Digital Clock System .

1.4 Summary

An overall block representation of the proposed smart multi-purpose clock system.In this
system a main controller ArduinoNano is used to synchronize the operation of a RTC IC
DS3231 and LCD Display. The time and date are displayed by LCD whether the day and
AM/PM operations are displayed with LCD. There is an additional option in this clock. It
also displays the temperature in LCD display.

12
Chapter 02
Design and Construction

13
2.1 Block Diagram

The below picture describes the block diagram of our main project. We take the 220V AC
power supply from the main line and then using the SMPS convert it to DC for our use.
Then the DC output is fed into the Arduino Nano microcontroller. The Arduino Nano
microcontroller receives data from the Temperature Sensor and Clock Module and then
processes those information accordingly as it was programmed and finally shows the
processed information using the Display module.

Fig 2.1.1: Block Diagram of Digital Clock System

14
2.2 Circuit Diagram

Fig 2.2.1: Circuit Diagram of Digital Clock System

2.3 Circuit Description

In this project we used an ArduinoNano as a main brain of the project. The circuit shows
you how interface RTC Module DS3231Modular. Arduino digital pin is used as a data
port of Real time clock.  Some Arduino output pin is connected to the data pins of LCD
Display Module, here we used a temperature sensor which real time temperature output
showing inLCD Display Module.For power supply to whole system we used a SMPS
which converter AC voltage to DC 5 voltage Output.

15
Chapter 03
Components Description

16
3.1 Arduino Nano
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use
hardware and software. It's intended for artists, designers, hobbyists and anyone interested in
creating interactive objects or environments. Arduino can sense the environment by
receiving input from a variety of sensors and can affect its surroundings by controlling lights,
motors, and other actuators.

Fig 3.1.1:Arduino Nano

The microcontroller on the board is programmed using the Arduino programming language
(based on Wiring) and the Arduino development environment (based on Processing).
Arduino projects can be stand-alone or they can communicate with software on running on a
computer (e.g. Flash, Processing, MaxMSP).

Arduino Nano is a surface mount breadboard embedded version with integrated USB. It is a
smallest, complete, and breadboard friendly. It has everything that Diecimila/Duemilanove
has (electrically) with more analog input pins and onboard +5V AREF jumper. Physically, it
is missing power jack. The Nano is automatically sense and switch to the higher potential
source of power.

17
Fig 3.1.2:ArduinoSchematic Diagram

Nano’s got the breadboard ability of the Boarduino and the Mini+USB with smaller footprint
than either, so users have more breadboard space. It’s got a pin layout that works well with
the Mini or the Basic Stamp (TX, RX, ATN, GND on one top, power and ground on the
other). This new version 3.0 comes with ATMEGA328 which offer more programming and
data memory space. It is two layers. That make it easier to hack and more affordable.

Fig 3.1.3: Section of Arduino Nano

Specifications: 

18
Microcontroller: Atmel ATmega328
Operating Voltage (logic level):5 V
Input Voltage (recommended):7-12 V
Input Voltage (limits):6-20 V
Digital I/O Pins: 14 (of which 6 provide PWM output)
Analog Input Pins: 8
DC Current per I/O Pin: 40 mA
Flash Memory: 32 KB (of which 2KB used by boot loader)
SRAM : 2 KB
EEPROM: 1 KB
Clock Speed: 16 MHz
Dimensions: 0.70” x 1.70”
Features:
• Automatic reset during program download
• Power OK blue LED
• Green (TX), red (RX) and orange (L) LED
• Auto sensing/switching power input
• Small mini-B USB for programming and serial monitor
• ICSP header for direct program download
• Standard 0.1 spacing DIP (Breadboard friendly)
• Manual reset switch

Microcontroller IC ATmega328P:

Fig3.1.4: Microcontroller IC ATmega 328P

The high-performance Microchip picoPower 8-bit AVR RISC-based microcontroller


combines 32KB ISP flash memory with read-while-write capabilities, 1024B EEPROM,

19
2KB SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three
flexible timer/counters with compare modes, internal and external interrupts, serial
programmable USART, a byte-oriented 2-wire serial interface, SPI serial port, a 6-channel
10-bit A/D converter (8-channels in TQFP and QFN/MLF packages), programmable
watchdog timer with internal oscillator, and five software selectable power saving modes.
The device operates between 1.8-5.5 volts. By executing powerful instructions in a single
clock cycle, the device achieves throughputs approaching 1 MIPS per MHz balancing power
consumption and processing speed.

3.2 20*4 LCD Display Module

The LCD stands for liquid crystal display, that works on the light modulation features of
liquid crystals. It is available in electronic visible display, video display and flat panel
display. There are numerous categories and features are exits in markets of LCD and you
can see it on your mobile, laptop, computer and television screen.The invention of LCD
gives new life to electronic industries and replaces lED and gas plasma techniques. It also
replaces the CTR (cathode ray) tube that used for visual display. The input power
consumed by the liquid crystal display is less then light-emitting diode and plasma
display. In today's post, we will have look at 20 x 4 LCD, its features, working,
applications, and practical implementation in different electronic devices.

Fig3.2.1 :20*4 LCD Display

 In a 20x4 LCD module, there are four rows in display and in one row twenty
character can be displayed and in one display eighty characters can be shown.

20
 This liquid crystal module uses HDD44780 (It is a controller used to
display monochrome text displays) parallel interfacing.
 The liquid crystal display interfacing code is easily accessible. We just required
eleven input and output pinouts for the interfacing of the LCD screen.
 The input supply for this module is three volts or five volts, with that module
other components like PIC, Raspberry PI, Arduino.
 This electronic device can be used in different embedded systems, industries,
medical devices, and portable devices like mobile, watches, laptops.
 Liquid crystal display works on two types of the signal first one is data and the
second one is for control.
 The existence of these signals can be identified through the on and off
condition of RS pinout. Data can be read by pushing the Read/write pinout.

20x4 LCD Pinout

Pin No: Pin Name: Parameters

It is ground pinout potential at this


Pin#1 It denoted as Vss
pinout is zero.
Pin#2 It denoted as Vdd At this pinout, five volts are provided.
This pinout is used to set the contrast of
Pin#3 This pinout denoted as Vo
the screen.
Pin#4 This pin denoted as RS It used to H/L register select signal.
Pin#5 It denoted as R/W It used for H/L read/write signal.
Pin#6 This pinout denoted as E It used for H/L enable signal.
The pinouts from seven to fourteen It used for H/L data bus for 4 bit or 8-
Pin#7-14
denoted as DB0 – DB7. bit mode.
Pin#15 It identified as A (LED+) It used to set backlight anode.
Pin#16 It recognized as K (LED-). It used to set backlight cathode.

21
Fig3.2.2 :Pin Out of 20*4 LCD

Features of 20 x 4 LCD:

 These are some features of 20 x 4 LCD modules that are described here with
the detailed.
 The most important feature of this module is that it can display 80 characters at
a time.
 The cursor of this module has 5x8 (40) dots.
 On this module already assembled the controller of RW1063.
 This module operates on the plus five volts input supply and can also work on
the plus three volts.
 The plus three volts pinout can also be used for the negative supply.
 The duty cycle of this module is one by sixteen (1/16).
 The light-emitting diode of this module can get supply from the pinout one,
pinout two, pinout fifteen, pinout sixteen, or pinout A and K.

Electrical Characteristics of 20 x 4 LCD

 These are some pinouts of 20 x 4 LCD modules that are described here with the
detailed.

22
Parameters  Symbol                    Conditions
It denoted as
Input Voltage The value of VDD is plus five volts.
VDD
It denoted as
Supply Current Its value is ten miliamperes.
IDD
LC Driving Voltage for Normal Its symbol is
Its value is 5.2 volts
Temperature Version Module VDD to V0.
It is denoted as
LED Forward Voltage Its value is 4.3V
VF.
LED Forward Current It denoted as IF. Its value is 4.6V.
This pinout VEL = 110 VAC, and four hundred
EL Supply Current
denoted as EL frequency.

Absolute Maximum Ratings

 Now we discuss the maximum ratings of 20 x 4 LCD.

Parameters Symbol Conditions


It denoted as
Working temperature Its value is zero to a plus fifty-celsius degree.
Top
It denoted as Its value minus twenty Celsius to plus seventy
Storage Temperature
Tst. celsius.
It denoted as Its minimum value Vss and the maximum value
Supply Voltage for Logic
Vi. is equal to Vdd volts.
Supply Voltage for liquid It denoted as
Its value is three volts to thirteen volts.
crystal display Vdd or Vss.

Advantages of 20 x 4 LCD

 These are some advantages of this module that are described with the detailed.
 It is less expensive, lightweight as compared to the cathode ray tube display.
 It uses less power according to the brightness resolution.
 It produces less amount of heat due to less use of power.
 In this module, there is no. geometric distortion.
 It can be constructed in any shape and size according to user requirements.
 The LCD used in the computer monitor uses twelve volts.

23
Disadvantages of 20×4 LCD

 With the advantage of this module, there are some problems created by this
module that is described here.
 In some older LCD modules, there are some issues due to view angle and
brightness.
 It losses brightness and operates at less response time with the increment of
temperature.
 With the increment of the surrounding temperature, its contrast also disturbs.

3.3 Clock Module :


The DS3231 is a low-cost, extremely accurate I2C real-time clock (RTC) with an
integrated temperature compensated crystal oscillator (TCXO) and crystal. The device
incorporates a battery input, and maintains accurate timekeeping when main power to the
device is interrupted. The integration of the crystal resonator enhances the long-term
accuracy of the device as well as reduces the piece-part count in a manufacturing line. The
DS3231 is available in commercial and industrial temperature ranges, and is offered in a
16-pin, 300-mil SO package. The RTC maintains seconds, minutes, hours, day, date,
month, and year information. The date at the end of the month is automatically adjusted
for months with fewer than 31 days, including corrections for leap year. The clock
operates in either the 24-hour or 12-hour format with an AM/PM indicator. Two
programmable time-of-day alarms and a programmable square-wave output are provided.
Address and data are transferred serially through an I2C bidirectional bus. A precision
temperature-compensated voltage reference and comparator circuit monitors the status of
VCC to detect power failures, to provide a reset output, and to automatically switch to the
backup supply when necessary. Additionally, the RST pin is monitored as a pushbutton
input for generating a μP reset.

24
Fig 3.3.1: Clock Module DS3231

The DS3231 is a low-cost, highly accurate Real Time Clock which can maintain hours,
minutes and seconds, as well as, day, month and year information. Also, it has automatic
compensation for leap-years and for months with fewer than 31 days. The module can
work on either 3.3 or 5 V which makes it suitable for many development platforms or
microcontrollers. The battery input is 3V and a typical CR2032 3V battery can power the
module and maintain the information for more than a year.

Fig 3.3.2: Clock Module DS3231 connection with Arduino.

The module uses the I2C Communication Protocol which makes the connection to the
Arduino Board very easy .
 Benefits and Features

25
Highly Accurate RTC Completely Manages All Timekeeping Functions
 Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month,
Day of the
 Week, and Year, with Leap-Year Compensation Valid Up to 2100
 Accuracy ±2ppm from 0°C to +40°C
 Accuracy ±3.5ppm from -40°C to +85°C
 Digital Temp Sensor Output: ±3°C Accuracy
 Register for Aging Trim
 RST Output/Pushbutton Reset Debounce Input
 Two Time-of-Day Alarms
 Programmable Square-Wave Output Signal

 Simple Serial Interface Connects to Most Microcontrollers


 Fast (400kHz) I2C Interface

 Battery-Backup Input for Continuous Timekeeping


 Low Power Operation Extends Battery-Backup Run Time
 3.3V Operation
 Operating Temperature Ranges: Commercial (0°C to +70°C) and Industrial (-
40°C to +85°C)
 Underwriters Laboratories® (UL) Recognized.
 Applications :
 Servers
 Telematics
 Utility Power Meters
 GPS

3.4 SMPS
A switched-mode power supply (switching-mode power supply, switch-mode power
supply, switched power supply, SMPS, or switcher) is an electronic power supply that
incorporates a switching regulator to convert electrical power efficiently. Like other power
supplies, an SMPS transfers power from a DC or AC source (often mains power) to DC

26
loads, such as a personal computer, while converting voltage and current characteristics.
Unlike a linear power supply, the pass transistor of a switching-mode supply continually
switches between low-dissipation, full-on and full-off states, and spends very little time in
the high dissipation transitions, which minimizes wasted energy. A hypothetical ideal
switched-mode power supply dissipates no power. Voltage regulation is achieved by
varying the ratio of on-to-off time (also known as duty cycles). In contrast, a linear power
supply regulates the output voltage by continually dissipating power in the pass transistor.
This higher power conversion efficiency is an important advantage of a switched-mode
power supply. Switched-mode power supplies may also be substantially smaller and
lighter than a linear supply due to the smaller transformer size and weight.Switching
regulators are used as replacements for linear regulators when higher efficiency, smaller
size or lighter weight are required. They are, however, more complicated; their switching
currents can cause electrical noise problems if not carefully suppressed, and simple
designs may have a poor power factor.

Fig3.4.1: Switch mode power supply

This is the switching power supply circuit diagram with 50W power output with a 5V
voltage 10A current. It is a flyback converter operating in the continuous mode. The
circuit features a primary side and secondary side controller will full-protection from fault
conditions such as overcurrent.After the fault condition has been removed, the power
supply will enter the soft-start cycle before recommencing normal operation. Please be

27
careful if you decide to build this circuit since in this circuit, there is a home electrical
connection. Safety rules must be followed during circuit testing.

Fig 3.4.2: Switch mode power supply schematic diagram

Power supply is an electronic device that supplies electric energy to an electrical load. The
primary function of a power supply is to convert one form of electrical energy to another
and, as a result, power supplies are sometimes referred to as electric power converters.
Some power supplies are discrete, stand-alone devices, whereas others are built into larger
devices along with their loads. Examples of the latter include power supplies found in
desktop computers and consumer electronics devices.

A 25W 5.0V/5.0A Highly Reliable, Universal AC input/full range single output power
supply. They have the approval of UL and CE and come 100% full load burn-in tested and
are protected with overload/over and voltage/short circuit.
A switched-mode power supply (SMPS) is an electronic circuit that converts power using
switching devices that are turned on and off at high frequencies, and storage components
such as inductors or capacitors to supply power when the switching device is in its non-
conduction state.

28
Switching power supplies have high efficiency and are widely used in a variety of
electronic equipment, including computers and other sensitive equipment requiring stable
and efficient power supply.

A switched-mode power supply is also known as a switch-mode power supply or


switching-mode power supply.
Switched-mode power supplies are classified according to the type of input and output
voltages. The four major categories are:

 AC to DC
 DC to DC
 DC to AC
 AC to AC
A basic isolated AC to DC switched-mode power supply consists of:

 Input rectifier and filter


 Inverter consisting of switching devices such as MOSFETs
 Transformer
 Output rectifier and filter
 Feedback and control circuit

The input DC supply from a rectifier or battery is fed to the inverter where it is turned on
and off at high frequencies of between 20 KHz and 200 KHz by the switching MOSFET
or power transistors. The high-frequency voltage pulses from the inverter are fed to the
transformer primary winding, and the secondary AC output is rectified and smoothed to
produce the required DC voltages. A feedback circuit monitors the output voltage and
instructs the control circuit to adjust the duty cycle to maintain the output at the desired
level.
There are different circuit configurations known as topologies, each having unique
characteristics, advantages and modes of operation, which determines how the input power
is transferred to the output.

Most of the commonly used topologies such as flyback, push-pull, half bridge and full
bridge, consist of a transformer to provide isolation, voltage scaling, and multiple output

29
voltages. The non-isolated configurations do not have a transformer and the power
conversion is provided by the inductive energy transfer.
Advantages of switched-mode power supplies:

 Higher efficiency of 68% to 90%


 Regulated and reliable outputs regardless of variations in input supply voltage
 Small size and lighter
 Flexible technology
 High power density

Disadvantages:

 Generates electromagnetic interference


 Complex circuit design
 Expensive compared to linear supplies

Switched-mode power supplies are used to power a wide variety of equipment such as
computers, sensitive electronics, battery-operated devices and other equipment requiring
high efficiency.

Specifications:
 Brand: PowerSupply1
 Complies with RoHS Directive
 AC Input Voltage Range: 85-264VAC (120-370VDC)
 Input Frequency: 47-63Hz
 Inrush Current: Cold Start, 20A/115V, 40A/230V
 Input Leakage Current: <0.7mA/230V
 Line Regulation (Full Load): <± 0.5%
 Output Voltage Adj. Range: ± 10%
 Output Overload Protection: 110-150%
 Output Over Voltage Protection: 115-150%
 Withstand Voltage: I/P-O/P: 3.0KVAC/1min; I/P-F/G: 1.5KVAC/1min; O/P-F/G:
0.5KVAC/1min
 Rise Time: 50ms@full load (typical)

30
 Hold Up Time: 20ms@full load (typical)
 Operating temp.& humidity: -10°C to 50°C (14°F - 122°F), 20%-93%RH (non-
condensing)
 Storage temp.& humidity: -20°C to 85°C (-4°F - 185°F), 20%-93%RH (non-
condensing)
 UL Ref. Number: E258719
 Safety Standards: GB4943, UL80950, EN60950
 EMC Standards: GB9254, EN55022 classB, EN55024, EN61000-3-2,3, EN61000-
4-2,3,4,5,6,8,11
 Cooling Method: Convection

31
Chapter 04
Result and Implementation

4.1 Implementation
The below picture shows how we have implemented our project in reality.

32
Fig 4.1.1: Practical Implementation

The whole system consists of 5 major parts and they are:


1. SMPS,
2. Arduino Nano,
3. Clock Module,
4. Temperature Module,
5. 20*4 LCD Display Module.

We have used the SMPS (Switch Mode Power Supply) for two different reasons.
Firstly, it’s going to convert the alternating current to direct current for our use and from
here we can also guess that the SMPS has circuit components like step down transformer,
diodes, capacitors that make the conversion happen. Secondly, it has voltage regulators to
output regulated voltages of different desired values for us to use, like the Arduino Nano
needs 5V.
Then let’s talk about the Arduino Nano microcontroller, the information processing brain
of our whole system. Different modules such as the Temperature Module, Clock Module

33
and Seven Segment Display Module all are connected to this little microcontroller. The
Arduino Nano gathers information from all of these modules and executes tasks in planned
way meaning the way it was programmed.
Normally, the supply current can run the system but we have placed the Clock Module for
backup purposes, for information storage purposes and most importantly to send the
Arduino necessary information so that the microcontroller can calculate time.
The Temperature Module is also there to collect data from the environment and send that
to the Arduino Nano so that our microcontroller can calculate the environment’s
temperature effectively.
Lastly, all of the information are shown using the Seven Segment Display Module so that
we can see the time and the temperature from the display module. Without the display
module it would not have been possible to give meaning to all the information we gathered
and calculated.

4.2 Result
Our main goal was to calculate time and temperature and then showing it digitally. And
we have been able to accomplish that.

Fig 4.2.1: Digital Time and Temperature In LCD Display.

If we concentrate on the above two pictures, we can see our final output of the
project. The left picture is displaying time digitally using the Seven Segment Display
Module and the picture on the right is showing temperature. The Seven Segment Display
Module displays time and temperature simultaneously one after the other. No project is

34
without some limitations and ours have some as well. As you can from the display board
that the Seven Segment Display Module has 4 individual Seven Segment units mounted
together in the module. So we can show only four characters in total using the module.
That’s why we can’t show the decimal values for the temperature and can’t show
AM=Ante meridiem, PM = Post meridiem for the time. Still our results are satisfactory
enough to validate our project.

35
Chapter 05
Discussion and Conclusion

5.1 Discussion

36
Different pattern of digital clocks are available in market. Most of them are of very
high price and low quality. Many of those cannot provide the time accurately for
longer period as those are designed with timer IC’s like 555 timer. Again some
digital clocks loss their data whenever the power supply shuts down. But our designed
multipurpose digital clock is accurate because of its Real Time Clock module that keeps
track of the system time and update. The DS3231 has a built-in power sense circuit that
detects power failures and automatically switches to the 3V Li Cell battery supply which
is incorporated with the RTC. Most of the digital clock in the market does not cover all the
time functions whether our designed digital clock covers all the time options and we
will also incorporate the alarm option in next version. However, the Temperature
displaying is an additional feature of our smart digital clock. It is possible to develop this
system in future added more sensor. So this version of digital clock is really a
cheap, precise and well featured device for the present market.

5.2 Limitations

 In this project we cannot set time & date.Setting the time and date will require us
to re-coding.

5.3 Future works

In future development can be more developed in this project such as.


 Buttons can be arranged to set the time and date in the future.
 In future can be added more sensor in this project such as PIR motion sensor.

5.4 Conclusion
In this paper, the design of a digital thermometer with clock is presented.The result of this
work is a functional prototype of smart digital clock on the Arduino platform, which is
able to detect temperature & showing time and date. Testing and comparing the smart
clock with the commercial solution in the form of Android application Sleep Cycle alarm
clock for Android showed that this application and especially the proposed algorithm is
able to successfully detect the temperature & showing Time, date at the real time.The
design and implementation of a digital thermometer with clock, which is the focus of this

37
project, was achieved. The digital thermometer was designed in such a way that it can
monitor temperature without contact, while also checking the time at which the
measurement is made. The design allows dynamic application of the digital thermometer
in any fieldwhere temperature is being measured.

REFERENCES

[1] Botía JA., CharitosD., A DIY approach to the Internet of Things: A Smart Alarm

38
Clock. In: 9th International Conference on Intelligent Environments. pp. 214-
221, IOS Press, 2013.

[2] Polysomnography. [online]. [Accessed 17December 2015]. Available from:


http://www.nlm.nih.gov/medlineplus/ency/article/003932.htm

[3] Maquet, P., et al. Functional neuroanatomy of human rapid-eye-movement


sleep and dreaming. Nature, 1996, Vol 383 Issue 6596, pp. 163-166.

[4] Cimler, R., Matyska, J., Sobeslav, V., Cloud based solution for mobile
healthcare application. In Proceedings of the 18th International Database
Engineering & Applications
Symposium (pp. 298-301). ACM. (2014, July)

[5] Krejcar O., Jirka J., Janckulik D., Use of Mobile Phones as Intelligent Sensors for
Sound Input Analysis and Sleep State Detection. Sensors. 2011, vol. 11, No. 6,
pp. 6037–6055, DOI 10.3390/s110606037

[6] Smart Alarm for Android. [online]. [Accessed 16December 2015]. Available
from: http://sport.com/smart_alarm_android.html

[7] S.M.A.R.T AlarmClock. [online]. [Accessed 16December 2015]. Available from:


http://makezine.com/projects/s-m-a-r-t-alarm-clock/

[8] Crick, F., MitchinsonG., The function of dream sleep. Nature, 1983, 304.5922:
111-114

[9] How digital clock works (online).


Available:http://electronics.howstuffworks.com/gadgets/clockswatches/digital-
clock1.htm

[10] Pan Thu Tun, “Development and Implementation of Microcontroller-based


Digital Clock”, World Academy of Science Engineering and Technology 42
2008, pp: 362- 365.

[11] Sagar. G. Yadav, K. A. Narayanankutty, “A Versatile Industrial Timer and Real


Time Keeper”, Wireless Engineering and Technology, 2011, 2, 196-203.

[12] https://circuitdigest.com/microcontroller-projects/arduino-7-segment-display-
clock

Appendix

39
Code:
// Include the libraries:
#include <Wire.h>
#include <RTClib.h>
#include <TM1637Display.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>

// Define the connections pins:


#define CLK 2
#define DIO 3
//#define CLK1 4
//#define DIO1 5
#define DHTPIN 6
inthr,displaytime;
// Creatertc and display object:
RTC_DS3231 rtc;
TM1637Display display = TM1637Display(CLK, DIO);
inttemperature_celsius;
inttemperature_fahrenheit;

const uint8_t celsius[] = {


SEG_A | SEG_B | SEG_F | SEG_G, // Circle
SEG_A | SEG_D | SEG_E | SEG_F // C
};

const uint8_t fahrenheit[] = {


SEG_A | SEG_B | SEG_F | SEG_G, // Circle
SEG_A | SEG_E | SEG_F | SEG_G // F
};
#define DHTTYPE DHT11 // DHT 11

//TM1637Display display1 = TM1637Display(CLK1, DIO1);


DHT dht = DHT(DHTPIN, DHTTYPE);

void setup() {
// Begin serial communication at a baud rate of 9600:
Serial.begin(9600);

40
// Wait for console opening:
delay(1000);

// Check if RTC is connected correctly:


if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
// Check if the RTC lost power and if so, set the time:
if (rtc.lostPower()) {
Serial.println("RTC lost power, lets set the time!");
// The following line sets the RTC to the date & time this sketch was compiled:
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
rtc.adjust(DateTime(2020, 6, 23, 3, 0, 0));
}

// Set the display brightness (0-7):


display.setBrightness(7);
// Clear the display:
display.clear();
// display1.setBrightness(5);
// display1.clear();
dht.begin();
//delay(1000);
}

void loop() {
temperature_celsius = dht.readTemperature();
// temperature_fahrenheit = dht.readTemperature(true);
// Print the temperature to the Serial Monitor:
Serial.println(temperature_celsius);
// Serial.println(temperature_fahrenheit);

// Show the temperature on the TM1637 display:


display.showNumberDec(temperature_celsius, false, 2, 0);
display.setSegments(celsius, 2, 2);

delay(1000);

41
//display.showNumberDec(temperature_fahrenheit, false, 2, 0);
// display.setSegments(fahrenheit, 2, 2);

// delay(1000);

// Get current date and time:


DateTime update = rtc.now();

if (update.hour()>12)
{
hr=update.hour()-12;
}
else
{
hr=update.hour();

}
displaytime = hr *100 + update.minute();
display.showNumberDecEx(displaytime,0x59>>1,true);
delay(500);
display.showNumberDec(displaytime,true);
delay(500);

Serial.print(hr);
Serial.print(':');
Serial.print(update.minute());
Serial.print(':');
Serial.print(update.second());
Serial.println();

The result of this work is a


functional prototype of smart alarm
clock on the Arduino

42
platform, which is able to detect
almost awake moment during
sleep. Testing and
comparing the smart alarm with
the commercial solution in the
form of Android
application Sleep Cycle alarm
clock for Android showed that
this application and
especially the proposed algorithm is
able to successfully detect the
moment at the same
time, maximum in the range of a
few seconds from the first alarm
activation.
Testing of both solutions at the
same time is very difficult because
the activation of

43
the first alarm awakens the user
which is followed by activation of
the second alarm.
In testing partand especially in the
evaluation part of sleep data was
also showed
that the PIR sensor is more accurate
in detecting movements compared
to
accelerometers in mobile devices.
As regards the activation of the
alarm at the right time, we cannot
say with precision
how accurate this result is. This
impression is quite subjective,
however, according to
user ratings eg. on Google Play's
contribution, these types of
applications are evaluated

44
positively. This fact is evidenced by
the number of downloads that are in
the millions.The result of this work
is a functional prototype of smart
alarm clock on the Arduino
platform, which is able to detect
almost awake moment during
sleep. Testing and comparing the
smart alarm with the commercial
solution in the form of Android
application Sleep Cycle alarm
clock for Android showed that
this application and especially the
proposed algorithm is able to
successfully detect the moment at
the same time, maximum in the
range of a few seconds from the
first alarm activation. Testing of
both solutions at the same time is
very difficult because the activation
45
of the first alarm awakens the user
which is followed by activation of
the second alarm. In testing part
and especially in the evaluation
part of sleep data was also showed
that the PIR sensor is more
accurate in detecting movements
compared to accelerometers in
mobile devices. As regards the
activation of the alarm at the right
time, we cannot say with precision
how accurate this result is. This
impression is quite subjective,
however, according to user ratings
eg. on Google Play's contribution,
these types of applications are
evaluated positively. This fact is
evidenced by the number of
downloads that are in the millions.

46
47

You might also like