0% found this document useful (0 votes)
30 views

Understanding Computer Systems

sadaerewefdfaa

Uploaded by

Drew Baccay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Understanding Computer Systems

sadaerewefdfaa

Uploaded by

Drew Baccay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Chapter 1: Understanding Computer Systems

Chapter 2: Flowcharting and Pseudocodes

Chapter 3: Introduction to C Programming

Chapter 4: Arduino and IDE

Chapter 5: Arduino Programming

Chapter 6: Arithmetic Operators

Understanding Computer Systems

Computer – is an electronic machine that follows a set of instructions in order that it may be able to accept and gather
data and transform this into information

– is a device that accepts information (in the form of digitalized data) and manipulates it for some result
based on a program or sequence of instructions on how the data is to be processed.

Data – is a collection of independent and unorganized facts

Information – is the processed and organized data presented in a meaningful form

1. Education - Computers are extensively used, as a tool and as an aid, for imparting education.

2 Entertainment - Computers have had a major impact on the entertainment industry.

3. Sports - A computer can be used to watch a game, view the scores, improve the game, play games (like chess, etc.)
and create games.

4. Advertising - Computer is a powerful advertising media.

5. Medicine - Medical researchers and practitioners use computers to access information about the advances in
medical research globally.

6. Science and Engineering - Scientists and engineers use computers for performing complex scientific calculations, for
designing and making drawings (CAD/CAM applications) and also for simulating and testing the designs.

7. Government - The government uses computers to manage its own operations and also for e-governance in
providing information to the users and are used for the filing of income tax return, paying taxes, for the access of land
record details, etc.

8. Home - Computers have now become an integral part of home equipment.

The advantages of computers in today's arena:

1. High Speed

- It is capable of performing calculation of very large amount of data.

- It can perform millions of calculations in a few seconds as compared to man who will spend many
months for doing the same task.

2. Accuracy

- Computers are very accurate and the calculations are 100% error free.

- Computers perform all jobs with 100% accuracy provided that correct input has been given.

3. Storage Capability
- It can store large amount of data.

- It can store any type of data such as images, videos, text, audio and many others.

4. Diligence

- It can work continuously without any error and boredom.

- It can do repeated work with same speed and accuracy.

5. Versatility

- A computer is very flexible and after its operation to the program stored in it.

- Machine can be used to solve the problems related to various fields.

6. Reliability

- Modern electronic components have long lives

- Computers are designed to make maintenance easy.

7. Automation

- Computer is an automatic machine and can perform the given task automatically.

- Once a program is given to computer i.e. stored in computer memory, the program and instruction can control the
program execution without human interaction.

8. Reduction in Paper Work

- As data in electronic files can be retrieved as and when required, the problem of maintenance of large number of
paper files gets reduced.

9. Reduction in Cost

- Though the initial investment for installing a computer is high but it substantially reduces the cost of each of its
transaction.

The disadvantages of computers in today's arena

1. No I.Q

- A computer is a machine that has no intelligence to perform any task.

- Each instruction has to be given to computer.

- A computer cannot take any decision on its own.

2. Dependency

- It functions as per a user’s instruction, so it is fully dependent on human being.

3. No Feeling

- It cannot make judgment based on feeling, taste, experience, and knowledge unlike a human being.

Classification of Computer “invented three age group of devices to assist him in calculating and processing data.”
1. Manual Mechanical – is a tool or device with simple mechanism powered by the hand. And these are:

- Abacus

- Napier’s Bones

- Oughtred’s Slide Rule

- Pascal’s Calculator

- Leibniz’s Calculator

- Babbage’s Analytical Engine

2. Electromechanical

– an electromechanical device is usually powered by an electric motor and uses switches and relays. And these are:

- Hollerith’s Punched Card Machine

- Jacquard’s Loom

- Mark 1 with an official name Automatic Sequence Controlled Calculator.

3. Electronic Devices – are devices which use electrical switches and circuitry.

- Atanasoff-Berry Computer– used 45 vacuum tubes for internal logic and capacitors for storage.

- Electronic Numerical Integrator and Calculator (ENIAC) – was the first all-electronic computer.

- Electronic Discrete Variable Automatic Computer (EDVAC) – used the stored' program concept in its design.

- Electronic Delay Storage Automatic Calculator (EDSAC) – the first full-size stored-program computer

- Universal Automatic Computer (UNIVAC) – the first digital computer

Generations of Computer

Generation Years Descriptions


