0% found this document useful (0 votes)
11 views51 pages

B5 group

The document is a mini project report on an 'Arduino-Based 8x8 LED Emoji Matrix' submitted for the Bachelor of Technology in Electronics and Communication Engineering. It details the project's objectives, methodology, and educational significance, highlighting its use of an LED matrix controlled by Arduino to display facial expressions. The report includes sections on embedded systems, Arduino architecture, and various applications of embedded systems across different fields.

Uploaded by

akhipatel75
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views51 pages

B5 group

The document is a mini project report on an 'Arduino-Based 8x8 LED Emoji Matrix' submitted for the Bachelor of Technology in Electronics and Communication Engineering. It details the project's objectives, methodology, and educational significance, highlighting its use of an LED matrix controlled by Arduino to display facial expressions. The report includes sections on embedded systems, Arduino architecture, and various applications of embedded systems across different fields.

Uploaded by

akhipatel75
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Arduino-Based 8x8 LED Emoji Matrix

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

KORVI BHUMIKA 23S45A0421


MOHAMMAD ASLAM 22S41A0475
VANGAPELLY MAHITHA 22S41A04C0
MOHAMMAD FARAHA AFROZA 22S41A0476

Under the Guidance of

Mr. G S ARUN KUMAR


Associate Professor

Department of Electronics & Communication Engineering


VAAGESWARI COLLEGE OF ENGINNERING
Accredited by NAAC with A+ Grade
Approved by AICTE New Delhi, Affiliated to JNTUH Hyderabad
& Recognised by Govt. of Telangana
Ramakrishna Colony, Karimnagar-505527
2024-25
Department of Electronics & Communication Engineering
VAAGESWARI COLLEGE OF ENGINNERING
Accredited by NAAC with A+ Grade
Approved by AICTE New Delhi, Affiliated to JNTUH Hyderabad
Ramakrishna Colony, Karimnagar-505527

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

KORVI BHUMIKA 23S45A0421


MOHAMMAD ASLAM 22S41A0475
VANGAPELLY MAHITHA 22S41A04C0
MOHAMMAD FARAHA AFROZA 22S41A0476

Internal Guide Head of the Department


Mr. G S ARUN KUMAR Dr. A. VENKATAREDDY
Associate Professor Professor

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.

Name of the Student: KORVI BHUMIKA


Hall ticket Number: 23S45A0421

Name of the Student: MOHAMMAD ASLAM


Hall ticket Number: 22S41A0475

Name of the Student: VANGAPELLY MAHITHA


Hall ticket Number: 22S41A04C0

Name of the Student: MOHAMMAD FARAHA AFROZA


Hall ticket Number: 22S41A0476

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 are highly thankful to Dr. D. Surender, Associate Professor & Project


Coordinator, Department of Electronics and Communication Engineering, Vaageswari
College of Engineering for his valuable and constructive suggestions during our project
pursuit.

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

KORVI BHUMIKA (23S45A0421)


MOHAMMAD ASLAM (22S41A0475)
VANGAPELLY MAHITHA (22S41A04C0)
MOHAMMAD FARAHA AFROZA (22S41A0476)

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

Title Page No.


Certificate ii
Declaration iii
Acknowledgment iv
Abstract v
Table of Contents vi
List of Figures vii
List of Tables viii

CHAPTER 1: INTRODUCTION 1-10


1.1 General Introduction To Embedded System 01
1.2 Application Areas 01
1.3 Overview of Embedded System Architecture 04
1.4 Microprocessor 07
1.5 Microcontroller 09
CHAPTER 2: ARDUINO UNO 11-29
2.1 Arduino UNO Architecture 11
2.2 Setting Up the IDE 12
2.3 Arduino C Data types 21
CHAPTER 3: METHODOLOGY 30-33
CHAPTER 4: SOFTWARE IMPLEMENTATION 34-38
4.1 Introduction 34
4.2 Arduino IDE Introduction 34
4.3 Structure 35
CHAPTER 5: OUTCOME OF THE PROJECT 39
CHAPTER 6: ADVANTAGES & APPLICATIONS 40
6.1 Advantages 40
6.2 Applications 40
CHAPTER 7: CONCLUSION & FUTURE SCOPE 41
7.1 Conclusion 41
7.2 Future scope 41
BIBLIOGRAPHY 42
APPENDIX 43

