B5 group
B5 group
A mini project report submitted in partial fulfillment of the requirements for the
award of the degree of
BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
by
CERTIFICATE
This is to certify that the mini-project report entitled “Arduino-Based 8x8 LED
Emoji Matrix” submitted by the following student in partial fulfillment of the
requirements for the award of the Degree of Bachelor of Technology in ECE and is a
bonafide record of the work performed by
Principal
Dr. CH. SRINIVAS External Examiner
ii
DECLARATION
We hereby declare that the mini project titled “Arduino-Based 8x8 LED
Emoji Matrix” submitted to Vaageswari College of Engineering, affiliated to
Jawaharlal Nehru Technological University Hyderabad (JNTUH) for the award of the
Degree of Bachelor of Technology in ECE is a result of the original research carried
out in this work. It is further declared that the report or any part thereof has not been
previously submitted to any University or Institute for the award of a degree.
Date:
iii
ACKNOWLEDGMENT
We wish to pay our sincere gratitude to Dr. Ch. Srinivas, Principal, Vaageswari
College of Engineering, Karimnagar, for providing all the required facilities and his
support throughout the journey.
Our heartiest and sincere gratitude to Dr. A. Venkata Reddy, Professor &
Head, Department of Electronics and Communication Engineering, Vaageswari
College of Engineering for providing us with all possible facilities for carrying out the
project work in the department.
We owe our deepest gratitude to our project supervisor, Mr. G S Arun Kumar,
Associate Professor, Department of Electronics and Communication Engineering,
Vaageswari College of Engineering for his/her meaningful assistance, continuous
support, and guidance during this project.
We are also conveying our heartfelt thanks to the Institute authority,
Department, Library, and Laboratory staff of Vaageswari College of Engineering for
their cooperation during our seminar. Most importantly, We would like to express our
appreciation to our beloved friends for their unconditional support, and constant
encouragement regarding the concepts and presentation.
PROJECT ASSOCIATES
iv
ABSTRACT
This project explores the use of an 8x8 LED matrix controlled by an Arduino
Uno to display various facial expressions such as smiling, neutral, and sad faces. By
manipulating individual LEDs within the matrix, the system creates dynamic visual
representations of emotions. The implementation leverages the Led Control library to
manage the LED matrix efficiently. This project serves as an educational tool,
demonstrating fundamental concepts in microcontroller programming, digital
electronics, and visual display systems. Its simplicity and cost-effectiveness make it
ideal for beginners and hobbyists interested in embedded systems and interactive
displays.
v
TABLE OF CONTENTS
vi
LIST OF FIGURES
vii
LIST OF TABLES
viii
CHAPTER 1
INTRODUCTION TO EMBEDDED SYSTEM
1
1.2.1 Consumer appliances:
The office automation products using embedded systems are copying machine,
fax machine, key telephone, modem, printer, scanner etc.
Today a lot of industries use embedded systems for process control. These
include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity
generation and transmission. The embedded systems for industrial use are designed to
carry out specific tasks such as monitoring the temperature, pressure, humidity, voltage,
current etc., and then take appropriate action based on the monitored levels to control
other devices or to send information to a centralized monitoring station. In hazardous
industrial environment, where human presence has to be avoided, robots are used, which
are programmed to do specific jobs. The robots are now becoming very powerful and
carry out many interesting and complicated tasks such as hardware assembly.
2
protocols. For example, a router interconnects two networks. The two networks may be
running different protocol stacks. The router’s function is to obtain the data packets
from incoming pores, analyze the packets and send them towards the destination after
doing necessary protocol conversion. Most networking equipments, other than the end
systems (desktop computers) we use to access the networks, are embedded systems.
1.2.6 Telecommunications:
The Personal Digital Assistants and the palmtops can now be used to access
multimedia service over the Internet. Mobile communication infrastructure such as base
station controllers, mobile switching centers are also powerful embedded systems.
1.2.8 Insemination:
Testing and measurement are the fundamental requirements in all scientific and
engineering activities. The measuring equipment we use in laboratories to measure
parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all
embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic
analyzer, protocol analyzer, radio communication test set etc. are embedded systems
built around powerful processors. Thank to miniaturization, the test and measuring
equipment are now becoming portable facilitating easy testing and measurement in the
field by fieldpersonnel.
3
1.2.9 Security:
Security of persons and information has always been a major issue. We need to
protect our homes and offices; and also the information we transmit and store.
Developing embedded systems for security applications is one of the most lucrative
businesses nowadays. Security devices at homes, offices, airports etc. for authentication
and verification are embedded systems. Encryption devices are nearly 99 per cent of the
processors that are manufactured end up in~ embedded systems. Embedded systems
find applications in every industrial segment- consumer electronics, transportation,
avionics, biomedical engineering, manufacturing, process control and industrial
automation, data communication, telecommunication, defense, security etc. Used to
encrypt the data/voice being transmitted on communication links such as telephone
lines.
Biometric systems using fingerprint and face recognition are now being
extensively used for user authentication in banking applications as well as for access
control in high security buildings.
1.2.10 Finance:
Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also expanded as
Any Time Money) machines. Smart card, of the size of a credit card, has a small
microcontroller and memory; and it interacts with the smart card reader! ATM machine
and acts as an electronic wallet. Smart card technology has the capability of ushering in
a cashless society. Well, the list goes on. It is no exaggeration to say that eyes wherever
you go, you can see, or at least feel, the work of an embedded system.
4
significant differences. It is not compulsory to have an operating system in every
embedded system.
For small appliances such as remote control units, air conditioners, toys etc.,
there is no need for an operating system and you can write only the software specific to
that application. For applications involving complex processing, it is advisable to have
an operating system. In such a case, you need to integrate the application software with
the operating system and then transfer the entire software on to the memory chip. Once
the software is transferred to the memory chip, the software will continue to run for a
long time you don’t need to reload new software.
Now, let us see the details of the various building blocks of the hardware of an embedded
system. As shown in Fig. the building blocks are;
5
FIG. 1.2: Embedded System Block Diagram
The Central Processing Unit (processor, in short) can be any of the following:
microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-
controller is a low-cost processor. Its main attraction is that on the chip itself, there will
be many other components such as memory, serial communication interface, analog-to
digital converter etc. So, for small applications, a micro-controller is the best choice as
the number of external components required will be very less. On the other hand,
microprocessors are more powerful, but you need to use many external components
with them. D5P is used mainly for applications in which signal processing is involved
such as audio and video processing.
1.3.2 Memory:
The memory is categorized as Random Access 11emory (RAM) and Read Only
Memory (ROM). The contents of the RAM will be erased if power is switched off to
the chip, whereas ROM retains the contents even if the power is switched off. So, the
firmware is stored in the ROM. When power is switched on, the processor reads the
ROM; the program is program is executed.
6
1.3.3 Input Devices:
Unlike the desktops, the input devices to an embedded system have very limited
capability. There will be no keyboard or a mouse, and hence interacting with the
embedded system is no easy task. Many embedded systems will have a small keypad-
you press one key to give a specific command. A keypad may be used to input only the
digits. Many embedded systems used in process control do not have any input device
for user interaction; they take inputs from sensors or transducers 1’fnd produce
electrical signals that are in turn fed to other systems.
The output devices of the embedded systems also have very limited capability.
Some embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the
health status of the system modules, or for visual indication of alarms. A small Liquid
Crystal Display (LCD) may also be used to display some important parameters.
The embedded systems may need to, interact with other embedded systems at
they may have to transmit data to a desktop. To facilitate this, the embedded systems
are provided with one or a few communication interfaces such as RS232, RS422,
RS485, Universal Serial Bus (USB), IEEE 1394, Ethernet etc.
The entire hardware has to be given power supply either through the 230 volts
main supply or through a battery. The hardware has to design in such a way that the
power consumption is minimized.
1.4 MICROPROCESSOR
7
At its core, a microprocessor comprises several key elements, including the
arithmetic logic unit (ALU), control unit, and a set of registers. The ALU is responsible
for executing arithmetic and logical operations, while the control unit coordinates the
flow of data within the processor and manages the execution of instructions.
1.5 MICROCONTROLLER
A microcontroller is a compact, integrated circuit that amalgamates a central
processing unit (CPU), memory (RAM and ROM/Flash), input/output peripherals, and
various essential components like timers, counters, and often communication interfaces,
all on a single chip. This highly integrated design aims to provide a versatile and
selfcontained computing platform tailored for embedded systems. Unlike general-
purpose microprocessors, microcontrollers are purpose-built for specific applications,
facilitating the control and operation of devices and systems in diverse domains such as
automation, robotics, consumer electronics, and more.
9
data during runtime. Input/output peripherals enable communication with the external
environment, including sensors, actuators, displays, and communication modules.
Moreover, microcontrollers often incorporate specialized features such as
analogto-digital converters (ADCs) for interfacing with analog sensors, pulse-width
modulation (PWM) for precise control of outputs like motors or LEDs, and interrupt
controllers to handle external events efficiently. Real-time clock modules and watchdog
timers enhance the time-aware and fault-tolerant aspects of embedded systems.
1.6 CONCLUSION
10
CHAPTER 2
ARDUINO UNO
11
Let's discuss each component in detail:
ATmega328 Microcontroller- It is a single chip Microcontroller of the Atmel
family. The processor code inside it is of 8-bit. It combines Memory (SRAM, EEPROM,
and Flash), Analog to Digital Converter, SPI serial ports, I/O lines, registers, timer,
external and internal interrupts, and oscillator.
• ICSP pin - The In-Circuit Serial Programming pin allows the user to program
using the firmware of the Arduino board.
• Power LED Indicator- The ON status of LED shows the power is activated.
When the power is OFF, the LED will not light up.
• Digital I/O pins- The digital pins have the value HIGH or LOW. The pins
numbered from D0 to D13 are digital pins.
• TX and RX LED's- The successful flow of data i.e., transmitting and receiving
of signals is represented by the lighting of these LED's.
• AREF- The Analog Reference (AREF) pin is used to feed a reference voltage
to the Arduino UNO board from the external power supply.
• Reset button- It is used to add a Reset button to the connection.
• USB- It allows the board to connect to the computer. It is essential for the
programming of the Arduino UNO board.
• Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which
makes the Arduino UNO a powerful board.
• Voltage Regulator- The voltage regulator converts the input voltage to 5V.
• GND- Ground pins. The ground pin acts as a pin with zero voltage.
• Vin- It is the input voltage.
• Analog Pins- The pins numbered from A0 to A5 are analog pins. The function
of Analog pins is to read the analog sensor used in the connection. It can also
act as GPIO (General Purpose Input Output) pins.
Step 1 − First you must have your Arduino board (you can choose your favorite board)
and a USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino
12
Mega 2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the
kind you would connect to a USB printer as shown in the following image.
Step 2 − You can get different versions of Arduino IDE from the Download page on the
Arduino Official website. You must select your software, which is compatible with your
operating system (Windows, IOS, or Linux). After your file download is complete,
unzip the file.
The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw
power from either, the USB connection to the computer or an external power supply.
If you are using an Arduino Diecimila, you have to make sure that the board is
configured to draw power from the USB connection.
The power source is selected with a jumper, a small piece of plastic that fits onto two
of the three pins between the USB and power jacks. Check that it is on the two pins
closest to the USB port.
Connect the Arduino board to your computer using the USB cable. The green power
LED (labeled PWR) should glow.
13
Step 4 − Launch Arduino IDE.
After your Arduino IDE software is downloaded, you need to unzip the folder. Inside
the folder, you can find the application icon with an infinity label (application.exe).
Doubleclick the icon to start the IDE.
14
FIG 2.4: Creating a New Project
Here, we are selecting just one of the examples with the name Blink. It turns the LED
on and off with some time delay. You can select any other example from the list.
Step 6 – Select Your Arduino board
To avoid any error while uploading your program to the board, you must select the
correct Arduino board name, which matches with the board connected to your
computer.
15
Fig.2.5: Selecting Arduino board
Here, we have selected Arduino Uno board according to our tutorial, but you must select
the name matching the board that you are using.
Select the serial device of the Arduino board. Go to Tools → Serial Port menu. This is
likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial
ports). To find out, you can disconnect your Arduino board and re-open the menu, the
entry that disappears should be of the Arduino board. Reconnect the board and select
that serial port.
Arduino Libraries
• SPI - for communicating with devices using the Serial Peripheral Interface (SPI)
Bus.
17
• Wire - Two Wire Interface (TWI/I2C) for sending and receiving data over a net of
devices or sensors.
• SoftwareSerial - for serial communication on any digital pins.
18
Libraries for using your Arduino as either a USB host or device.
Other Libraries
A microcontroller can interact with other hardware components or devices only through
these five ways:
1. Digital Input. This may be received in digital LOW or HIGH from other devices.
These will be TTL logic levels or voltages converted to TTL logic levels before
being applied to the GPIO.
2. Digital Output. This may be output that’s digital LOW or HIGH compared to
other devices. Again, the output will be TTL logic levels.
3. Analog Input. It may “sense” analog voltage from other devices. The sensed
voltage is converted to a digital value using a built-in, analog-to-digital converter.
4. Analog Output. It may output analog voltage to other devices. This analog output
is not analog voltage but a PWM signal that approximates analog voltage levels.
5. Serial Communication. It may transmit, receive, or transceive data with other
devices in serial, according to a standard serial data protocol such as UART,
USART, I2C, SPI, microwire, 1-wire, and CAN, etc. The serial communication
with other devices can be peer-to-peer (UART/USART), half- duplex (I2C), or
full-duplex (SPI).
An Arduino program or any microcontroller program must first have code for
initialization. This may include:
• Setting up pinModes
19
• Initializing settings for serial communications
The program includes code to handle failures when possible. So, any Arduino
program can be visualized as a four-step program as follows:
• Initialization
• Input
• Processing
• Output
20
2.3 ARDUINO C DATA TYPES
byte 1 0 to 255
word 2 0 to 65535
string N/A Null terminated reference data type build from character
array
void N/A Return type for functions that does not return any value
It’s worth noting that “string” and “string objects” are different. The string data type
defines a simple character array while the string data type defines a string object.
21
Arduino C Functions
Identifiers
Identifiers are names given to variables, functions, constants, classes, methods, and
other objects in a program. In Arduino C, identifiers should contain only alphanumeric
characters, dash (-), or underscore(_). An identifier can only start from an underscore
or a letter.
22
Keywords
Keywords are constants, variables, or function names that cannot be used as identifiers.
Arduino C has the following keywords:
23
Variables
Variables are references in a program with values that can change during the execution
of the program. Variables can have names that must be identifiers.
For example, in Arduino C, each variable must be explicitly defined with a specified
data type before it’s used in the code.
• If, in a code statement, a variable has been instantiated by a data type but there’s
no value assigned to it, the variable is said to be defined but not declared.
• If it’s also assigned a value in the same statement or another statement, it’s said
to be declared.
The memory location where the value of a variable is stored at runtime is called its
“lvalue” or location value. The value stored in the memory location of the variable is
called its “rvalue” or register value.
A defined variable has a lvalue but no rvalue. A declared variable has a lvalue and
rvalue.
This is a valid definition of a variable:
int num1;
This is a valid declaration of a variable:
int num1 = 0;
Constants
Constants are references in a program with a value that does not change during the
execution of the program. The integer and floating-point constants can be declared
in Arduino C using const keyword or #define directive.
This is an example of a valid declaration of an integer constant:
const int RXPIN = 0;
24
Operators
1. Arithmetic – addition (+), multiplication (*), subtraction (-), division (/), and
modular division (%)
2. Assignment (=)
3. Comparison – equal to (==), not equal to (!=), less than (<), greater than (>), less
than or equal to (<=), and greater than or equal to (>=)
4. Bitwise – bitwise and (&), bitwise or (|), bitwise xor (^), bitwise not (~), left
bitshift (<<), and right bitshift (>>)
7. Cast – These operators translate current type of a variable to another type. Type
casting can be applied to a variable by indicating the new data type in parenthesis,
before the appearance of the variable.
For example: i = (int) f
8. size of – The size of operator returns the size of an array in the number of bytes.
9. Ternary (:?)
10. Pointer – dereference operator (*) and reference operator (&)
25
Operator precedence
1 ()[]→.(dot )
3 *(multiplication)/%
4 #NAME?
5 << >>
6 <<= >>=
7 == !=
8 &(bitwise AND)
9 ^
10 I
11 &&
12 ||
13 ?:
14 +=-=/=%=&=^==<<=>>=
Control Structures
• if …else…
• for
• switch case
• while
• do… while…
• break
• continue
• goto
26
User-defined functions
Functions are callable blocks of statements. Programmers can also write their own
functions. Functions are an ideal way to organize code according to the functionality of
statement blocks in the program.
• The type of a function can be any data type including void. The function is expected
to return a value of the same type via a return statement. This statement should be
the last one in a function body (any statements made after a return statement will
fail to execute).
• The function exits after the return statement. If the type of a function is void, it
should not return any value. The function name can be any identifier, and may or
may not need arguments. The arguments are variables that are bound to the function.
• This is a valid example of user-defined C function:
a+b+c; }
add_inputs(5, 2, 14)
• Return
Build in functions
Here are some of the commonly used built-in functions in Arduino:
1. pinMode(pin, mode): Configures the specified pin as an INPUT or
OUTPUT.
2. digitalWrite(pin, value): Writes a HIGH or LOW value to the specified
digital pin.
3. digitalRead(pin): Reads the value (HIGH or LOW) from the specified
digital pin.
27
4. analogRead(pin): Reads the analog value from the specified analog pin (0
to 1023).
5. analogWrite(pin, value): Writes a PWM (Pulse Width Modulation) value
to the specified pin (0 to 255).
6. delay(ms): Pauses the program for the specified number of milliseconds.
7. millis(): Returns the number of milliseconds since the Arduino board started
running.
8. Serial.begin(speed): Sets the data rate in bits per second (baud rate) for
serial communication.
9. Serial.print(data): Prints data to the serial port for debugging or
communication.
10. Serial.read(): Reads incoming serial data.
Interfacing Sensors
To interface sensors with an Arduino board, you will typically follow these steps:
1. Select the appropriate sensor: Identify the sensor you want to interface with
your Arduino. This could be a temperature sensor, humidity sensor, light sensor,
motion sensor, etc.
2. Gather the necessary components: In addition to the Arduino board and the
sensor, you may need additional components such as jumper wires, resistors,
capacitors, and breadboards, depending on the specific sensor and your project
requirements.
4. Connect the sensor to the Arduino: Connect the sensor to the appropriate pins
on the Arduino board. This may involve connecting power (VCC and GND),
28
data lines (analog or digital), and any additional pins required for
communication.
5. Write the code: Open the Arduino IDE (Integrated Development Environment)
or your preferred coding environment. Write the code to read data from the
sensor using the appropriate communication protocol (analogRead, digitalWrite,
etc.). You can find libraries and example code for many sensors online to help
you get started.
6. Upload the code: Connect your Arduino board to your computer using a USB
cable. Compile the code and upload it to the Arduino board using the Arduino
IDE or your preferred method.
7. Monitor the sensor output: Open the serial monitor in the Arduino IDE to view
the sensor readings. Depending on the sensor, you may need to perform some
additional calculations or conversions to interpret the raw data correctly.
Test and troubleshoot: Verify that the sensor is working as expected by observing the
sensor readings in the serial monitor or by integrating it into your larger project. If you
encounter any issues, double-check your connections, code, and sensor specifications.
29
CHAPTER 3
METHODOLOGY
8x8
LED matrix
5v power
supply ARDUINO
UNO
An 8x8 LED matrix has 64 LEDs arranged in 8 rows and 8 columns. Each LED
can be addressed by selecting its corresponding row and column. Without a driver chip
like MAX7219, you’d need 16 pins to control the matrix. The MAX7219 simplifies this
by handling the multiplexing and letting the Arduino communicate via SPI protocol with
just 3 wires (DIN, CS, CLK).
30
Hardware components required:
The MAX7219 driver IC interfaces between the Arduino and the 8x8 LED matrix,
reducing the number of pins required for control. The typical connections are:
• VCC → Arduino 5V
This setup allows the Arduino to send serial data to the MAX7219, which then
controls the individual LEDs in the matrix.
Upon uploading the code to the Arduino Uno, the system initializes the
MAX7219 and begins displaying the predefined facial expressions in a loop. Each
expression is represented by an array of bytes, where each byte corresponds to a row in
the LED matrix. The displayFace function iterates through these arrays, updating the
display accordingly.
31
Key Features and Benefits:
• Brightness Control:
The MAX7219 supports digital and analog brightness control, allowing you to
adjust the display's intensity.
• Low Power:
• Versatile:
It can be used to drive various types of LED displays, including 7-segment displays,
bar graphs, and dot matrices.
• Easy to Use:
The MAX7219 simplifies the process of driving LED displays by reducing the
number of external components required and offering a simple serial interface.
Applications:
Digital Clocks, Meters, Numerical Display Systems, LED Matrix Displays, and DIY
projects.
32
How it Works:
Arduino sends data to the MAX7219, which controls the LED matrix.
The MAX7219 uses a synchronous serial interface (SPI) to receive data from a
microcontroller. This data is used to control the brightness, which segments of each digit
are illuminated, and which digit is currently being displayed. The chip handles the low-
level tasks of driving the LEDs, including multiplexing and current regulation.
In summary, the MAX7219 is a powerful and versatile IC for driving LED displays,
offering a simple and efficient solution for a wide range of applications.
33
CHAPTER 4
SOFTWARE IMPLEMENTATION
4.1 INTRODUCTION
In this chapter we are going to study the software used in this project in detail. The
software used in this project is Arduino IDE.
The Arduino IDE supports the languages C and C++ using special rules to
organize code. The Arduino IDE supplies a software library called Wiring from the
Wiring project, which provides many common input and output procedures. A typical
Arduino C/C++ sketch consist of two functions that are compiled and linked with a
program stub main() into an executable cyclic executive program:
• setup(): a function that runs once at the start of a program and that can initialize
settings.
• loop(): a function called repeatedly until the board powers off.
After compiling and linking with the GNU toolchain, also included with the IDE
distribution, the Arduino IDE employs the programavrdude to convert the executable
code into a text file in hexadecimal coding that is loaded into the Arduino board by a
loader program in the board's firmware.
34
Sample program:
Most Arduino boards contain an LED and a load resistor connected between pin 13 and
ground which is a convenient feature for many tests.[20]
#define LED_PIN 13
void setup() {
void loop() {
4.3 STRUCTURE
The setup() function is called when a sketch starts. Use it to initialize variables, pin
modes, start using libraries, etc. The setup function will only run once, after each
powerup or reset of the Arduino board.
After creating a setup() function, which initializes and sets the initial values, the loop()
function does precisely what its name suggests, and loops consecutively, allowing your
program to change and respond. Use it to actively control the Arduino board.
35
4.3.1 Functions:
Digital I/O:
pinMode: Configures the specified pin to behave either as an input or an output. See the
description of digital pins for details on the functionality of the pins.
digitalWrite(): If the pin has been configured as an OUTPUT with pinMode(), its voltage
will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V
(ground) for LOW.
digitalRead(pin): Reads the value from the specified analog pin. The Arduino board
contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega), 10-bit analog
to digital converter. This means that it will map input voltages between 0 and 5 volts
into integer values between 0 and 1023. This yields a resolution between readings of: 5
volts / 1024 units or, .0049 volts (4.9 mV) per unit. The input range and resolution can
be changed using analogReference(). It takes about 100 microseconds (0.0001 s) to read
an analog input, so the maximum reading rate is about 10,000 times a second.
Syntax: analogRead(pin)
millis(): Returns the number of milliseconds since the Arduino board began running the
current program. This number will overflow (go back to zero), after approximately 50
days.
micros(): Returns the number of microseconds since the Arduino board began running
the current program. This number will overflow (go back to zero), after approximately
70 minutes. On 16 MHz Arduino boards (e.g. Duemilanove and Nano), this function has
a resolution of four microseconds (i.e. the value returned is always a multiple of four).
On 8 MHzArduino boards (e.g. the LilyPad), this function has a resolution of eight
microseconds.
36
4.3.2 Utilities:
sizeof: The sizeof operator returns the number of bytes in a variable type, or the number
of bytes occupied by an array.
Syntax: sizeof(variable)
Pointers are one of the more complicated subjects for beginners in learning C, and it is
possible to write the vast majority of Arduino sketches without ever encountering
pointers. However for manipulating certain data structures, the use of pointers can
simplify the code, and knowledge of manipulating pointers is handy to have in one's
toolkit.
attachInterrupt():
The first parameter to attachInterrupt is an interrupt number. Normally you should use
digitalPinToInterrupt(pin) to translate the actual digital pin to the specific interrupt
number. For example, if you connect to pin 3, use digitalPinToInterrupt(3) as the first
parameter to attachInterrupt.
If you wanted to insure that a program always caught the pulses from a rotary encoder,
so that it never misses a pulse, it would make it very tricky to write a program to do
anything else, because the program would need to constantly poll the sensor lines for
the encoder, in order to catch pulses when they occurred. Other sensors have a similar
interface dynamic too, such as trying to read a sound sensor that is trying to catch a
click, or an infrared slot sensor (photo-interrupter) trying to catch a coin drop. In all of
these situations, using an interrupt can free the microcontroller to get some other work
done while not missing the input.
37
About Interrupt Service Routines
ISRs are special kinds of functions that have some unique limitations most other
functions do not have. An ISR cannot have any parameters, and they shouldn't return
anything.
38
CHAPTER 5
OUTCOME OF THE PROJECT
39
CHAPTER 6
ADVANTAGES & APPLICATIONS
6.1 Advantages:
• Customization: Users can create and display various patterns beyond facial
expressions, enhancing creativity.
• Compact Design: The small size of the 8x8 matrix makes it suitable for projects
with space constraints.
6.2 Applications:
40
CHAPTER 7
CONCLUSION & FUTURE SCOPE
7.1 Conclusion:
The project successfully demonstrates how an Arduino Uno can control an 8x8
LED matrix to display different facial expressions. It highlights the synergy between
hardware and software in creating dynamic visual outputs. The simplicity and adaptability
of the design make it an excellent starting point for those interested in embedded systems
and digital displays. By understanding the underlying principles, users can expand upon
this foundation to develop more complex and interactive projects.
• Larger Displays: Expand the matrix size to display more detailed images or
animations.
• Integration with AI: Combine with facial recognition systems to mirror human
expressions in real-time.
• Battery Operation: Modify the power supply for portable applications, enabling
use in wearable technology.
41
BIBLIOGRAPHY
1. Techatronic. (n.d.). Facial Expression on 8X8 LED Matrix Using Arduino. Retrieved
from https://techatronic.com/facial-expression-on-8x8-led-matrix-using-arduino/
2. GitHub - AlexArduinoProjects. (n.d.). Facial Expression on 8X8 LED Matrix Using
Arduino.ino. Retrieved from
https://github.com/alexvatti/AlexArduinoProjects/blob/main/Facial%20Expression%2
0on%208X8%20LED%20Matrix%20Using%20Arduino.ino
3. Earth Bondhon. (n.d.). Smiley Faces with 8x8 Matrix Display. Retrieved from
https://earthbondhon.com/smiley-faces-with-8x8-matrix-display/
4. Instructables. (n.d.). Arduino Matrix Display Emotional Faces. Retrieved from
https://www.instructables.com/Arduino-Matrix-Display-Emotion-Face/
5. Circuit Digest. (n.d.). Arduino 8x8 LED Matrix Project with Circuit Diagram & Code.
Retrieved from https://circuitdigest.com/microcontroller-projects/arduino-8x8-led-
matrix
42
APPENDIX
#include <LedControl.h>
LedControl lc=LedControl(DIN,CLK,CS,0);
void setup(){
lc.shutdown(0,false);
lc.setIntensity(0,7); //Adjust the brightness maximum is 15
lc.clearDisplay(0);
}
void loop(){
//Facial Expression
byte smile[8] = {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C};
byte neutral[8] = {0x3C,0x42,0xA5,0x81,0xBD,0x81,0x42,0x3C};
byte sad[8] = {0x3C,0x42,0xA5,0x81,0x99,0xA5,0x42,0x3C};
byte heart_shape_1[8]={ B01100110, B11111111, B11111111, B11111111,
B01111110, B00111100, B00011000, B00000000};
byte heart_shape_2[8] = {0x60, 0x90, 0x88, 0x44, 0x44, 0x88, 0x90, 0x60};
//Facial Expression
printByte(smile);
delay(1000);
printByte(neutral);
delay(1000);
printByte(sad);
delay(1000);
printByte(heart_shape_1);
delay(1000);
printByte(heart_shape_2);
delay(1000);
}
43