First generation 1946 - 1959 Vacuum tube based
Second generation 1959 - 1965 Transistor based
Third generation 1965 - 1971 Integrated Circuit based
Fourth generation 1971 - 1980 VLSI microprocessor based
Fifth Generation 1980 - onwards ULSI microprocessor based

Types of Computer

No. Type Specifications


1 Super Computer It is an extremely fast computer, which can be executing hundreds of millions of
instructions per second
2 Main Frame It is a multi-user computer system, capable of supporting hundreds of users
simultaneously. Software technology is different from minicomputer.
3 Mini Computer It is a multi-user computer system, capable of supporting hundreds of users
simultaneously
4 Workstation It is also a single user computer system, similar to personal computer however a more
powerful microprocessor has
5 PC (Personal It is a single user computer system having moderately powerful microprocessor.
Computer)
Functions of Computer
Computer

input process output


Computer is an electronic data processing device which

- accepts and stores data input,

- processes the data input, and

- generates the output in a required format

NO. Operation Description


1 Take Input The process of entering data and instructions into the computer system
2 Store Data Saving data and instructions so that they are available for processing as and when required
3 Processing Performing arithmetic, and logical operations on data in order to convert them into useful
Data information
4 Output The process of producing useful information or results for the user, such as a printed report or
Information visual display.
5 Control the Directs the manner and sequence in which all of the above operations are performed.
workflow

Processor – is the central processing unit (CPU) of the computer.

– is considered as the brain of the computer.

– controls the operation of all parts of computer.

– has following three components:

a. Memory Unit – are registers that can store instructions, data and intermediate results. This unit supplies
information to the other units of the computer when needed. Functions of memory unit are:

• it stores all the immediate data and the instructions required for processing.

• it stores immediate results of processing after processing.

b. Control Unit – controls the operations of all parts of computer but does not carry out any actual data processing
operations

Functions of this unit are:

• it is responsible for controlling the transfer of data and instructions among other units of a computer.

• it manages and coordinates all the units of the computer.

• it obtains the instructions from the memory, interprets them, and directs the operation of the computer.

• it communicates with Input/output devices for transfer of data or results from storage. c. ALU (Arithmetic Logic
Unit) – consists of two subsections namely:

• Arithmetic section – performs arithmetic operations like addition, subtraction, multiplication and division. All
complex operations are done by making repetitive use of above operations

• Logic Section – performs logic operations such as comparing, selecting, matching and merging of data

Types of Memory

1. Cache Memory – is a very high speed memory which can speed up CPU.
- It is located inside the CPU. - It acts as a buffer of CPU to/from main memory.

- It is used to hold those parts of data and program which are most frequently used for operations.

2. Primary Memory (Main Memory) – holds only those data and instructions on which computer is currently working.
- It has limited capacity and data is lost when power is switched off. - It is generally made up of semiconductor device
and found outside the CPU. - It is not as fast as registers found inside the CPU. - It is divided into two subcategories
RAM and ROM.

3. Secondary Memory – is also known as external memory or non-volatile or storage.

- It is slower than main memory but bigger in storing capacity.

- It is used for storing data/Information permanently. CPU directly does not access these memories instead they are
accessed via input-output routines. Contents of secondary memories are first transferred to main memory, and then
CPU can access it. For example: disk, CD-ROM, DVD etc.

Units of Information

Unit Symbol Size Description


bit b 1 bit Short for “binary digit”, after the binary code (1 or 0) computers used to store
and process data
nibble 4 bit Four-bit computer architectures use groups of four bits as their fundamental
unit
byte B 8 bit Enough information to create an English letter or number in computer code. It
is the basic unit of computing
word w 16 bit The length of a computer word is called word-size or word length and it may be
as small as 16 bits or may be as long as 96 bits. A computer stores the
information in the form of computer words.

Memory/Storage Capacity

unit Symbol Factor # of Bytes


Kilobyte KB 2^10 1,024
Megabyte MB 2^20 1,048,576
Gigabyte GB 2^30 1,073,741,824
Terabyte TB 2^40 1,099,511,627,776
Petabyte PB 2^50 1,125,899,906,842,624
Exabyte EB 2^60 1,152,921,504,606,846,976
Zettabyte ZB 2^70 1,180,591,620,717,411,303,424
Yottabyte YB 2^80 1,208,925,819,614,629,174,706,176

Components of a Computer System

1. Hardware – represents the physical and tangible components of a computer i.e. the components that can be seen
and touched.