vi
LIST OF FIGURES

Figure No. Name of the Figure Page No.

Figure 1.1 Embedded System 05

Figure 1.2 Embedded System Block Diagram 06

Figure 1.3 Microprocessor 08

Figure 1.4 Microcontroller 09

Figure 2.1 Arduino Uno 11

Figure 2.2 Setting up the IDE 13

Figure 2.3 Arduino Application Icon 14

Figure 2.4 Creating a New Project 15

Figure 2.5 Selecting Arduino Board 16

Figure 2.6 Arduino IDE Toolbar 17

Figure 2.7 Different Blocks in a Sketch 20

Figure 3.1 Block Diagram of Proposed System 30

Figure 3.2 Schematic diagram of proposed system 33

vii
LIST OF TABLES

Table. No Name of Table Page No

Table 2.1 Arduino C data types 21

Table 2.2 Arduino C Functions 22

Table 2.3 Arduino C Keywords 23

Table 2.4 Arduino C Operators 26

viii
CHAPTER 1
INTRODUCTION TO EMBEDDED SYSTEM

1.1 GENERAL INTRODUCTION TO EMBEDDED SYSTEM


An embedded system can be defined as a computing device that does a specific
focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer,
fax machine, mobile phone etc. are examples of embedded systems. Each of these
appliances will have a processor and special hardware to meet the specific requirement
of the application along with the embedded software that is executed by the processor
for meeting that specific requirement. The embedded software is also called “firm
ware”. The desktop/laptop computer is a general purpose computer. You can use it for
a variety of applications such as playing games, word processing, accounting, software
development and so on. In contrast, the software in the embedded systems is always
fixed listed below:

Embedded systems do a very specific task, they cannot be programmed to do


different things. Embedded systems have very limited resources, particularly the
memory. Generally, they do not have secondary storage devices such as the CDROM or
the floppy disk. Embedded systems have to work against some deadlines. A specific job
has to be completed within a specific time. In some embedded systems, called real-time
systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of
life or damage to property. Embedded systems are constrained for power. As many
embedded systems operate through a battery, the power consumption has to be very low.

Some embedded systems have to operate in extreme environmental conditions


such as very high temperatures and humidity.

1.2 APPLICATION AREAS

Nearly 99 per cent of the processors manufactured end up in embedded systems.


The embedded system market is one of the highest growth areas as these systems are
used in very market segment- consumer electronics, office automation, industrial
automation, biomedical engineering, wireless communication, data communication,
telecommunications, transportation, military and so on.

1
1.2.1 Consumer appliances:

At home we use a number of embedded systems which include digital camera,


digital diary, DVD player, electronic toys, microwave oven, remote controls for TV and
air-conditioner, VCO player, video game consoles, video recorders etc. Today’s high-
tech car has about 20 embedded systems for transmission control, engine spark control,
air conditioning, navigation etc. Even wristwatches are now becoming embedded
systems. The palmtops are powerful embedded systems using which we can carry out
many general purpose tasks such as playing games and word processing.

1.2.2 Office Automation:

The office automation products using embedded systems are copying machine,
fax machine, key telephone, modem, printer, scanner etc.

1.2.3 Industrial Automation:

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.

1.2.4. Medical Electronics:

Almost every medical equipment in the hospital is an embedded system. These


equipments include diagnostic aids such as ECG, EEG, blood pressure measuring
devices, X-ray scanners; equipment used in blood analysis, radiation, colonoscopy,
endoscopy etc. Developments in medical electronics have paved way for more accurate
diagnosis of diseases.

1.2.5 Computer Networking:

Computer networking products such as bridges, routers, Integrated Services


Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay
switches are embedded systems which implement the necessary data communication

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:

In the field of telecommunications, the embedded systems can be categorized as


subscriber terminals and network equipment. The subscriber terminals such as key
telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The
network equipment includes multiplexers, multiple access systems, Packet Assemblers
Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are
the latest embedded systems that provide very low-cost voice communication over the
Internet.

