You are on page 1of 8

AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)

Faculty of Engineering
Department of Electrical and Electronic Engineering

MICROPROCESSOR & EMBEDDED SYSTEM LAB


SECTION: D LAB REPORT NO: 09 GROUP NO: 04 DATE:05-01-2021

TITLE: Building a decade counter using Arduino Uno and a 7-segment display.

Submitted by:
NAME: HASAN, MD. NAZMUL ID:18-36144-1
SERIAL NUMBER:19
CONTACT:01839076085

SL Group Member’s Name ID Contact Number Signature


35 Ahmed Alif Swopno 18-37750-1 01627783733

Tomal Md Hasibur Rahman 17-35018-2 01936929399


12
Fatemaa Tauze Zohora Saima 18-37717-1 01776601870
34
Paul Prithvi 17-34124-1 01961473327
05
Ahmed Farjana 17-34634-2 01778888105
08
Md Ruhul Amin 16-31438-1V 01403288711
01
06 Shawon Md Asif Reza 17-34335-1 01534540901

03 Rounok Lia Khan Ramim 16-32902-3 1705508812

SUBMITTED TO:
SUJAN HOWLADER (ESSAN)
ASSISTANT PROFESSOR
FACULTY OF ENGINEERING
DEPARTMENT OF EEE
© Dept. of EEE & COE, FE, AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)
SEMESTER: SPRING 2020-21
Title: Building a decade counter using Arduino Uno and a 7-segment display.

Introduction:
A decade counter is an electronic device which counts up to 10 and then resets itself. It is an important
device and as a counter, it has multiple uses where it has any chronological occurrence. The counter itself
is used along with a 7-segment display which gives us a visual presentation of the counting that has been
operating. In general decade counters are used in clock circuits, frequency dividers, state machines and
sequencers. Due to the unavailability of the regular lab facilities, the hardware design of this particular
decade counter and 7-segment display is executed using Visual Designer i.e., Proteus professional
schematic capture and Proteus VSM simulation. The advantage of designing the system in this method is
that including the code in the Arduino Uno is easy and the overall process can be controlled by a
flowchart editor and is simplified using Drag-Drop-Play and the electronics on the schematic
automatically places and connects themselves.

Abstract:
In this experiment a decade counter with a 7-segment display is designed using Arduino Uno
(R3), 7-segment display. The experiment is done by using both flowchart and Arduino IDE.

Theory and Methodology:


Arduino is an open-source platform used for creating interactive electronics projects. Arduino consists of both a
programmable microcontroller and a piece of software, or IDE (Integrated Development Environment) that runs
on your computer, used to write and upload computer code to the microcontroller board. Arduino Uno also
doesn’t need a hardware circuit (programmer/ burner) to load a new code into the board. We can easily load a
code into the board just using a USB cable and the Arduino IDE (that uses an easier version of C++ to write a
code).
Pin configuration of the board (Arduino Uno R3) and Arduino Mega 2560:

EEE 2103: ELECTRONIC DEVICES 2


Basis of a 7 segment display:

A seven segment display consists of 7 LEDs/ segments all arranged in the shape of the digit “8”. Most of the
segment display has 8 segments (with a dot at the right side of the digit representing the decimal point. All of the
seven segments are named by sequence from “A” letter to “G” and “DP” for the decimal point. And each of the segments can
be controlled as individually just like a
regular LED.

Apparatus:

 Arduino IDE (any version)


 Arduino Uno (R3) board or Arduino mega 2560.
 7 segment display (HDSP5503)

© Dept. of EEE & COE, FE, AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)


Code Segment from Arduino IDE:

#define segA 2
#define segB 3
#define segC 4
#define segD 5
#define segE 6
#define segF 7
#define segG 8
int COUNT=0;
void setup()
{
for (int i=2;i<9;i++)
{
pinMode(i, OUTPUT);
}
}
void loop()
{
switch (COUNT)
{
case 0:
digitalWrite(segA, HIGH);
digitalWrite(segB, HIGH);
digitalWrite(segC, HIGH);
digitalWrite(segD, HIGH);
digitalWrite(segE, HIGH);
digitalWrite(segF, HIGH);
digitalWrite(segG, LOW);
break;

EEE 2103: ELECTRONIC DEVICES 4


case 1:
digitalWrite(segA, LOW);
digitalWrite(segB, HIGH);
digitalWrite(segC, HIGH);
digitalWrite(segD, LOW);
digitalWrite(segE, LOW);
digitalWrite(segF, LOW);
digitalWrite(segG, LOW);
break;
case 2:
digitalWrite(segA, HIGH);
digitalWrite(segB, HIGH);
digitalWrite(segC, LOW);
digitalWrite(segD, HIGH);
digitalWrite(segE, HIGH);
digitalWrite(segF, LOW);
digitalWrite(segG, HIGH);
break;
case 3:
digitalWrite(segA, HIGH);
digitalWrite(segB, HIGH);
digitalWrite(segC, HIGH);
digitalWrite(segD, HIGH);
digitalWrite(segE, LOW);
digitalWrite(segF, LOW);
digitalWrite(segG, HIGH);
break;
case 4:
digitalWrite(segA, LOW);
digitalWrite(segB, HIGH);
digitalWrite(segC, HIGH);
digitalWrite(segD, LOW);
digitalWrite(segE, LOW);
digitalWrite(segF, HIGH);
digitalWrite(segG, HIGH);
break;
case 5:
digitalWrite(segA, HIGH);
digitalWrite(segB, LOW);
digitalWrite(segC, HIGH);
digitalWrite(segD, HIGH);
digitalWrite(segE, LOW);
digitalWrite(segF, HIGH);
digitalWrite(segG, HIGH);
break;
case 6:
digitalWrite(segA, HIGH);

© Dept. of EEE & COE, FE, AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)


digitalWrite(segB, LOW);
digitalWrite(segC, HIGH);
digitalWrite(segD, HIGH);
digitalWrite(segE, HIGH);
digitalWrite(segF, HIGH);
digitalWrite(segG, HIGH);
break;
case 7:
digitalWrite(segA, HIGH);
digitalWrite(segB, HIGH);
digitalWrite(segC, HIGH);
digitalWrite(segD, LOW);
digitalWrite(segE, LOW);
digitalWrite(segF, LOW);
digitalWrite(segG, LOW);
break;
case 8:
digitalWrite(segA, HIGH);
digitalWrite(segB, HIGH);
digitalWrite(segC, HIGH);
digitalWrite(segD, HIGH);
digitalWrite(segE, HIGH);
digitalWrite(segF, HIGH);
digitalWrite(segG, HIGH);
break;
case 9:
digitalWrite(segA,
HIGH);
digitalWrite(segB, HIGH);
digitalWrite(segC, HIGH);
digitalWrite(segD,
HIGH);
digitalWrite(segE, LOW);
digitalWrite(segF, HIGH);
digitalWrite(segG,
HIGH);
break;
break;
}
if (COUNT<10)
{
COUNT++;
delay(1000);
}
if (COUNT==10)
{
COUNT=0;
delay(1000);
}
}

EEE 2103: ELECTRONIC DEVICES 6


Result and Simulation:

© Dept. of EEE & COE, FE, AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)


Discussion and Conclusion:
While performing this experiment, at first, the system has been implemented with Visual Designer for
Arduino™ AVR and Proteus software. Prior to that the flowchart was made from the given conditions
following the lab manual. Then the simulation was run. To have a better understanding of Arduino Uno,
we implemented the design again without the flowchart. Then we completed the code in the Arduino IDE
with the help of the manual. Understanding the code and layout was very important for this experiment.
Though we faced a few errors initially, after some trials, we could solve them successfully.

Reference(s):
 https://www.arduino.cc/.
 HDSP5503 Datasheet.

EEE 2103: ELECTRONIC DEVICES 8

You might also like