Hardware are following: • Input devices – keyboard, mouse etc. • Output devices – printer, monitor etc. • Secondary
storage devices – hard disk drive, solid state drives and other removable storage such flash drives, CDs and DVDs. •
System Unit – inside of it are CPU or processor, motherboard, RAM etc.
2. Software – is a set of programs, which tells the computer what to do and how to do. A program is a sequence of
instructions written to perform an operation.

There are two types of software:

a. System Software – is a set of one or more programs, designed to control the operation and extend the processing
capability of a computer system. In general, it performs one or more of the following functions:

- Supports the development of other application software.

- Supports the execution of other application software.

- Monitors the effective use of various hardware resources, such as CPU, memory, peripherals, etc.

- Communicates with and controls the operation of peripheral devices, such as printer, disk, tape, etc. Some of the
most commonly known types of system software are:

- Operating Systems: Every computer has an operating system software, which takes care of the effective and
efficient utilization of all the hardware and software components of the computer system.

- Programming Language Translators – are system software, which transform the instructions prepared by
programmers in a programming language, into a form, which can be interpreted and executed.

- Communication Software: In a network environment, communications software enables transfer of data and
programs from one computer to another.

- Utility Programs – are set of programs, which help users in system maintenance tasks, and in performing tasks of
routine nature. Some of the task commonly performed by utility programs include formatting of hard disk or floppy
disks, taking backup of files stored on hard disk, sorting of the records stored in a file, etc.

b. Application Software – is designed to satisfy a particular need of a particular environment. Some of the most
commonly known application software’s are:

- Word-Processing Software – enables us to make use of a computer system for creating, editing, and viewing,
formatting, sorting, retrieving and printing documents.

- Spreadsheet Software – is a numeric data analysis tool, which allows us to create a kind of computer ledger.

- Database Software – is a set of one or more programs, which enable us to create a database, maintain it, organize
its data in desired fashion, and to selectively retrieve useful information from it. A database is a collection of related
data stored and treated as a unit for information retrieval purposes.

- Graphics Software – enables us to use a computer system for creating, editing, viewing, sorting, retrieving and
printing designs, drawings, pictures, graphs, and anything else that can be drawn in the traditional manner.

- Education Software – allows a computer system to be used as teaching and learning tool.

- Entertainment Software – allows a computer system to be used as an entertainment tool. A good example of such
an application is computer video games.

Application software may consist of a single program, such as a Microsoft's notepad for writing and editing simple
text. It may also consist of a collection of programs, often called a software package, which work together to
accomplish a task, such as a spreadsheet package.

Relationship between Hardware and Software

• Hardware and software are mutually dependent on each other. Both of them must work together to make a
computer produce a useful output.
• Software cannot be utilized without supporting hardware.

• Hardware without set of programs to operate upon cannot be utilized and is useless.

• To get a particular job done on the computer, relevant software should be loaded into the hardware

• Hardware is a one-time expense.

• Software development is very expensive and is a continuing expense.

• Different software applications can be loaded on a hardware to run different jobs.

• A software acts as an interface between the user and the hardware. If hardware is the 'heart' of a computer system,
then software is its 'soul'. Both are complimentary to each other.

1. ALU 2. BIOS 3. CAD 4. CAM 5. CPU 6. DVD 7. ENIAC 8. GB 9. GUI 10. I/O 11. PC 12. RAM 13. SSD 14. ULSI 15.
USB

ALGORITHMS AND FLOWCHARTS

Algorithm – is a set of well-defined instructions to solve a particular problem.

Qualities of a Good Algorithm

1. Input and output should be defined precisely.

2. Each step in the algorithm should be clear and unambiguous.

3. Algorithms should be most effective among many different ways to solve a problem.

4. An algorithm shouldn't include computer code. Instead, the algorithm should be written in such a way that it can
be used in different programming languages.

Examples:

Algorithm 1: Add two numbers entered by the user.

1. Start

2. Declare variables num1, num2 and sum.

3. Read values num1 and num2.

4. Add num1 and num2 and assign the result to sum.

5. Display sum

6. Stop

Algorithm 2: Find the largest number among three numbers.

1. Start

2. Declare variables a, b and c.

3. Read variables a, b and c.

4. If a > b and a > c Display a is the largest number.


5. If b > a and b > c Display b is the largest number.

6. If c > a and c > b Display c is the largest number.

7. Stop

Flowcharts – are visual representations of the steps involved in a process or system.

– are pictorial way to express algorithm or process.

– use various symbols to denote different types of actions or steps and arrows to indicate the flow and sequence of
these steps.

