Mpi Lab No 9

You might also like

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

LAB MANUAL Microprocessors and Microcontrollers

LAB NO. 9 23/09/2021

Make Clock using delays (open ended).

Lab outcomes:
After completing this lab, students will be able to;
 Make Clock using delays in C language program
 Use 7-segment display(s) to make a clock
Corresponding CLO and PLO:
CLO-2, PLO-3
Theory:
In this lab we will make a Digital Clock using multiple 7-segment displays which will work as
hours, minutes, and seconds respectively. For this we need Arduino UNO, three to four 7-
segment displays, 4x120 ohm and 1x330resistors, two LEDs, switches, bread board and couple
of copper wires.
How to multiplex 4 Digit-7 Segment Displays:
The proposed 7 segment clock is a four-digit timepiece with couple of LEDs blinking at the rate
of 1 Hz between hour and minute digits. The 4 digits are multiplexed to reduce the number of
wires that connects from Arduino to 7 segment displays, this will also reduce the power
consumption significantly; with the equivalent power consumption of just one 7 segments
display we can power 4 or more digits without any noticeable reduction in brightness, this is a
huge advantage if you are powering this clock using batteries.

Fig. 1: Multiplexed 4-digit display

Multiplexing is done when there are two or more 7 segment displays exist, multiplexing is done by connecting
individual segments (A to G) together like illustrated in the above schematic and the common terminals of 7
LAB MANUAL Microprocessors and Microcontrollers

segment display are treated as “select lines”, with the help of select lines we can turn ON or OFF the individual 7
segment display. While multiplexing the digits, at any given time only one digit lights up and rest of the three digits
stays OFF, but this occurs 100s of time per second such that we will perceive all the digits lit up simultaneously.

Fig. 2: Arduino 7 Segment clock without RTC

Circuit Description:
The proposed circuit consists of Arduino which is the brain of this project and four 7 segment
displays which are multiplexed. There are two LEDs which blink at the rate of 1 Hz; these two
LEDs are to be placed between the hour and minute digits and there are two push buttons
provided to the set time.
LAB MANUAL Microprocessors and Microcontrollers

Here is the detailed connection between Arduino and 7 segment displays:


Segments Arduino Pins
A 2
B 3
C 4
D 5
E 6
F 7
G 8
DP 9

Common
Arduino Pin
Terminal
D1 10
D2 11
D3 12
D4 13

CODE:
Write your code here make sure to use delays to make this clock
How to Set Time:
The clock will display 12:00 when you power the circuit and the two LEDs starts to blink.
 Pressing hour button will increment the hour digit; you can set hours from 1 to 12.
 Pressing minute button will increment minute digit; you can set 00 to 59.
 Release the hour/minute button when the display is showing correct hour/minute.
The hours and minutes digits will increment by one for every second after you depress the push
button.
How Accurate is this RTC-less Digital Clock?
The proposed clock without RTC may drift +/- 30 seconds a day or more depending on the
ambient temperature variations. The variation might get accumulated over time and may drift
couple of minutes or more a week, so you might need to set the correct time again, but need not
to worry much, as you can set the correct time easily with just couple of clicks.
The time variation is because of the clock signal generated by the crystal varies with the
temperature; the clock signal is not precisely 16MHz but very close to it. Temperature variation
of few degrees will change the oscillation frequency of the crystal by a fraction, but this tiniest
error accumulates over time and deviate from the correct time. Most of the Arduino boards don’t
use a high-quality crystal oscillator, some even uses resonator instead of crystal.
LAB MANUAL Microprocessors and Microcontrollers

Procedure: (Write code, attach Screenshots of simulation and pictures of circuit)


Task 1: Modify code to make Clock such that only minutes switch is used to increment minutes
and when minutes increments more than 60 it increments the hours segment (make sure to use
delays instead of timers).
Task 2: Modify code to make Clock such that you use buzzer in the circuit and when hour is
incremented buzzer is triggered on for 30 seconds.

Observations:
Please write your observation after conducting this lab, you have to write in few lines, what did
you learn in this lab
LAB MANUAL Microprocessors and Microcontrollers

Rubrics
Absent Student is Student can Student has Student has Student
unable to understand followed constructed perfectly
follow the the provided instructions the implemented a
provided laboratory to construct functional/ working
instructions instructions the working model/ logic/
properly. and familiar fundamental schematic/ circuit/ block
The student with the lab schematic/ model/ block diagram/ code
can name the environment block diagram/ and
hardware or (Trainer/ diagram/ code, and successfully
Demonstration
simulation software/ code/ model have executed the
platform, but IDE), but on the successfully lab objective
unable to cannot protoboard/ executed the in Realtime or
implement implement trainer/ program/ run in a
anything on the simulation circuit on simulation
practically or platform software. software environment
on the practically or platform and produced
software on the the desired
software results
Category Ungraded Very Poor Poor Fair Good Excellent
Percentage [0] [1-20] [21-40] [41-60] [61-80] [81-100]
Marks 0.0 1-5 6 - 10 11- 15 16- 20 21 - 25.0
Date Total Marks Instructor’s Signature

Report not Plagiarized Requirements Observations Appropriate Correctly


submitted content are listed and are recorded computations drawn
presented or experimental along with or numerical conclusion
Laboratory incomplete procedure is detailed analysis is with
Reports submission presented procedure performed exact results
and complete
report in all
respects
Category Ungraded Very Poor Poor Fair Good Excellent
Percentage [0] [1-20] [21-40] [41-60] [61-80] [81-100]
Marks 0.0 0.1 - 2 3-4 5-6 7-8 9 - 10
Date Total Marks Instructor’s Signature

You might also like