1.2.7 Wireless Technologies:

Advances in mobile communications are paving way for many interesting


applications using embedded systems. The mobile phone is one of the marvels of the
last decade of the 20’h century. It is a very powerful embedded system that provides
voice communication while we are on the move.

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.

1.3 OVERVIEW OF EMBEDDED SYSTEM ARCHITECTURE

Every embedded system consists of custom-built hardware built around a


Central Processing Unit (CPU). This hardware also contains memory chips onto which
the software is loaded. The software residing on the memory chip is also called the
‘firmware’. The embedded system architecture can be represented as a layered
architecture as shown in Fig. The operating system runs above the hardware, and the
application software runs above the operating system. The same architecture is
applicable to any computer including a desktop computer. However, there are

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.

FIG. 1.1: Layered Architecture of an Embedded System

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;

• Central Processing Unit (CPU)


• Memory (Read-only Memory and Random Access Memory)
• Input Devices
• Output devices
• Communication interfaces
• Application-specific circuitry

5
FIG. 1.2: Embedded System Block Diagram

1.3.1 Central Processing Unit (CPU):

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.

1.3.4 Output Devices:

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.

1.3.5 Communication Interfaces:

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.

1.3.6 Application-Specific Circuitry:

Sensors, transducers, special processing and control circuitry may be required


fat an embedded system, depending on its application. This circuitry interacts with the
processor to carry out the necessary work.

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

A microprocessor is a sophisticated electronic component at the heart of modern


computing and digital systems. Functioning as a central processing unit (CPU), this
integrated circuit serves as the brain of a computer or electronic device, orchestrating a
myriad of complex operations with remarkable speed and precision.

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.

FIG. 1.3: Microprocessor

Microprocessors operate on a binary system, manipulating data and instructions


represented in the form of ones and zeros. The processor fetches instructions from the
computer's memory, decodes them, and then executes the corresponding operations.

This seamless orchestration allows the microprocessor to perform diverse tasks,


from basic arithmetic calculations to complex computations required for running
software applications. Microprocessors are versatile and found in an array of electronic
devices, ranging from personal computers and laptops to smartphones, tablets, and
embedded systems. Their widespread use is a testament to their efficiency, scalability,
and adaptability to various applications.

In addition to their role in computation, microprocessors play a crucial part in


managing input and output operations. They interface with peripheral devices,
facilitating communication between the computer and external components such as
keyboards, displays, printers, and storage devices.The advancement of microprocessor
technology has been a driving force behind the exponential growth of computing power
and the miniaturization of electronic devices. Moore's Law, a principle that observes the
doubling of transistor density on integrated circuits approximately every two years, has
fueled this progress, leading to increasingly powerful and energy-efficient
microprocessors.
8
As technology evolves, microprocessors continue to be a focal point of innovation,
with improvements in architecture, fabrication processes, and the integration of
specialized features such as multiple cores, on-chip memory, and enhanced security
measures. This relentless pursuit of advancement ensures that microprocessors remain
at the forefront of computing, powering the digital landscape and enabling the
development of increasingly sophisticated and capable electronic systems.

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.

FIG. 1.4: Microcontroller

The CPU within a microcontroller executes program instructions stored in its


memory, manipulating data and interacting with peripherals to perform predefined
tasks. The memory is utilized for both storing the program code and temporarily holding

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.

The versatility of microcontrollers lies in their adaptability to a wide array of


applications, making them fundamental in the development of smart devices, Internet
of Things (IoT) solutions, and numerous other embedded systems where compactness,
efficiency, and dedicated functionality are paramount. The widespread use of
microcontrollers underscores their pivotal role in the advancement of technology,
influencing innovations across industries and contributing to the seamless integration
of computing capabilities into various aspects of our daily lives.

1.6 CONCLUSION

In conclusion, embedded systems represent a transformative force in modern