Flowchart Rules

for YES (TRUE) and another for NO (FALSE).

Key Elements (Symbols) of Flowcharts:

Elements Symbols Description

Terminator Denotes the beginning and end of a process.

Process Represents a step in the process, typically an


action or operation.

Decision Indicates a decision point where the process


can branch based on a yes/no question or
condition.

Input/Output Represents an input to or output from the


process.

Control flow Show the direction of the process flow.


Connector

Connectors are used to connect breaks in the flowchart

PSEUDOCODES

Pseudocode – is a simplified, informal way of describing a program's logic or algorithm. – uses plain language and a
structure that resembles programming languages but omits specific syntax rules. – is intended to be easily
understood by humans, serving as a bridge between the algorithm design and actual coding.
Characteristics of Pseudocode:

Uses of Pseudocode:

Example Pseudocode:

BEGIN

INPUT number

IF number > 0 THEN

PRINT "positive"

ELSE

PRINT "non-positive"

ENDIF

END

Benefits of Flowcharts and Pseudocode

nning: They aid in the planning phase of software development, ensuring that logic is sound before coding
begins.

review algorithms and processes.

development process.

Computer programming – or programming is the process of designing and building an executable computer program
to accomplish a specific computing result or to perform a specific task.

– is the process of creating a set of instructions that tell a computer how to perform a task.

– can be done using a variety of computer programming languages, such as JavaScript, Python, and C++.
Programming Language – is a formal language comprising a set of instructions that produce various kinds of output.

– is mainly used to control the performance of a machine or to express algorithms.

– consist of instructions for computers.

Types of Programming Languages

1. Low level language – is the most understandable language used by computer to perform its operations. It can be
further categorized into:

a) Machine language (1GL) – consists of strings of binary numbers (i.e., 0s and 1s) and it is the only one language, the
processor directly understands. Machine language has an advantages of very fast execution speed and efficient use of
primary memory. Advantages:

- It is directly understood by the processor so has faster execution time since the programs written in this language
need not to be translated.

- It doesn’t need larger memory.

Disadvantages:

- It is very difficult to program using 1GL since all the instructions are to be represented by 0s and 1s. - Use of this
language makes programming time consuming.

- It is difficult to find error and to debug.

b) Assembly language (2GL) – is also known as low-level language because to design a program programmer requires
detailed knowledge of hardware specification. This language uses mnemonics code (symbolic operation code like
‘ADD’ for addition) in place of 0s and 1s. The program is converted into machine code by assembler. The resulting
program is referred to as an object code.

Advantages:

- It is makes programming easier than 1GL since it uses mnemonics code for programming. For example: ADD for
addition, SUB for subtraction, DIV for division, etc.

- It makes programming process faster.

- Error can be identified much easily compared to 1GL.

- It is easier to debug than machine language. Disadvantages:

- Programs written in this language is not directly understandable by computer so translators should be used.

- It is hardware dependent language so programmers are forced to think in terms of computer’s architecture rather
than to the problem being solved.

- Being machine dependent language, programs written in this language are very less or not portable.

- Programmers must know its mnemonics codes to perform any task.

2. High level language – uses instructions closely resembles to human language or English like words. The high-level
language is easier to learn. It requires less time to write and is easier to maintain the errors. The high-level language is
converted into machine language by one of the two different languages translator programs; interpreter or compiler.
High level language can be further categorized as:
a) Procedural-Oriented language (3GL) – Procedural Programming is a methodology for modeling the problem being
solved, by determining the steps and the order of those steps that must be followed in order to reach a desired
outcome or specific program state. These languages are designed to express the logic and the procedure of a problem
to be solved. It includes languages such as Pascal, COBOL, C, FORTAN, etc.

Advantages:

- Because of their flexibility, procedural languages are able to solve a variety of problems.

- Programmer does not need to think in term of computer architecture which makes them focused on the problem. -
Programs written in this language are portable. Disadvantages:

- It is easier but needs higher processor and larger memory.

- It needs to be translated therefore its execution time is more.

b) Problem-Oriented language (4GL) – allows the users to specify what the output should be, without describing all
the details of how the data should be manipulated to produce the result. This is one step ahead from 3GL. These are
result oriented and include database query language. Examples are Visual Basic, C#, PHP, etc.

The objectives of 4GL are to:

- Increase the speed of developing programs.

- Minimize user’s effort to obtain information from computer.

- Reduce errors while writing programs.

Advantages:

- Programmer need not to think about the procedure of the program. So, programming is much easier.

