Print Final Final
Print Final Final
AN INTERNSHIP REPORT
Submitted by,
CERTIFICATE
Certified that the Internship titled ‘Real time clock using arduino’ is carried out
by Aryan Tiwari (1RV21EC035), who is bonafide student of RV College of Engineering,
Bengaluru, in partial fulfilment for the award of degree of Bachelor of Engineering in
ELECTRONICS AND COMMUNICATION of the Visvesvaraya Technological
University, Belagavi during the year 2022-23. It is certified that all corrections/suggestions
indicated for the Internal Assessment have been incorporated in the report deposited in the
departmental library. The report has been approved as it satisfies the academic requirements
in respect of Internship work prescribed by the institution for the said degree.
External Viva
1.
2.
DECLARATION
Further I declare that the content of the report has not been submitted previously by anybody
for the award of any degree or diploma to any other university.
I also declare that any Intellectual Property Rights generated out of this work carried out at
RVCE will be the property of RV College of Engineering, Bengaluru and I will be one of the
authors of the same.
I am indebted to my guide, Dr. Srividya P, Associate professor, ECE, RVCE for her
wholehearted support, suggestions and invaluable advice throughout this
Internship/ Industrial training work and also helped in the preparation of this thesis.
My sincere thanks to Dr. H.V. Ravish Aradhya , Professor and Head, Department of
Electronics and Communication Engineering, RVCE for her support and encouragement.
I express sincere gratitude to our beloved Principal, Dr. K. N. Subramanya for his
appreciation towards this Internship/ Industrial training work.
I thank all the teaching staff and technical staff of the Electronics and Communication
Engineering department, RVCE for their help.
Lastly, I take this opportunity to thank my family members and friends who provided all
the backup support throughout the Internship training.
CERTIFICATE
SYNOPSIS
The purpose of the internship was to understand about embedded system which includes
understanding about various kinds of circuit diagram , embedded hardware ,embedded
firmware and various kinds of boards available and using the knowledge develop three
working model i.e. “Burglar alarm system using Arduino” , “audio spectrum analyzer using
Arduino” and “Real time clock using Arduino”.
Internshala helped in providing knowledge regarding the embedded systems ,their future
scope and its components such as microcontrollers , buses, clock, i/o peripherals, instruction
set architecture, memory, different microcontrollers, drawing schemes, operating system,
tasks, multitasking, scheduling ,memory improvement methods.
The first task was to build a “Burglar alarm system using Arduino” which plays a buzzer as
soon as the pir sensor detects a motion and which is used for security purposes. The second
task was to to build a “Audio Spectrum Analyzer using Arduino” which analyzes the music
input, identifies the amplitude of each frequency of the music and displays it on the lcd
display. The third task was a major project to build a real time clock using Arduino uno and
understand the practical functioning of embedded systems. The clock should display the time
in h:m:s on a lcd display and also contains editing mode to change the time as per
requirement. The clock also contains a buzzer which acknowledges the button press.
The internship helped in gaining knowledge regarding embedded systems and applying the
knowledge to prepare the project which helped in understanding arduino and its components
and its possible applications along with Tinkercad which is used to create the simulation. The
testing during simulation confirmed the correct working of the project. The marks in the test
conducted before awarding the certificate was 95%.
i
TABLE OF CONTENTS
Synopsis
List of Tables
List of Figures
Acronyms
Chapter 1
1. Profile of the Organization
1.1 Introduction……………………………………………………………………………2
1.2 History…………………………………………………………………………………3
1.3 Partnership……………………………………………………………………………..3
1.4 Achievements………………………………………………………………………….3
Chapter 2
2. Activities of the Department
2.1 Embedded Systems………………………………………………………………...5
2.2 Hardware Boards…………………………………………………………………..6
2.2.1 Arduino Board……………………………………………………………..6
2.2.2 Microchip Board…………………………………………………………..7
2.2.3 Cirrus Logic Board……………………………………………………….. 8
2.2.4 Texas Instrument Boards…………………………………………………..8
2.3 Circuit Diagrams…………………………………………………………………..9
2.4 Future Scope……………………………………………………………………...11
2.5 Embedded Hardware……………………………………………………………..11
2.6 Embedded Software ……………………………………………………………..12
2.7 Intstruction Set Architecture……………………………………………………..13
2.8 Buses……………………………………………………………………………..14
2.9 Memory…………………………………………………………………………..15
2.10 Embedded Firmware……………………………………………………………16
2.11 Performance Related Parameters………………………………………………..18
Chapter 3
3. Tasks Performed
3.1 Burglar Alarm System using Arduino……………………………………………20
3.1.1 Introduction…………………………………………………………...20
3.1.2 Methodology………………………………………………………….20
3.1.3 Hardware Components………………………………………………..21
3.1.4 Flowchart……………………………………………………………...22
3.1.5 Code and Simulation………………………………………………….23
3.2. Audio Spectrum Analyzer using Arduino
3.2.1 Introduction…………………………………………………………...24
3.2.2 Methodology………………………………………………………….24
3.2.3 Hardware Components………………………………………………..25
3.2.4 Flowchart……………………………………………………………..26
3.2.5 Circuit Diagram………………………………………………………27.
3.2 Real Time Clock using Arduino
3.2.1 Introduction………………………………………………………………27
3.2.2 Methodology……………………………………………………………..27
3.2.3 Requirement Analysis……………………………………………………29
3.2.4 Design……………………………………………………………………30
3.2.5 Schematic Diagram………………………………………………………31
3.2.6 Flowchart…………………………………………………………………32
3.2.7 Code and Simulation……………………………………………………..34
3.2.8 Conclusion………………………………………………………………..41
Chapter 4
4. Reflections
4.1 Analyzing Embedded System………………………………………………………43
4.2 Hardware Boards and Circuit Diagrams…..………………………………………..43
4.3 Embedded Firware………………………………………………………………….43
4.4 Burglar Alarm System and Audio Spectrum Analyzer…………………………….44
4.5 Real Time Clock……………………………………………………………………44
LIST OF FIGURES
v
ACRONYMS
HEADER
vi
RV College of Engineering , Bengaluru - 560059
CHAPTER 1
Profile of the Organization
CHAPTER-1
The chapter presents with the profile of the organization in which internship was completed
i.e. INTERNSHALA. The chapter also showcases the introduction, history, partnerships
along with partnerships and achievements of the organization.
1.1 Introduction
Internshala is an Gurgaon based internship and online training platform what was founded
was Sarvesh Agarwal in 2010.The company aims to create a culture of meaningful
internships in the country. On recruitment portal of Internshala, the internship seekers and
job-seeking freshers from all over India, across different education streams, can search and
apply to various internships and fresher jobs of their choice and organizations. Additionally,
startups, corporates, SMEs, NGOs, education institutes, and big brands, can post their intern
and entry-level job requirements to hire university students and fresh graduates all over
India. On Internshala Trainings, the e-learning arm of Internshala, the online learners
including students and professionals can avail online trainings in the latest in-demand
industry skills to build their career, upskill themselves, and become industry-ready. The logo
of the company is shown in Figure 1.1.
1.2 History
The company was found in 2010 by Sarvesh Agarwal as a blog with a mission to bring a
culture of meaning internships in India. During the initial couple of years,he only hired
virtual interns.The company started expanding and by the year 2013,the company was able to
build a small team and thereafter the company launched its own website with just one goal of
equipping every student in India with their dream internship which was also free initially.
In 2015, ,the company launched its Android app making Internshaala more accessible than
before. The company noticed the need for training amongst students in various different
sectors before applying for internships and thus in 2016 the company launched Internshala
Training with a motivation upskill the students. The company then introduced Fresher Jobs
in 2020 which helps the fresher students to apply and secure the jobs in their areas of
interests. This feature particulary helped graduates with 0-2 years of experience. In 2021,the
company got an insight that more than 90% of the graduates in India start their careers with
a job that pays less than 3 LPA and hence came up with Placement Gurantee courses to help
in starting their careers in their dream profile.
1.3 Partnerships
1.4 Achievements
In 2011, the website became a part of NASSCOM 10K Startups. In 2015, Internshala was a
finalist in PEOPLE MATTERS TechHR 2015 Spotlight Awards under ‘Futurism in
Recruitment’ category.
CHAPTER 2
Activity of the Organization
CHAPTER-2
The organization helped in gaining knowledge regarding embedded systems in detail which
helped in preparing a project.They provide specific trainings and internship tips as per the
industry demand.They have their own blog where people who are trained from the
organization write their own success stories and gives better guidance for the future interns. It
includes their team diary. The organization provided basic knowledge regarding embedded
system ,their future scope,circuit diagrams and hardware boards.
They are designed to perform a specific task. Eg-A washing machine is designed to wash
clothes only and a refrigerator does the job of cooling but a PC can do a print job, a display
job and audio and video routines. They are standalone devices i.e. they require least human
interaction. They cannot get stuck in any situation. They need to resolve and continue the
functioning. They are designed to be safe and have fault tolerable architecture. It reduces the
number of logic circuits. The microprocessor reduces the number of discrete logic ICs
required. For eg-calculators were made from discrete logic ICs .As IC technology evolved,
more and more functions were added to a single chip and finally entire calculator were put in
a single chip. It reduced the cost during mass production scenario but for further
developments, a new chip has to be designed. It enables Digital Signal Processing(DSP)
techniques and replaces Analog Signal Processing. The program can dynamically modify the
characteristic of this signal processing and perform various other functions.DSP can be
performed by all microprocessors, although specialized processors perform better. They are
good at Intellectual Property protection. The technology of product is within a program. It is
burnt inside a silicon chip and hence without knowing the program others cannot copy the
technology. Embedded system doesn’t require product maintenance and updates. They are
power efficient and reduces product size and cost and are memory constrained i.e. the
program should be optimized to run within the memory available-higher the memory
requirement, higher will be the product cost. It gives the Real Time Response. For eg- a
burglar incident or a fire incident requires immediate action. Another functionality is audio or
video. The processing has to start as soon as the data arrives. The custom Operating System
can be used to further modify the product however it is not mandatory.
Some of its applications are in Automobiles to employ microprocessors to control engine
functions, brake systems, safety systems, traction control etc. Household Kitchen appliances
like ovens, refrigerators, toasters use microprocessors. Home appliances such as washing
machine, television, toys, mobile phones. Medical field such as dialysis machines ,
prosthetics, ICU monitors. Communication devices such as routers, gateways, firewalls
printers, scanners, photocopier.
These boards are based on 8 bit microcontrollers. It include ATmega328 microcontroller. The
controller has internal 2KB RAM for variables,32KB ROM for program memory storage and
1KB EPROM for configuration data. External memory chip could be connected to serial pin
like SPI or 2 wire interface. The uno board consists of 4 pin digital I/O pins wherein 6 pins
could be used as pulse width modulation outputs. There are 6 analog inputs which could be
digital inputs also. There is USB connection which serial I/O peripherals. A 16 MHz crystal
oscillator is connected to the microcontroller. There is an ICSP header i.e. In Circuit Serial
Programming header which is used for programming the microcontroller using JTAG.
The Arduino NANO board is more compact than UNO board and is similar to other Arduino
boards with digital analog I/O pins along with power ground and reset pins. However, the
USB connector used is different i.e. a mini USB connector.A Arduino Uno Board is referred
in figure 2.1.
It is PIC24H starter board and has a 16-bit DSP33F controller from microchip.The board is
known as microstick. It is easy to use and has a low cost.The kit is USB powered and
includes onboard debugger or programmer.The device under test socket is also provided for
easy device swapping.The DSP33F or PIC24H processor can be inserted in the sockets.All
device signals are easily available. It’s small in size and onboard debug LED and utility LED
and reset switch is also provided.A Microchip Board is shown in figure 2.2.
It is a 32-bit microcontroller and is used for high performance applications.It has ethernet and
IDE mass storage interface.It also has three USB host connections.It has a 2D graphics
acceleretor, integrated LCD controller,touchscreen high quality audio to use with multimedia
applications.The board is capable of running both embedded LINUX and WINDOWS CE
operating system.The board runs on 12V DC supply.It has 64MB og SGA RAM and 16MB
of flash memory along with that a memory bus and peripheral bus expansion connector is
also provided.There is also a IDE interface to connect hard disk.A JTAG connector is
provided for debugging activities.It has a LCD interface for a touchscreen interface.The
board supports analog VGA connections and has a VGA connector and two USB host
connections are also present.Audio I/O and ethernet connections are also provided.External
battery backed RTC capability is also provided. A Cirrus Logic Board is shown in figure 2.3.
This is a TIVAC Launchpad evaluation board from TEXAS INSTRUMENTS.It ia a low cost
development board based on TM4C series microcontrollers.It has an M4F processor.It has a
maximum speed of 80MHz and has a motion sensor which is backed with
accelerometer,compass etc.The board also comes backed with two analog temperature
sensors,an external and an internal microcontroller temperature sensor.The board has a
control area network and has analog inputs which can receive upto 20V inputs.An OLED
display is also present along with a USB micro connector which can be USB host,a USB
device or a USB OTG.A micro SD card is also provided for auxilary storage.The push-
buttons are also provided for interface.
Schematic Design has a certain set of guidelines. Some of the guidelines are listed mentioned
below.We must always label all the components. Few of the notations which can be used to
simplify the design are R, C, L and D – common passive components,Q-for transistors, T or
XFMR-transformer, S or SW – switch, X or XTAL-crystal oscillators, U or IC-integrated
circuit, TP-test point, JP-jumpers, F-fuse,BT or BAT-battery.We must comment on non-
standard parts or on important performance details.The labels are the most important nets.The
inputs should come from left and outputs to the right.The Power comes from the top, and
ground or negative voltages go to the bottom.Show decoupling capacitors near the device
they are protecting. Table 2.1 describes various kinds of circuit diagrams.
Table 2.1: Different Circuit Diagram
S.no Name of drawing Example Description
1. Schematics It helps in understanding the signal
definitions and signal flow at various
lines of pins, processor pins etc. It is
most useful while debugging or
while understanding how the system
actually works.
Embedded systems have come a long way since their inception. For anyone passionate about
embedded systems, this is a very exciting period. There’s a lot of innovation and
development happening at a rapid pace in various sectors like Internet of Things where a
technology revolution that began just a few years ago. It’s gradually sneaking into our lives
and will soon be a reality. What it does is connects anything to the internet and also allow it
to be configured remotely from anywhere. Devices that work in this mode can vary from
common household devices to any high-end industrial product. Businesses have realized the
importance of IoT and there are consultancy firms specialized in applying IoT to an
organization. Smart cities: Improving a city’s infrastructure by applying the tech of IoT and
connected things. Smart cities use IoT devices such as connected sensors, lights, and meters
to collect and analyze data. The cities then use this data to improve infrastructure, public
utilities and services, and more. Telemetry: Involves gathering data from various sensors
from various regions, clustering them, and routing them to a control station at a different
location. Telemetry actually predates the Internet of Things by many years and it's all done
by radio.
The processor processes the instructions and executes it. The processor is selected based on
the performance levels required. Other factors determining its selection include cost-power
requirement and heat dissipation. There are two type of memories-RAM(Random Access
Memory) determines the amount of memory available for live data processing. Higher RAM
means higher amount of data computation can be done thus increasing the performance
which also means higher cost. ROM is where software and configuration parameters are
stored. If the program size is big, more ROM is required thus increasing the cost of the
product. The processor communicates with external world through peripherals. It includes
GPIO pins, ADC, DAC, comparators, camera interface, sensor ports, display ports,
communication ports etc. The clock circuitry enables the processor and other hardware
blocks to perform. Processor executes instruction at every clock pulse. Higher the clock rate,
higher the performance that means higher power dissipation. Power section powers the entire
hardware block.
The block diagram of software layer is shown in figure 2.11. The system software supports
the application software with system management, routines which can be divided into
operating system layer routines and board support package.
Board support package has direct access to hardware. The device drivers and board support
package routines handles all requirements related to input or output pins, interrupts and
memory. All operating systems have the kernel which is a component that contains the main
functionality of the operating system. Operating system layer manages memory and other
system processes. Operating system layer communicates with board support package to
access the hardware. Application software is upper level software that defines the function
and purpose of embedded system. It interacts with the user and if it needs to access hardware,
the request is transferred to system software from their operating system layer communicates
board support package to perform the task. If the requirements are minimal, the application
software is enough to perform the tasks.
performed. Memory organization: Memory stores operations, operands, and so on. It is like
an array. The indices of this array work like memory addresses. The range of addresses
available to a processor is referred to as the address space. Register Set are the processor
which are used to assist in instruction execution. It works very fast. The number and types of
registers vary based on processor architecture. Each register has a purpose. Some are used for
floating point operations. Some are general-purpose types. This definition regarding the
purpose of each register is also specified by ISA.
Interrupts: ISA also defines the handling of interrupts. An interrupt causes the processor to
stop the current flow of execution and start executing another set of code in response to some
event. This event could be external or internal. The ISA defines the hardware support a
processor has for interrupts like enabling interrupts, flag checking for status, etc. So that is all
about the basic structure of an ISA.
2.8 Buses
The buses interconnect the processor’s major internal components by carrying signals
between the different components. A key feature of processor buses is their width which is
the number of bits that can be transmitted at any one.
Bus Arbitration defines how the devices gain access to the bus.Devices are classified as
master devices or slave devices.Master devices initiate a bus transaction whereas slave device
gain access to a bus in response to a master device’s request.In case of multiple masters
arbitration scheme is needed such as Dynamic Central Parallel arbitration,Centralised Serial
arbitration and Distributed Self Selection. The working of arbitrator is shown in figure 2.12.
In Dyamic Central Arbitration, the arbitrator is centrally located. All bus masters are
connected to central arbitrator. Each master device is a assigned a priority, the master
with highest priority gains access to the bus. In central Serial Arbitration, the masters are
connected in serial. The arbitrator is connected to all masters regardless of which master
makes the request for the bus, the first master in the chain is granted the bus and after the
use access is passed onto the next master in the chain. In Distributed Arbitration Scheme,
there is no central arbitrator, here the masters arbitrate themselves using assigned
priorities to win access to the bus.
2.9 Memory
second is Address decoder which decodes information received over the address bus and
locates the address of data within the memory array and finally the data interface is used to
receive data into or transmit data from storage over the data bus.
A task is an entity of work within an operating system that has control over resources. They
are also referred as threads or processes. When a context switch is performed, it effectively
switches to another task that takes over. The hierarchy is shown in figure 2.14. The features
of a task are-
It owns or controls resources. Eg- access to peripherals.
It has threads of execution. There can be single thread or multiple threads.
Management of memory is needed to maintain the task integrity.
Types of Scheduling in OS
Non Pre-emptive scheduling happens when tasks are given control of the master CPU
until they finish the execution regardless of the length of time or the importance of the
other tasks that are waiting i.e the Task will not be interrupted while Pre-emptive
Scheduling occurs when the operating system forces a context switching even
if a running task has not completed its execution i.e. the task will be interrupted.
Processor Utilization Factor: Indicates the processor load on a single processor. For a given
task set of n periodic tasks, processor utilization factor U is the fraction of time that is spent
for the execution of the task set.
If U>1,task is not scheduled.
If U<1,task is scheduled.
U=1,means 100% processor utilization.
The chapter summarizes about the basic knowledge of major activities which were carried
out during the internship. These activities provided the basic knowledge which helped while
performing the tasks. It includes getting a basic idea of embedded system, its future scopes,
circuit diagrams and hardware board knowledge. The next chapter contains detailed
description of the tasks performed during internship.
CHAPTER 3
TASKS
PERFORMED
CHAPTER-3
TASKS PERFORMED
There are three major tasks which were conducted during the internship. The first task was to
build a burglar alarm system using arduino which is used for security purposes. The second
task was to build an audio spectrum analyzer using arduino which identifies the music input
and displays the amplitude on LCD screen .The third task was to build a Real Time Clock
using arduino.The projects helped in gaining a better understanding of arduino and embedded
systems.
3.1.1 Introduction
A burglar alarm system is basically an intruder alert system used to prevent theft/robbery and
protect one’s premises. Burglar alarm system can be designed in different ways. From very
simple sound alarm system to advanced futuristic system which will send SMS alerts,
activate sound alarms, turn on lights, close the main gate. The cost will go up in depending
upon the features. Here we will be building the system using PIR sensor, Arduino and buzzer.
3.1.2 Methodology
The burglar alarm system will contain a PIR sensor which sends signal to the Arduino as
soon as any motion is detected. The Arduino then activates the buzzer to produce a sound
alarm. This activated sound alarm system will continue until the reset switch button is
pressed by someone. The buzzer is switched off initially.It keeps on monitoring the PIR
sensor output and if a motion is detected, it will activate the buzzer to produce an sound
alarm. The alarm will continue until the reset switch button is pressed.The hardware block
diagram of the project is shown in figure 3.1.
2. PIR Sensor
3. Siren
4. Resistors
5. Transistor
3.1.4 Flowchart
The flowchart of the project is shown in figure 3.2 .
void setup()
{
pinMode(sensor,INPUT); // configuring pin 7 as Input
pinMode(push_switch,INPUT); // configuring pin 6 as Input
pinMode(buzzer,OUTPUT); // configuring pin 8 as OUTPUT
}
void loop()
{
sensor_value=digitalRead(sensor); // Reading sensor value from pin 7
if(sensor_value==HIGH) // Checking if PIR sensor sends a HIGH signal to Arduino
{
digitalWrite(buzzer,HIGH); // Activating the buzzer
}
if(digitalRead(push_switch==HIGH))// Checking if pushbutton was pressed
{
digitalWrite(buzzer,LOW); // turning OFF the buzzer
}
}
The second task was to build “Audio Spectrum Analyzer” using Arduino. The project helped
in getting a basic understanding of Arduino and tinkercad which helped during the final
project.
3.2.1 Introduction
Audio Spectrum Analyser analyses the music input,identifies the amplitude of each frequency
in the music played and then displays it using LED lights.Each audio signal is the sum of
many sin waves.These sin waves can be separated out using Fourier analysis.Audio Spectrum
Analyzer works on the principle of Fourier analysis. Spectrum Analyzer is an equipment that
used fourier analysis and digital processing technique to provide spectrum analysis.Fast
Fourier Transform(FFT) is an algorithm which samples a signal over a unit of time and
divides it into frequency components.The audio spectrum analyser uses internal ADC to
display the spectrum on a 16X2 LCD display.
3.2.2 Methadology
Audio signal is fed into the ADC input of the arduino.The digitized data blocks are
transformed into FFT and displays the blocks on the display.The audio spectrum analyzer
comprises of Arduino Uno and its internal ADC.The spectrum is displayed on a 16X2
diplay.Audio signals from electric microphone passes through an amplifier and it is fed into
ADC input of the Arduino.The zero level of ADC input has to be set exactly at half of the
ADC reference voltage i.e. 2.5V .The signal can have both positive and negative swing on
2.5V level according to the input audio level.The amplifier gain should be properly adjusted
to avoid clipping.ADC digitizes the audio signal.The digitized data blocks in FFT and
displays as spectrum bars on LCD. The block diagram is shown in figure 3.4.
2. LCD
3. Headphone Jack
4. Resistors
5. Capacitor
3.2.4 Flowchart
The project helped in using the practical knowledge gained regarding embedded system and
Arduino components. It also provided extensive knowledge regarding Arduino components.
3.3.1 Introduction
The purpose of Real Time Clock is to provide precise time which can be used for various
useful purposes as it keeps track of the current time and date. It plays a very important role in
systems like digital clock, attendance systems, digital camera etc. It is usually battery
powered so that it keeps the track even when power is down as we won’t be preserving time
hence battery backup is not required. It is also available as a separate integrated circuit which
can be interfaced with microcontrollers.
3.3.2 Methodology
The Project aims to display real time using an 16X2 LCD display in H:M:S format and also
provides provision for Editing Time using push buttons.The clock is also equipped with a
buzzer to acknowledge the button press every time a push button is pressed. The Arduino
All the peripheral devices are connected to Arduino board.As soon as the device is turned on
it will start displaying the current time in H:M:S format.On pressing the MODE key,the time
will stop and cursor will start blinking and on pressing the POS key we can traverse on any
parameter among hour,minute and second and change it as per our requirement using the
EDIT key.We can change multiple parameters by traversing through POS key.OK key is used
to finalize the time and the clock start running from the time we set.On pressing every key,a
buzzer sound is pressed to acknowledge that the key was pressed.
In Arduino the code is set in such a way that it keeps checking after certain amount of fixed
time whether the switch is pressed or not, if not the clock will continue showing the current
time and if yes, then the clock will stop and functions as per the keypress. The functions
involved are :-
ShowTime () – To showcase the current time and to display the time in fixed format
i.e. H:M:S.
ShowDummyTime () -To showcase the time during editing and to display the
changes.
SoundBuzzer () -To play the sound on pressing buzzer.
InitializeKeys () -To get initialize the keys.
ReadKey () -To play the buzzer if key was pressed.
ProcessingKey () - It calls the required function as per the key which was pressed.
ModeKeyTask () - Checks whether the device currently is in which mode and if it’s
in normal mode ,it changes to edit and mode and the cursor starts to blink and if it’s in
the edit mode,it changes it back into normal mode and starts displaying the current
time.
PosKeyTask () - It moves the cursor as per the number of times the key is pressed.It
contains a variable Xpos which keeps incrementing on every buzzer press and
accordingly the cursors place is defined.
EditKeyTask () -It increases the value on every buzzerpress and once the value
crosses the limit it again starts from zero.For eg- the minute cannot be greater than
60,hence as soon as it crosses 60 the value starts increasing from 0 again.
OkKeyTask () -It sets the new time and starts the clock again from there onwards.
The code which calculates the original time runs continuously and updates the time on
display using the inbuilt function millis() and also takes care of the limit of every parameter.
For eg: hour cannot be more than 24 and minutes cannot be more than 60 etc and incase it
reaches to that value, the time automatically starts from 0 again. The rest of the functions are
called whenever a key pressed and as per the requirement of the user.
3. Push Buttons
4. Peizo Buzzer
5. Resistors
3.3.4 Design
The arduino board comes preloaded with a boot loader. This boot loader contains code to
perform a firmware update using serial to USB connection. Arduino is coded using Arduino
IDE which is a platform or a framework that support numerous libraries to interface with
3.3.6 Flowchart
Figure 3.11 When the user has not pressed any key.
#include <LiquidCrystal.h>
#define SECOND_PERIOD 1000
#define MINUTE_PERIOD 60
#define HOUR_PERIOD 60
#define DAY_PERIOD 24
#define NOTE_C4 262
#define MODE_KEY 1
#define POS_KEY 2
#define EDIT_KEY 3
#define OK_KEY 4
#define KEY_READ_INTERVAL 60
#define NORMAL_MODE 0
#define EDIT_MODE 1
int Mode;
int Xpos;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int KeyVal=-1;
void setup()
{
lcd.begin(16, 2);
InitializeLCD();
InitializeKeys();
StartMillis=millis();
}
void loop()
{
CurrentMillis=millis();
if((CurrentMillis-StartMillis)>=SECOND_PERIOD){
StartMillis=CurrentMillis;
Second++;
if(Second>=MINUTE_PERIOD){
Second=0;
Minute++;
if(Minute>=HOUR_PERIOD){
Minute=0;
Hour++;
if(Hour>=DAY_PERIOD){
Hour=0;
}
}
}
if(Mode==NORMAL_MODE){
ShowTime();
}
}
if((CurrentMillis-KeyMillis)>=KEY_READ_INTERVAL){
ReadKey();
KeyMillis=CurrentMillis;
}
}
void InitializeLCD(void){
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Project");
lcd.setCursor(0,1);
lcd.print("Real Time Clock");
delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Current Time is");
}
void ShowTime(){
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(Hour);
lcd.setCursor(3,1);
lcd.print(":");
lcd.setCursor(5,1);
lcd.print(Minute);
lcd.setCursor(8,1);
lcd.print(":");
lcd.setCursor(10,1);
lcd.print(Second);
}
void ShowDummyTime(){
lcd.noBlink();
lcd.setCursor(0,1);
lcd.print(tmpHour);
lcd.setCursor(3,1);
lcd.print(":");
lcd.setCursor(5,1);
lcd.print(tmpMinute);
lcd.setCursor(8,1);
lcd.print(":");
lcd.setCursor(10,1);
lcd.print(tmpSecond);
lcd.blink();
switch(Xpos){
case 0 : lcd.setCursor(0,1);break;
case 1 : lcd.setCursor(5,1);break;
case 2 : lcd.setCursor(10,1);break;
}
}
void SoundBuzzer(void){
tone(10,NOTE_C4,20);
}
void InitializeKeys(void){
pinMode(6,INPUT);
pinMode(7,INPUT);
pinMode(8,INPUT);
pinMode(9,INPUT);
}
void ReadKey(void){
if(digitalRead(6)==HIGH){
KeyVal=MODE_KEY;
}
else if(digitalRead(7)==HIGH){
KeyVal=POS_KEY;
}
else if(digitalRead(8)==HIGH){
KeyVal=EDIT_KEY;
}
else if(digitalRead(9)==HIGH){
KeyVal=OK_KEY;
}
else{
KeyVal=-1;
}
if(KeyVal!=-1){
SoundBuzzer();
}
ProcessingKey();
delay(100);
}
void ProcessingKey(void){
switch(KeyVal){
case MODE_KEY : ModeKeyTask();break;
case POS_KEY : PosKeyTask();break;
void ModeKeyTask(void){
Xpos=0;
lcd.setCursor(0,1);
if(Mode==NORMAL_MODE){
Mode=EDIT_MODE;
lcd.blink();
tmpHour=Hour;
tmpMinute=Minute;
tmpSecond=Second;
}
else{
Mode=NORMAL_MODE;
lcd.noBlink();
}
}
void PosKeyTask(void){
if(Mode==EDIT_MODE){
Xpos++;
if(Xpos>2){
Xpos=0;
}
switch(Xpos){
case 0: lcd.setCursor(0,1);break;
case 1: lcd.setCursor(5,1);break;
case 2: lcd.setCursor(10,1);break;
}
}
}
void EditKeyTask(void){
if(Mode==EDIT_MODE){
switch(Xpos){
case 0: lcd.print(" ");
lcd.setCursor(0,1);
tmpHour++;
if(tmpHour>23){
tmpHour=0;
}
break;
case 1: lcd.print(" ");
lcd.setCursor(5,1);
tmpMinute++;
if(tmpMinute>59){
tmpMinute=0;
}
break;
case 2: lcd.print(" ");
lcd.setCursor(10,1);
tmpSecond++;
if(tmpSecond>59){
tmpSecond=0;
}
break;
}
ShowDummyTime();
}
}
void OkKeyTask(void){
if(Mode==EDIT_MODE){
Hour=tmpHour;
Minute=tmpMinute;
Second=tmpSecond;
Xpos=0;
lcd.setCursor(0,1);
Mode=NORMAL_MODE;
lcd.noBlink();
}
}
3.3.8 Conclusion
The testing of the clock during simulation helped in understanding the features of the clock
and ensured that the code is working correctly. The project helped in understanding the
Arduino board as well as Arduino IDE. The schematic diagram provided the circuital
knowledge of the project and flowcharts provided a understanding of the code. The clock can
run even when system is down if provided the battery backup. It can be used in providing
accurate data during experiments and also used in devices like digital camera, attendance
systems etc. The project helped in gaining a better knowledge regarding the functioning of
the Arduino components and further scope of Embedded Systems.
The chapter helped in understanding the practical application of embedded systems and
building three projects out of which two were minor projects while the third project was the
major project which used all the knowledge acquired such as making circuit diagram , writing
code and interlinking various functions etc.
CHAPTER -4
REFLECTIONS
CHAPTER-4
REFLECTIONS
The chapter includes the knowledge gained during the internship at Internshaala. It also
includes the skills acquired and the projects developed during the course of the internship.
REFERENCES
[1] Falas, Solon, et al. “A Modular End-to-End Framework for Secure Firmware Updates
on Embedded Systems.” ACM Journal on Emerging Technologies in Computing
Systems, vol. 18, no. 1, Jan. 2022, pp. 1–19. DOI.org (Crossref),
https://doi.org/10.1145/3460234.
[2] O.O, A. and O.S, A. (2020) “Designing embedded systems with Arduino microcontrollers: A
way forward for technological advancement in Nigeria,” International Journal of Electrical
and Electronics Engineering, 7(3), pp. 1–5. Available at:
https://doi.org/10.14445/23488379/ijeee-v7i3p101.
[3] Saddik, Amine, et al. “Computer Development Based Embedded Systems in Precision
Agriculture: Tools and Application.” Acta Agriculturae Scandinavica, Section B —
Soil & Plant Science, vol. 72, no. 1, Dec. 2022, pp. 589–611. DOI.org (Crossref),
https://doi.org/10.1080/09064710.2021.2024874.
[4] “Sensor principles” (2005) Principles of Embedded Networked Systems Design, pp. 61–108.
Available at: https://doi.org/10.1017/cbo9780511541049.005.
[5] “Embedded Network Systems” (2005) Principles of Embedded Networked Systems Design,
pp. 1–11. Available at: https://doi.org/10.1017/cbo9780511541049.002.
[6] Falas, S., Konstantinou, C. and Michael, M.K. (2021) “A modular end-to-end framework for
secure firmware updates on embedded systems,” ACM Journal on Emerging Technologies in
Computing Systems, 18(1), pp. 1–19. Available at: https://doi.org/10.1145/3460234.
[7] Thomsen, C., Kruse, J. and Ernst, R. (no date) “From model to requirements: Pattern-based
analysis in distributed development of Embedded Systems,” IFIP On-Line Library in
Computer Science, pp. 35–44. Available at: https://doi.org/10.1007/11523277_4
[8] “Networking” (2005) Principles of Embedded Networked Systems Design, pp. 229–273.
Available at: https://doi.org/10.1017/cbo9780511541049.009.
[9] “Design principles for ENS” (2005) Principles of Embedded Networked Systems Design, pp.
494–498. Available at: https://doi.org/10.1017/cbo9780511541049.018.
[10] Radovici, A. and Culic, I. (2022) “Getting started with tock,” Getting Started with Secure
Embedded Systems, pp. 161–213. Available at: https://doi.org/10.1007/978-1-4842-7789-8_5.
[11] Voudoukis, N.F. (2019) “Arduino based embedded system and remote access technologies
of environmental variables monitoring,” European Journal of Electrical Engineering and
Computer Science, 3(4). Available at: https://doi.org/10.24018/ejece.2019.3.4.101.
[12] “Arduino® Embedded System Design” (2018) Embedded Mechatronics System Design for
Uncertain Environments: Linux®-based, Rasbpian®, ARDUINO® and MATLAB® xPC
Target Approach, pp. 291–344. Available at: https://doi.org/10.1049/pbce109e_ch6.
[13] Wang, H. S., et al. “Design and Integrate Real Time Clock and Temperature Digital Signal
Processing with ARM System.” Journal of Physics: Conference Series, vol. 1755, no. 1, Feb. 2021,
p. 012015. DOI.org (Crossref), https://doi.org/10.1088/1742-6596/1755/1/012015.
[14] Holovatyy, A. et al. (2018) “Development of arduino-based embedded system for detection
of toxic gases in air,” 2018 IEEE 13th International Scientific and Technical Conference on
Computer Sciences and Information Technologies (CSIT) [Preprint]. Available at:
https://doi.org/10.1109/stc-csit.2018.8526672.