technology, seamlessly integrating computing capabilities into the fabric of our daily
lives. These systems, often powered by microcontrollers or microprocessors, play a
pivotal role in a myriad of applications, ranging from consumer electronics to critical
infrastructure. The efficiency, compactness, and dedicated functionality of embedded
systems have revolutionized industries, enabling innovations in areas such as
healthcare, automotive, communication, and beyond.The future of embedded systems
holds the promise of even greater integration, intelligence, and adaptability. With
ongoing developments in artificial intelligence, machine learning, and edge computing,
embedded systems are poised to become more autonomous and capable of making
intelligent decisions in real-time. However, these advancements also bring challenges,
including the need for robust cybersecurity measures and ethical considerations in the
deployment of intelligent embedded technologies.

10
CHAPTER 2
ARDUINO UNO

2.1 ARDUINO UNO ARCHITECTURE:

Arduino is an open-source electronics platform based on simple software and


hardware that enables users to create interactive projects. It consists of a
microcontroller, which is essentially a small computer on a single integrated circuit, and
a set of input/output pins that allow the user to connect sensors, motors, LEDs, and other
electronic components to the board. Arduino boards are programmed using a simple
programming language and an integrated development environment (IDE), making it
accessible to anyone with basic programming skills.

Arduino UNO is based on an ATmega328P microcontroller. It is easy to use


compared to other boards, such as the Arduino Mega board, etc. The board consists of
digital and analog Input/Output pins (I/O), shields, and other circuits. The Arduino UNO
includes 6 analog pin inputs, 14 digital pins, a USB connector, power jack, and an ICSP
(In-Circuit Serial Programming) header. It is programmed based on IDE, which stands
for Integrated Development Environment. It can run on both online and offline
platforms.

Fig.2.1: Arduino Uno Board

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.

2.2 SETTING UP THE IDE


After learning about the main parts of the Arduino UNO board, we are ready to
learn how to set up the Arduino IDE. Once we learn this, we will be ready to upload our
program on the Arduino board.

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.

Fig.2.2: Setting up the IDE

Step 3 − Power up your board.

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.

Fig.2.3: Arduino Application Icon

Step 5 − Open your first project

Once the software starts, you have two options-

• Create a new project.


• Open an existing project example.

To create a new project, select File → New.

14
FIG 2.4: Creating a New Project

To open an existing project example, select File → Example → Basics → Blink.

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.

Go to Tools → Board and select your board.

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.

Step 7 − Select your serial port.

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.

Step 8 − Upload the program to your board.


Before explaining how we can upload our program to the board, we must demonstrate
the function of each symbol appearing in the Arduino IDE toolbar.
16
Fig.2.6: Arduino IDE Toolbar

A − Used to check if there is any compilation


error.

B − Used to upload a program to the Arduino


board.

C − Shortcut used to create a new sketch.

D − Used to directly open one of the example Sketch.

E − Used to save your sketch.


F − Serial monitor used to receive serial data from the board and send the serial data
to the board.
Now, simply click the "Upload" button in the environment. Wait a few seconds;
you will see the RX and TX LEDs on the board, flashing. If the upload is
successful, the message “Done uploading” will appear in the status bar.

Arduino Libraries

Libraries for controlling servo and stepper motors.

• Servo - for controlling servomotors


• Stepper - for controlling stepper motors.

Libraries for using the SPI, I2C and UART protocols.

• 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.

Libraries to access radio modules on different IoT boards (Wi-Fi, Bluetooth®,


LoRa®, GSM, NB-IoT, Sigfox).

• ArduinoIoTCloud - This library allows connecting to the Arduino IoT Cloud


service.
• ArduinoBLE - library to use Bluetooth® Low Energy on a selection of boards.
• Ethernet - for connecting to the Internet via Ethernet.
• GSM-for connecting to a GSM/GRPS network with the GSM shield.
• MKRWAN - library for MKR WAN 1300/1310, for connecting to LoRaWAN®
networks.
• MKRGSM - library for MKR GSM 1400, for connecting to GSM/GPRS networks.
• MKRNB - library for MKR NB 1500, for connecting to NB-IoT / Cat M1 networks.
• SigFox - library for MKR FOX 1200, for connecting to the Sigfox network.
• WiFi - library for the Wi-Fi shield, for Internet connections via Wi-Fi.
• WiFi101 - library for the MKR 1000 Wi-Fi and WiFi101 shield, for Internet
connections via Wi-Fi.
• WiFiNINA - library for boards with a Wi-Fi NINA module, for Internet connections
via Wi-Fi.
Libraries for controlling different displays.