Disadvantages:

- It is easier but needs higher processor and larger memory.

- It needs to be translated therefore its execution time is more.

c) Natural language (5GL) – are still in developing stage where we could write statements that would look like normal
sentences. Advantages:

- Easy to program.

- Since, the program uses normal sentences, they are easy to understand.

- The programs designed using 5GL will have artificial intelligence (AI).

- The programs would be much more interactive and interesting. Disadvantages:

- It is slower than previous generation language as it should be completely translated into binary code which is a
tedious task.

- Highly advanced and expensive electronic devices are required to run programs developed in 5GL. Therefore, it is an
expensive approach.
Types of Language Processors 1. Compiler – is a language processor that reads the complete source program written
in high level language as a whole in one go and translates it into an equivalent program in machine language.

– the source code is translated to object code successfully if it is free of errors. The compiler specifies the errors at the
end of compilation with line numbers when there are any errors in the source code. The errors must be removed
before the compiler can successfully recompile the source code again.

– use in C, C++, C#, Java, etc. programming languages.

2. Assembler – is used to translate the program written in Assembly language into machine code. The source program
is an input of assembler that contains assembly language instructions. The output generated by assembler is the
object code or machine code understandable by the computer.

– use in Assembly programming language

3. Interpreter – translates a single statement of source program into machine code and executes it immediately
before moving on to the next line. If there is an error in the statement, the interpreter terminates its translating
process at that statement and displays an error message. The interpreter moves on to the next line for execution only
after removal of the error. An Interpreter directly executes instructions written in a programming or scripting
language without previously converting them to an object code or machine code.

– use in Perl, Python and Matlab, etc. programming languages

Examples of Programming Languages

– is a high-level procedural language that become one of the most widely-used programming languages.

– is still a relatively complex language and elements can be seen in C#, C++, Java, Python, and more.

– is mainly used for creating system applications, games, graphics, and apps that use lots of calculations.

– is a versatile and general-purpose language that is similar to JavaScript and Python.

– is a popular object-oriented programming language and can run on just about any device with the Java platform.

– some of the main uses include for business software, web applications, and mobile apps.

– is an object-oriented, high-level programming language launched in 1992.

– has many applications more importantly in general use, such as for web applications, artificial intelligence (AI) and
– is a powerful general-purpose and flexible programming language.

– can be used to develop operating systems, browsers, games, and so on.

– supports different ways of programming like procedural, object-oriented, functional, and so on.

– (pronounced "C sharp") is a simple, modern, object-oriented, and type-safe programming language.

– roots in the C family of languages makes C# immediately familiar to C, C++, Java, and JavaScript programmers.
– or VB, is an object-oriented and event-driven programming language developed by Microsoft.

– makes it fast and easy to create type-safe .NET apps.

– uses environment from Windows that provides a graphical user interface (GUI) which allows programmers to
modify code by simply dragging and dropping objects and defining their behavior and appearance.

– is derived from the BASIC programming language.

– is a high-level, object-oriented programming language which uses a Javalike syntax, which is where the
name comes from.

– is a language used to write code that runs in web browsers for making web pages interactive and responsive.

– is often used alongside HTML and CSS to add things like animations, video players, and even browser-based games.
– is another easy-to-learn coding language that is both free and open source and mainly used for coding on
websites.

– can use to manage dynamic content and databases on a website.

– (sometimes called Sequel) is a domain-specific language designed for managing data held in databases.

– is mainly used to communicate with databases, data analysis and big data mining.

– is a low-level programming language designed for a specific type of processor.

– is intended to communicate directly with a computer’s hardware.

– or Apache Groovy, is an object oriented and Java syntax compatible programming language built for the
Java platform.

– can be used as a scripting language for the Java platform and almost like a super version of Java which offers Java's
enterprise capabilities.

C LANGUAGE PROGRAMMING

C Language – is a general-purpose, procedural, imperative computer programming language developed in 1972 by


Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.

– is the most widely used computer language and keeps fluctuating at number one scale of popularity along with Java
programming language, which is also equally popular and most widely used among modern software programmers.

Advantages of C programming

-level activities

Facts About C

invented to write an operating system called UNIX.

n C.
-of-the-art software have been implemented using C.

Applications of C Programming

Some examples of the use of C are the following:

1. Documentation Section – is a section in which you can give comments to make the program more interactive. The
compiler won’t compile this and hence this portion would not be displayed on the output screen.

2. Preprocessor directives Section – is a section which involves the use of header files that are to included necessarily
in the program.

3. Definition section – is a section which involves the variable definition and declaration in C.

4. Global declaration Section – is a section used to define the global variables to be used in the programs, that means
you can use these variables throughout the program.

5. Function prototype declaration section – is a section which gives the information about a function that includes,
the data type or the return type, the parameters passed or the arguments.

6. Main function – is the major section from where the execution of the program begins. The main section involves
the declaration and executable section.

7. User-defined function section – When you want to define your function that fulfills a particular requirement, you
can define them in this section.

Arduino and IDE

In 2005, building upon the work of Hernando Barragán (creator of Wiring), Massimo Banzi and David Cuartielles
created Arduino at the Interaction Design Institute Ivrea in Ivrea, Italy. David Mellis developed the Arduino software,
which was based on Wiring. Before long, Gianluca Martino and Tom Igoe joined the project, and the five are known as
the original founders of Arduino.

They selected the AVR family of 8-bit microcontroller (MCU or µC) devices from Atmel and designed a self-contained
circuit board with easy-to-use connections, wrote bootloader firmware for the microcontroller, and packaged it all
into a simple integrated development environment (IDE) that used programs called “sketches.” The result was the
Arduino.

Arduino is an open-source electronics platform based on easy-to-use hardware and software. It provides a
straightforward way to create interactive projects using microcontrollers that can be programmed to interact with
sensors, actuators, and other electronic components. While Arduino programs are written in a language that is
essentially C/C++ with some simplified syntax. The Arduino IDE includes built-in libraries to handle common tasks,
which simplifies coding.

Arduino Uno – is an open-source microcontroller board based on the Microchip ATmega328P microcontroller
anddeveloped by Arduino.cc.

– has board equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to various
expansion boards (shields) and other circuits. The board has 14 digital I/O pins (six capable of PWM output), 6 analog
I/O pins, and is programmable with the Arduino IDE (Integrated Development Environment), via a type B USB cable.

– can be powered by the USB cable or by an external 9-volt battery, though it accepts voltages between 7 and 20
volts. It is similar to the Arduino Nano and Leonardo.

– has word "uno" means "one" in Italian and was chosen to mark the initial release of Arduino Software.

– is the first in a series of USB-based Arduino boards. The ATmega328 on the board comes preprogrammed with a
bootloader that allows uploading new code to it without the use of an external hardware programmer.

Arduino Uno Board Description

The Arduino Uno is the most “standard” Arduino board currently on the market, and is probably the best choice for
beginners just getting started with the platform. The board is compatible with more shields (add-on boards) than
other models. Some boards look a bit different from the one given below, but most Arduinos have majority of these
components in common

1 – Power USB. It can be powered by using the USB cable from your computer. All you need to do is connect the USB
cable to the USB connection.

2 – Power (Barrel Jack). It can be powered directly from the AC mains power supply by connecting it to the Barrel
Jack.

3 – Voltage Regulator. Its function is to control the voltage given to the Arduino board and stabilize the DC voltages
used by the processor and other elements.

4 – Crystal Oscillator. It helps Arduino in dealing with time issues. How does Arduino calculate time? The answer is, by
using the crystal oscillator. The number printed on top of the Arduino crystal is 16.000H9H. It tells that the frequency
is 16,000,000 Hertz or 16-MHz.

5 – Arduino Reset. It is used to reset the Arduino board, i.e., start the program from the beginning. Resetting UNO
board comes in two ways: a.) First, by using the reset button on the board and b.) second, by connecting an external
reset button to the Arduino pin labelled RESET.

6, 7, 8, 9 – Pins (3.3, 5, GND, Vin)

• (6) 3.3V: Supply 3.3 output volt

• (7) 5V: Supply 5 output volt.

• (8) GND (Ground): There are several GND pins on the Arduino, any of which can be used to ground your circuit.
• (9) Vin: This pin also can be used to power the Arduino board from an external power source, like AC mains power
supply.

10 – Analog pins. The Arduino UNO board has five analog input pins A0 through A5. These pins can read the signal
from an analog sensor like the humidity sensor or temperature sensor and convert it into a digital value that can be
read by the microprocessor.

11 – Main microcontroller. Each Arduino board has its own microcontroller. It is assumed as the brain of your board.
The main IC (integrated circuit) on the Arduino is slightly different from board to board. The microcontrollers are
usually of the ATMEL Company. You must know what IC your board has before loading up a new program from the
Arduino IDE.