• LiquidCrystal - for controlling liquid crystal displays (LCDs).


• TFT - for drawing text, images, and shapes on the Arduino TFT screen.

Libraries for audio sampling and playback.

• AudioFrequencyMeter - library to sample an audio signal and get its frequency


back.
• AudioZero - library to play audio files from a SD card.
• ArduinoSound - simple way to play and analyze audio data.
• Audio - allows playing audio files from an SD card. For Arduino DUE only.
• I2S - library for using the I2S protocol on SAMD21 (included in SAMD platform).

18
Libraries for using your Arduino as either a USB host or device.

• USBHost - communicate with USB peripherals like mice and keyboards.


• Keyboard - send keystrokes to an attached computer.
• Mouse - control cursor movement on a connected computer.

Other Libraries

• Firmata - for communicating with applications on the computer using a standard


serial protocol.

Basics of Embedded C Programming for Arduino

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:

• Defining variables and constants

• Setting up pinModes

• Setting up ADC/PWM channels

19
• Initializing settings for serial communications

A microcontroller simply intercepts incoming data, processes it according to


programmed instructions, and outputs data through its I/O peripherals. This means
the program must be organized in specific sections that can handle input data,
process data, and control output.

Unlike desktop applications, µc programs are not designed to terminate. These


programs keep iterating for an infinite number of times until the system is shut down
or it meets failure. After a power shutdown, Arduino or any microcontroller resets
on the “power resume” and begins execution of its program from the beginning.

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

Fig 2.7: Different Blocks in a Sketch

20
2.3 ARDUINO C DATA TYPES

TABLE 2.1: Arduino C Data Types

Data Type Byte Length Range of Values

Boolean 1 True or False

char 1 -128 to +127, Compiler matches value with table of


ASCII characters

unsigned char 1 0 to 255

byte 1 0 to 255

int 2 -32768 to 32767

unsigned int 2 0 to 65535

word 2 0 to 65535

long 4 -2,147,483,648 to 2,147,483,647

unsigned long 4 0 to 4,294,967,295

float 4 -3.4028235E+38 to 3.4028235E+38

double 4 -3.4028235E+38 to 3.4028235E+38

string N/A Null terminated reference data type build from character
array

String N/A Reference data type build from character array

array N/A Sequence of indexed values of same type referenced by


single variable

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

Arduino C supports these built-in functions for manipulation of string objects:

TABLE 2.2: Arduino C Functions


Function Name Description

String() Defines a String object

charAt() Access a character at the given index

compareTo() Compare two Strings

concat() Append one String to another String

endsWith() Get the last character of the String object

equals() Compare two Strings

equalsignoreCase() Compare two Strings ignoring case differences

getBytes() Copies a String into a byte array

indexOf() Get the index of a specified character

lastIndexOf() Get the index of the last occurrence of a specified character

length() Returns the number of characters in the String object

replace() Replace one given character with another given character

setCharAt() Change the character at a specified index

startsWith() Check if the String object starts with a specified sequence of


characters

substring() Find a substring within the String object

toCharArray() Change from String to character array

toLowerCase() Change all characters to lowercase

toUpperCase() Change all characters to uppercase

trim() Remove all whitespace characters from the String object

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:

Table 2.3: Arduino C Keywords

# Constants # Port & Constants # Other