12 – ICSP pin. Mostly, ICSP is an AVR, a tiny programming header for the Arduino. It is often referred to as an SPI
(Serial Peripheral Interface), which could be considered as an "expansion" of the output. Actually, you are slaving the
output device to the master of the SPI bus.

13 – Power LED indicator. This LED should light up when you plug your Arduino into a power source to indicate that
your board is powered up correctly. If this light does not turn on, then there is something wrong with the connection.

14 – TX and RX LEDs. The TX led flashes with different speed while sending the serial data. The speed of flashing
depends on the baud rate used by the board. RX flashes during the receiving process.

15 – Digital I/O. The Arduino UNO board has 14 digital I/O pins (of which 6 provide PWM (Pulse Width Modulation)
output. These pins can be configured to work as input digital pins to read logic values (0 or 1) or as digital output pins
to drive different modules like LEDs, relays, etc. The pins labeled “~” can be used to generate PWM.

16 – AREF. AREF stands for Analog Reference. It is sometimes, used to set an external reference voltage (between 0
and 5 Volts) as the upper limit for the analog input pins.

TYPES OF ARDUINO

Since then, the Arduino has grown in several different directions, with some versions getting smaller than the original,
and some getting larger. The Arduino family of boards use processors developed by the Atmel Corporation of San
Jose, California. Most of the Arduino designs utilize the 8-bit AVR series of microcontrollers.
Arduino Integrated Development Environment (IDE)

– is a special software running on computer system that allows programmers to write sketches (synonym for program
in Arduino language) for different Arduino boards.

– uses programming language that is based on a very simple hardware programming language called processing,
which is similar to the C language.

– is use to upload sketch on the Arduino board for execution.

– contains a text editor for writing code, a message area, a text console, a toolbar with buttons for common
functions, and a series of menus

Sketches – are set of instructions for Arduino. – are saved with the file extension .ino

Bootloader – also spelled as boot loader or called boot manager and bootstrap loader, is a computer program that is
responsible for booting a device and stored on non-volatile memory.

– is a piece of code that is stored in a reserved space of the memory of Arduino board. Basically, this code initiates
the sketch as soon as the board is powered on and also allows new sketches to be uploaded from the program device.

Libraries – provide extra functionality for use in sketches, e.g. working with hardware or manipulating data.

ArduinoDroid – is a free app that will let you edit, compile and upload sketches to your Arduino board directly from
an Android phone or tablet. It has the following features:

Sketch – is the term given to programs written in the Arduino IDE.

– is the unit of code that is uploaded to and run on an Arduino board.

– is written based on C++ programming language.

Function – is a block of code that executes a specific task.

All Arduino sketches have a standardized code structure. This keeps the code easy to read and modify later. The
compiler doesn’t care what order you put these things in, but by convention, people tend to structure their Arduino
code in the following order:

1.) Comments: You describe what the code does.

2.) Libraries: You specify which libraries you want to use in your code. All libraries must be in your Arduino libraries
folder or your compiler will complain.

3.) Variable declarations: You specify what variables you are going to use in your code and what their initial values
are. You learn more about the different kinds of variables you can use, as you build the projects in this book.
4.) Setup: You define how your Arduino will be used and set up any pins and communications you will be using. This
section is indicated by the instruction setup(){ and it is always concluded with a closing curly bracket:}. Code in your
setup is executed first and one time only.

5.) Loop: You place the main instructions for your code. The loop is executed after setup and for as long as your
Arduino is powered up. Any code between the curly brackets {} is processed sequentially and then repeated forever.
The loop is processed as fast as the Arduino can go —around 16 million calculations per second.

6.) User-defined functions: You create your own reusable functions that describe how to do something useful. If you
need to repeat an operation or calculation many times as your

Arduino is running, I recommend that you create a function to do this. This modular way of coding makes it easy to
make a change to how your code works.

Libraries – are used to expand the functionality of Arduino programming just like most programming platforms. It
provides extra functionality for use in sketches, e.g. working with hardware or manipulating data.

Standard Libraries

– reading and writing to "permanent" storage

– for connecting to the internet using the Arduino Ethernet Shield.

– for communicating with applications on the computer using a standard ser – for
connecting to a GSM/GRPS network with the GSM shield.

– – – for
– for communicating with devices using the Serial Peripheral Interface (SPI) Bus

– for serial communication on any digital pins.

– for controlling stepper motors

– for drawing text, images, and shapes on the Arduino TFT screen

– for conn – Two Wire Interface/Inter Integrated


Circuit (TWI/I2C) for sending and receiving data over a net of devices or sensors.

Comments – are lines in the program that are used to inform yourself or others about the way the program works. Its'
only purpose is to help you understand (or remember), or to inform others about how your program works.

– are ignored by the compiler, and not exported to the processor, so it doesn’t take up any space in the
microcontroller’s flash memory. – has two kinds:

a. Block comment or a multi-line comment is marked by the symbol /* and the symbol */ marks its end.

b. Single line comment begins with // (two adjacent slashes) and the comment ends automatically at the end of a line.

Serial – is used for communication between the Arduino board and a computer or other devices. All Arduino boards
have at least one serial port (also known as a UART or USART), and some have several.

Serial.begin( ) – opens up the USB port for serial communication and also sets the baud rate. Typical baud rate for
serial communication with computer is 9600bps.

Serial.print( ) and Serial.println( ) – prints the value passed into the brackets on to the Serial Monitor.
– is called when the invisible cursor must stay on the same line so text printed in the println( )
statement that follows will be printed on the same line as well.

– is used when text must be printed and then the invisible cursor moved to the next line so that
the next print( ) statement will print text on a new line.

SERIAL INSTRUCTIONS

The Serial Monitor is a separate pop-up window that acts as a separate terminal that communicates by receiving and
sending Serial Data. Serial Data is sent over a single wire (but usually travels over USB in our case) and consists of a
series of 1's and 0's sent over the wire. Data can be sent in both directions.

Serial – is used for communication between the Arduino board and a computer or other devices. All Arduino boards
have at least one serial port (also known as a UART or USART), and some have several.

Basic Serial Functions

1. Serial.begin(baud rate)

• Initializes serial communication at the specified baud rate (e.g., 9600, 115200).

• Common baud rates include 9600, 14400, 19200, 38400, 57600, and 115200. Both the Arduino and the connected
device must use the same baud rate to communicate properly. 2. Serial.print(data):

• Sends data to the Serial Monitor.

• This function sends data without adding a newline character at the end. If multiple Serial.print statements are used
consecutively, their outputs will be on the same line. 3. Serial.println(data):

• Similar to Serial.print, but adds a newline character after the data.

• Each Serial.println call will print data on a new line in the Serial Monitor. 4. Serial.read():

• Reads incoming serial data as a byte.

• Returns the first byte of incoming data available (or -1 if no data is available). 5. Serial.available():

• Returns the number of bytes available to read from the serial buffer.

• Useful for checking if there is data to read before attempting to read it. 6. Serial.readStringUntil(char):

• Reads characters from the serial buffer until a specified delimiter character is found.

• Useful for reading entire strings of data terminated by a specific character (e.g., newline). 7. Serial.end()

• Used to terminate the serial communication between the Arduino and the connected device (e.g., a computer or
another microcontroller).

• It shuts down the serial communication, releasing the serial port for other uses or freeing up resources on the
microcontroller.

How It Works:

1. setup() Function:

• The Serial.begin(9600); function initializes serial communication at a baud rate of 9600 bits per second. This is a
standard speed for serial communication between Arduino and the computer.
2. loop() Function:

• Inside the loop() function, the Serial.println("Hello, Arduino!"); command sends the text "Hello, Arduino!" to the
Serial Monitor. The println function ensures that each message appears on a new line. • The delay(1000); command
pauses the program for 1000 milliseconds (1 second) before the loop repeats, so the message is displayed once every
second.

• while (Serial.available() == 0); to wait for user input.

• Serial.read() to clear the input buffer after a key press.

print() – prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers
are printed using an ASCII character for each digit. Floats are similarly printed as ASCII digits, defaulting to two
decimal places. Bytes are sent as a single character. Characters and strings are sent as is. For example:

Serial.print(78) displays “78”

Serial.print(1.23456) displays “1.23”

Serial.print(‘N’) displays “N”

Serial.print(“Hello world”) displays “Hello world”

An optional second parameter specifies the base (format) to use; permitted values are BIN(binary or base 2),
OCT(octal or base 8), DEC(decimal or base 10), HEX(hexadecimal or base 16). For floating point numbers, this
parameter specifies the number of decimal places to use. For example-

Serial.print(78, BIN) displays “1001110”

Serial.print(78, OCT) displays “116”

Serial.print(78, DEC) displays “78”

Serial.print(78, HEX) displays “4E”

Serial.print(1.23456, 0) displays “1”

Serial.print(1.23456, 2) displays “1.23”

Serial.print(1.23456, 4) displays “1.2345”

You might also like