Variables
HIGH DDRB DDRC DDRD abs default && switch printString
LOW PINB PINC PIND acos delayMicroseconds ! tan printInteger
INPUT PORTB PORTC PORTD += / || this printByte
OUTPUT PB0 PC0 PD0 + /** Loop true printHex
SERIAL PB1 PC1 PD1 [] * max TWO_PI printoctal
DISPLAY PB2 PC2 PD2 asin else Millis void printBinary
PI PB3 PC3 PD3 = == Min while printNewline
HALF_PI PB4 PC4 PD4 atan exp - Serial pulseIn
TWO_PI PB5 PC5 PD5 atan2 false % begin shiftOut
LSBFIRST PB6 PC6 PD6 & float /* read class
MSBFIRST PB7 PC7 PD7 1 float * print default
CHANGE boolean floor New write do
FALLING byte for Null println return
RISING case < () available switch
false ceil <= PI digitalWrite throw
true char HALF_PI Return digitalRead try
null char if >> pinMode
class ++ ; analogRead
′ != Serial analogWrite
// int Setup attachInterrupts
?: << Sin detachInterrupts
constrai < Sq beginSerial
n
cos <= Sqrt serialWrite
() log ₋₌ serialRead
serialAvailable

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;

Some built-in constants are HIGH, LOW, INPUT, OUTPUT, INPUT_PULLUP,


LED_BUILTIN, true, and false. The #define directive allows for declaring constants
before the compilation of the program. This is a valid declaration of a constant using
#define directive:
#define LEDPin 3

24
Operators

These operators are available in Arduino C:

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 (>>)

5. Boolean – and (&&), or (||) and not (!)


6. Compound – increment (++), decrement (–), compound addition (+=), compound
subtraction (-=), compound multiplication (*=), compound division (/=), compound
bitwise and (&=), and compound bitwise or (|=)

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 (&)

Statements and statement blocks

A statement is a complete C instruction for the processor. All C statements end


with a semicolon (;). A block of statements is a group of statements enclosed within
braces ({, }). A block of statement is also viewed as a single statement by the compiler.

25
Operator precedence

This table shows the precedence of operators in Arduino C in descending order:

Table 2.4: Arduino C Operators


Level Operators

1 ()[]→.(dot )

2 !~++--+(unary )-(unary )* (indirection )&(address of )(cast) sizeof *

3 *(multiplication)/%
4 #NAME?

5 << >>

6 <<= >>=

7 == !=

8 &(bitwise AND)

9 ^
10 I
11 &&

12 ||
13 ?:

14 +=-=/=%=&=^==<<=>>=

Control Structures

Arduino C supports these control structures:


• if

• 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.

• A function definition has this syntax:


function_type function_name(arguments){ function_body

• 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:

int add_inputs(int a, int b, int c) { return

a+b+c; }

• A function is called by its name and followed by a parenthesis. Any positional


arguments must be passed within parenthesis.
• This is a valid example of calling a function:

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

A sensor is a device that transforms physical quantities like temperature, humidity,


pressure, etc., to an electrical signal. Moreover, this signal is often fed to a
microcontroller like the Arduino for further processing, displaying or recording. This
data from the sensor is often analog in nature, i.e., they vary over time and not simple
on-off (digital). The Arduino sensor system uses an analog to digital converter circuit to
process sensor signals.

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.

3. Understand the sensor specifications: Read the datasheet or documentation for


your sensor to understand its pinout, communication protocol (analog or digital),
voltage requirements, and any other specific details.

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

Fig. 3.1: Block Diagram of Proposed System

It aims to create different facial expressions on an 8x8 LED matrix using an


Arduino microcontroller. By turning specific LEDs on and off in a grid format, you can
simulate emojis or face-like patterns, such as happy, sad, angry, surprised, etc. This
project is great for beginners in electronics and embedded systems to learn about LED
matrices, Arduino programming, and binary data representation

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:

• Arduino Uno: Microcontroller board based on the ATmega328P.


• 8x8 LED Matrix: A grid of 64 LEDs arranged in 8 rows and 8 columns.
• MAX7219 Driver IC: Simplifies the control of the LED matrix.
• Jumper Wires: For establishing connections between components.
• USB Cable: For programming the Arduino and providing power.

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:

• DIN (Data In) → Arduino Digital Pin 10

• CS (Chip Select) → Arduino Digital Pin 9

• CLK (Clock) → Arduino Digital Pin 8

• VCC → Arduino 5V

• GND → Arduino GND

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.

The MAX7219 is a versatile 8-digit LED display driver IC used to control 7-


segment LED displays, bar graph displays, or 64 individual LEDs. It simplifies driving
LED displays by integrating a BCD decoder, multiplex scan circuitry, segment and digit
drivers, and a serial interface into one compact package. The MAX7219 uses a simple
synchronous serial interface (SPI) to communicate with microcontrollers.

31
Key Features and Benefits:

• Simple Serial Interface:

The MAX7219 uses a 4-wire serial interface, making it easy to connect to


microcontrollers like Arduino.

• On-Chip BCD Decoder:

It includes a built-in BCD to 7-segment decoder, simplifying the process of


displaying numbers on 7-segment displays.

• Brightness Control:

The MAX7219 supports digital and analog brightness control, allowing you to
adjust the display's intensity.

• Low Power:

It features a low-power shutdown mode, making it suitable for battery-powered


devices.

• 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.

Fig. 3.2: Schematic diagram of proposed system

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.

4.2 ARDUINO IDE INTRODUCTION

The Arduino project provides the Arduino integrated development environment


(IDE), which is a cross-platform application written in the programming language Java.
It originated from the IDE for the languages Processing and Wiring. It is designed to
introduce programming to artists and other newcomers unfamiliar with software
development. It includes a code editor with features such as syntax highlighting, brace
matching, and automatic indentation, and provides simple one-click mechanism to
compile and load programs to an Arduino board. A program written with the IDE for
Arduino is called a "sketch".

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]

A typical program for a beginning Arduino programmer blinks a light-emitting diode


(LED) on and off. This program is usually loaded in the Arduino board by the
manufacturer. In the Arduino environment, a user might write such a program as shown:

#define LED_PIN 13

void setup() {

pinMode(LED_PIN, OUTPUT); // Enable pin 13 for digital output.

void loop() {

digitalWrite(LED_PIN, HIGH); // Turn on the LED.

delay(1000); // Wait one second (1000 milliseconds)

digitalWrite(LED_PIN, LOW); // Turn off the LED.

delay(1000); // Wait one second.

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.

Syntax: pinMode(pin, mode)

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.

Syntax: digitalWrite(pin, value)

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)

4.3.3 Pointer Access Operators:

The pointer operators & (reference) and * (dereference)

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.

4.3.4 External Interrupts:

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.

Interrupts are useful for making things happen automatically in microcontroller


programs, and can help solve timing problems. Good tasks for using an interrupt may
include reading a rotary encoder, or monitoring user input.

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.

detachInterrupt(): Turns off the given interrupt.

38
CHAPTER 5
OUTCOME OF THE PROJECT

Fig. 5.1: Outcome of the proposed system

39
CHAPTER 6
ADVANTAGES & APPLICATIONS

6.1 Advantages:

Implementing facial expressions on an 8x8 LED matrix using Arduino offers


several benefits:

• Educational Value: Introduces learners to microcontroller programming, LED


matrix control, and binary representation of images.

• Cost-Effective: Utilizes affordable components, making it accessible for


educational institutions and hobbyists.

• Simplicity: The straightforward hardware and software design facilitate easy


understanding and replication.

• 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:

This project has diverse applications across various fields:

• Educational Tools: Demonstrates basic electronics and programming concepts


in classrooms and workshops.

• Interactive Displays: Serves as a foundation for creating interactive devices that


respond to user inputs.

• Art Installations: Enables artists to incorporate dynamic visual elements into


their work.

• Wearable Technology: Can be integrated into wearable devices for expressive


displays.

• Robotics: Provides robots with the ability to convey emotions, enhancing


human-robot interaction.

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.

7.2 Future Scope:

Building upon this project, several enhancements can be considered:

• Real-Time Expression Changes: Incorporate sensors (e.g., temperature, light, or


sound) to change expressions based on environmental inputs.

• Wireless Control: Use Bluetooth or Wi-Fi modules to update expressions


remotely via smartphones or computers.

• 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>

int DIN = 10;


int CS = 9;
int CLK = 8;

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);
}

void printByte(byte character [])


{
int i = 0;
for(i=0;i<8;i++)
{
lc.setRow(0,i,character[i]);
}
}

43

You might also like