KEMBAR78
Unit 1 Introduction to Arduino BOARD.pptx
Introduction to microcontroller
(Unit 1)
1
Embedded Systems
2
■ Hard to Define
■ As, it constantly evolves with advances in
technology and dramatic decreases in the cost of
implementing various hardware and software
components.
■ An embedded system is a system that has
software embedded into computer-hardware,
which makes a system dedicated for an
application or specific part of an application or
product or part of a larger system.
■ An embedded system is one that has a
dedicated purpose software embedded in a
computer hardware.
■ Based on Microprocessors or microcontrollers
Microprocessor (MPU or uP)
3
■ MPU (CPU)
■ Read
instructions
■ Process binary
data
A microprocessor is
a computer
processor which
incorporates the
functions of a
computer's central
processing unit
(CPU) on a single
integrated circuit
(IC),or at most a
few integrated
circuits.
3
Microprocessor-Based Systems
4
330_0
1
4
Microcontrollers (uC)
5
electron
ic
devic
e
three
on a
tha
t
majo
r
singl
e
■ Integrated
computing
includes
componen
ts chip
■ Microprocessor
(MPU)
■ Memory
■ I/O (Input/output)
ports
■ Support Devices
■ Timers
■ A/D converter
330_0
1
5
MCU-Based System
6
Differences between μC and μP
7
μC
μP
8
Microprocessor Microcontroller
CPU is stand-alone, RAM,
ROM, I/O & timer are separate.
CPU, RAM, ROM, I/O & timer all
are on single chip.
Designer can decide amount of
RAM, ROM & I/O ports.
Fixed amount of on-chip RAM,
ROM & I/O ports.
High processing power Low processing power
High power consumption Low power consumption
Typically 32/64 bit 8/16 bit
General purpose Single purpose (control
oriented)
Less reliable Highly reliable
Examples: 8086, 8085 Examples: 8051, ATmega328P
Role of microcontroller in embedded
system
• They satisfies market needs, have so many features,
and are designed for satisfying embedded system
needs. That means perform functions only for its
(embedded systems) purpose.
• They provide wide marketing area for embedded
systems.
• They upgrade standard of embedded system
market.
• It simplifies the complexity of market needs.
• They help in innovations (standard applications).
• Power consumption factor is more favorable: They
require or consume less energy, which is the main
factor, to satisfy user needs.
9
10
• Heart of the embedded system: Microcontroller
because it gives life for embedded system
applications. The invention of microcontroller made
an unexpected changes in embedded technology.
• Applications have high perfection: Perfection in
embedded system applications by the invention of
microcontroller.
• Reduces cost of embedded system applications:
Embedded systems are designed to do some
specific task in contrast to a general purpose
computer which is used for multiple tasks.
• It makes embedded systems flexible in market.
11
• Make effective use (due to cost): Many embedded
systems more microcontrollers, which have self
sufficiency and cost-effectiveness.
• Embedded systems are typically far cheaper than
general-purpose personal computers.
• Interconnection: Once the hardware is decided
upon, an interconnection fabric must be devised.
• Testing and verification: The increase in complexity
combined with a lack of knowledge about
individual IP blocks that comes with reuse
techniques leads to problems in adequate testing
and verification of the complete systems.
• Energy management: Efficient metering systems
helps in energy conservation.
Open Source Embedded Platforms
12
■ Open source platform that can be freely
used, changed and shared by anyone.
■ Open source software is made by many
people and distributed under licenses
that comply with the open source
definition.
■ Hardware is also undergoing an open
source revolution. The developer
provides CAD files to the user.
■ Licensed under CERN or TAPR open h/w
license.
Open Source Embedded Platforms :
Examples
13
■ Arduino
■ Banana Pi
■ BeagleBone
Black
■ Panda board
■ OLinuXino
What is Arduino
14
■ Arduino is a movement, not a
microcontroller:
■ Founded by Massimo Banzi and David Cuartielles
in 2005
■ Arduino is an open-source electronics platform
based on easy-to-use hardware (uC) and
software (IDE).
■ Arduino is open source hardware and software.
■ Hardware based on Microcontroller and Software
based on Processing Programming IDE.
■ Arduino was designed for designers who want
to incorporate physical computing into their
designs without having knowledge of electrical
& electronics.
Why Arduino
15
■ Easy to use Hardware Platform
■ Ease of programming
■ Ease of Interfacing of Real life
peripherals
■ Open source and extensible
hardware
■ Open source and extensible
software
■ Low Cost
■ Multiplatform environment
Flavors of Arduino H/W
16
resented By: Mr. Shridhar Dudam 14
Arduino Boards
17
Typical Arduino UNO
Board
18
ATmega328 Internal Architecture
19
Features ATmega328/P
Microcontroller 8-bit family
Architecture RISC
Flash (Bytes) 32K
SRAM (Bytes) 2K
EEPROM (Bytes) 1K
General Purpose I/O Lines 23
SPI 2
TWI (I2C) 1
USART 1
ADC 10-bit 15kSPS
ADC Channels 8
8-bit Timer/ Counters 2
16-bit Timer/ Counters 1
Operating Voltage 1.8V-5.5V
PWM Channels 6
Six Sleep Modes Idle ADC Noise Reduction
Power-save Power-down
Standby Extended standby
20
Arduino IDE
21
• The Arduino
language is based
on C/C++.
• It links against AVR
Libc and allows the
use of its functions
• Code is case
sensitive
• Statements are
commands and
must end with a
semi-colon
• Comments follow a
// or begin with /*
Arduino IDE : Important Icons
22
Sketch and Sketchbook
23
■ Programs in Arduino called as sketches
■ Sketches must saved in the directory.
■ Arduino IDE uses the concept of a
sketchbook:
■ A standard place to store programs (or
sketches).
■ IDE automatically creates directory
for the sketchbook.
■ Sketches were saved with a .ino file
extension.
Arduino IDE : Sketch Structure
24
Arduino Programming Environment
25
■ Arduino uses Object Oriented
Programming.
■ Arduino is programmed with C and C++.
■ AllArduino libraries are made using
C++ in order to be easily
reusable
■ The native library is designedfor
a very elementary and global
purpose.
■ Arduino programs can be divided in
■ Structure
Structure (1)
26
■ From global conditional control
structures to more specific ones.
■ Basic Structure
■ setup()
■ loop()
■ Control Structures (Conditional
Statements)
■ if , if...else and switch case
■ for, while and do... while
■ break and continue
■ return
■ goto
if …. else statement
27
Switch case and break
28
Loop statement : for loop
29
■ Synta
x
■ exampl
e
While loop structure
30
■ Synta
x
■ Exampl
e
do … while loop structure
31
■ Synta
x
■ Exampl
e
Structure : Operators
32
Arithmetic Operators Comparison Operators
= (assignment operator) == (equal to)
+ (addition) != (not equal to)
- (subtraction) < (less than)
* (multiplication) > (greater than)
/ (division) <= (less than or equal to)
% (modulo) >= (greater than or equal to)
ed By: Mr. Shridhar
Dudam
Bitwise Operators Compound Operators
& (bitwise and) ++ (increment)
| (bitwise or) -- (decrement)
^ (bitwise xor) += (compound addition)
~ (bitwise not) -= (compound subtraction)
<< (bitshift left) *= (compound multiplication)
>> (bitshift right) /= (compound division)
%= (compound modulo)
&= (compound bitwise and)
|= (compound bitwise or)
Structure : Operators
33
Boolean Operators Pointer Access Operators
&& (and)
|| (or)
! (not)
* dereference
operator &
reference operator
Values: Variables
34
Values: Variables
35
Values: Constants
36
■ HIGH | LOW
■ INPUT | OUTPUT |
INPUT_PULLUP
■ LED_BUILTIN
■ true | false
■ integer constants
■ floating point constants
Values : Type Conversion
37
■ Type conversion is the process that
changes an entity data type into
another.
■ Type conversion can be implicitly
done or explicitly made.
■ Explicit Type Conversion
■ char()
■ byte()
■ int()
■ word()
■ long()
■ float()
The Scope Concept
38
■ The scope can be
defined as a particular
property of a variable.
■ A variable can be
global and then is
visible and usable
everywhere in the
source code.
■ But a variable can also
be local, declared
inside a function, for
instance, and that is
Functions (1)
39
■ Mat
h
■ Digital I/O
■ pinMode()
■ digitalWrite()
■ digitalRead()
■ Analog I/O
■ analogReference()
■ analogRead()
■ analogWrite() -
PWM
■ Due & Zero only
■ analogReadResolutio
n()
■
analogWriteResol
ution()
■
t
an()
■ min()
■ max()
■ abs()
■ constrain()
■ map()
■ pow()
■ sqrt()
■ Trigonomet
ry
■ sin()
■ cos()
Functions (2)
■ Advanced I/O
■ tone()
■ noTone()
■ shiftOut()
■ shiftIn()
■ pulseIn()
■ Time
■ millis()
■ micros()
■ delay()
■ Characters
■ isAlphaNumeric()
■ isAlpha()
■ isAscii()
■ isWhitespace()
■ isControl()
■ isDigit()
■ isGraph()
■ isLowerCase()
■ isPrintable()
■ isPunct()
■ isSpace()
■ isUpperCase() 40
■
delayMicrosec
onds()
Functions (3)
41
■ Random
Numbers
■ randomSeed()
■ random()
■ Bits and Bytes
■ lowByte()
■ highByte()
■ bitRead()
■ bitWrite()
■ bitSet()
■ bitClear()
■ bit()
4
6

Unit 1 Introduction to Arduino BOARD.pptx

  • 1.
  • 2.
    Embedded Systems 2 ■ Hardto Define ■ As, it constantly evolves with advances in technology and dramatic decreases in the cost of implementing various hardware and software components. ■ An embedded system is a system that has software embedded into computer-hardware, which makes a system dedicated for an application or specific part of an application or product or part of a larger system. ■ An embedded system is one that has a dedicated purpose software embedded in a computer hardware. ■ Based on Microprocessors or microcontrollers
  • 3.
    Microprocessor (MPU oruP) 3 ■ MPU (CPU) ■ Read instructions ■ Process binary data A microprocessor is a computer processor which incorporates the functions of a computer's central processing unit (CPU) on a single integrated circuit (IC),or at most a few integrated circuits. 3
  • 4.
  • 5.
    Microcontrollers (uC) 5 electron ic devic e three on a tha t majo r singl e ■Integrated computing includes componen ts chip ■ Microprocessor (MPU) ■ Memory ■ I/O (Input/output) ports ■ Support Devices ■ Timers ■ A/D converter 330_0 1 5
  • 6.
  • 7.
    Differences between μCand μP 7 μC μP
  • 8.
    8 Microprocessor Microcontroller CPU isstand-alone, RAM, ROM, I/O & timer are separate. CPU, RAM, ROM, I/O & timer all are on single chip. Designer can decide amount of RAM, ROM & I/O ports. Fixed amount of on-chip RAM, ROM & I/O ports. High processing power Low processing power High power consumption Low power consumption Typically 32/64 bit 8/16 bit General purpose Single purpose (control oriented) Less reliable Highly reliable Examples: 8086, 8085 Examples: 8051, ATmega328P
  • 9.
    Role of microcontrollerin embedded system • They satisfies market needs, have so many features, and are designed for satisfying embedded system needs. That means perform functions only for its (embedded systems) purpose. • They provide wide marketing area for embedded systems. • They upgrade standard of embedded system market. • It simplifies the complexity of market needs. • They help in innovations (standard applications). • Power consumption factor is more favorable: They require or consume less energy, which is the main factor, to satisfy user needs. 9
  • 10.
    10 • Heart ofthe embedded system: Microcontroller because it gives life for embedded system applications. The invention of microcontroller made an unexpected changes in embedded technology. • Applications have high perfection: Perfection in embedded system applications by the invention of microcontroller. • Reduces cost of embedded system applications: Embedded systems are designed to do some specific task in contrast to a general purpose computer which is used for multiple tasks. • It makes embedded systems flexible in market.
  • 11.
    11 • Make effectiveuse (due to cost): Many embedded systems more microcontrollers, which have self sufficiency and cost-effectiveness. • Embedded systems are typically far cheaper than general-purpose personal computers. • Interconnection: Once the hardware is decided upon, an interconnection fabric must be devised. • Testing and verification: The increase in complexity combined with a lack of knowledge about individual IP blocks that comes with reuse techniques leads to problems in adequate testing and verification of the complete systems. • Energy management: Efficient metering systems helps in energy conservation.
  • 12.
    Open Source EmbeddedPlatforms 12 ■ Open source platform that can be freely used, changed and shared by anyone. ■ Open source software is made by many people and distributed under licenses that comply with the open source definition. ■ Hardware is also undergoing an open source revolution. The developer provides CAD files to the user. ■ Licensed under CERN or TAPR open h/w license.
  • 13.
    Open Source EmbeddedPlatforms : Examples 13 ■ Arduino ■ Banana Pi ■ BeagleBone Black ■ Panda board ■ OLinuXino
  • 14.
    What is Arduino 14 ■Arduino is a movement, not a microcontroller: ■ Founded by Massimo Banzi and David Cuartielles in 2005 ■ Arduino is an open-source electronics platform based on easy-to-use hardware (uC) and software (IDE). ■ Arduino is open source hardware and software. ■ Hardware based on Microcontroller and Software based on Processing Programming IDE. ■ Arduino was designed for designers who want to incorporate physical computing into their designs without having knowledge of electrical & electronics.
  • 15.
    Why Arduino 15 ■ Easyto use Hardware Platform ■ Ease of programming ■ Ease of Interfacing of Real life peripherals ■ Open source and extensible hardware ■ Open source and extensible software ■ Low Cost ■ Multiplatform environment
  • 16.
    Flavors of ArduinoH/W 16 resented By: Mr. Shridhar Dudam 14
  • 17.
  • 18.
  • 19.
  • 20.
    Features ATmega328/P Microcontroller 8-bitfamily Architecture RISC Flash (Bytes) 32K SRAM (Bytes) 2K EEPROM (Bytes) 1K General Purpose I/O Lines 23 SPI 2 TWI (I2C) 1 USART 1 ADC 10-bit 15kSPS ADC Channels 8 8-bit Timer/ Counters 2 16-bit Timer/ Counters 1 Operating Voltage 1.8V-5.5V PWM Channels 6 Six Sleep Modes Idle ADC Noise Reduction Power-save Power-down Standby Extended standby 20
  • 21.
    Arduino IDE 21 • TheArduino language is based on C/C++. • It links against AVR Libc and allows the use of its functions • Code is case sensitive • Statements are commands and must end with a semi-colon • Comments follow a // or begin with /*
  • 22.
    Arduino IDE :Important Icons 22
  • 23.
    Sketch and Sketchbook 23 ■Programs in Arduino called as sketches ■ Sketches must saved in the directory. ■ Arduino IDE uses the concept of a sketchbook: ■ A standard place to store programs (or sketches). ■ IDE automatically creates directory for the sketchbook. ■ Sketches were saved with a .ino file extension.
  • 24.
    Arduino IDE :Sketch Structure 24
  • 25.
    Arduino Programming Environment 25 ■Arduino uses Object Oriented Programming. ■ Arduino is programmed with C and C++. ■ AllArduino libraries are made using C++ in order to be easily reusable ■ The native library is designedfor a very elementary and global purpose. ■ Arduino programs can be divided in ■ Structure
  • 26.
    Structure (1) 26 ■ Fromglobal conditional control structures to more specific ones. ■ Basic Structure ■ setup() ■ loop() ■ Control Structures (Conditional Statements) ■ if , if...else and switch case ■ for, while and do... while ■ break and continue ■ return ■ goto
  • 27.
    if …. elsestatement 27
  • 28.
  • 29.
    Loop statement :for loop 29 ■ Synta x ■ exampl e
  • 30.
    While loop structure 30 ■Synta x ■ Exampl e
  • 31.
    do … whileloop structure 31 ■ Synta x ■ Exampl e
  • 32.
    Structure : Operators 32 ArithmeticOperators Comparison Operators = (assignment operator) == (equal to) + (addition) != (not equal to) - (subtraction) < (less than) * (multiplication) > (greater than) / (division) <= (less than or equal to) % (modulo) >= (greater than or equal to) ed By: Mr. Shridhar Dudam Bitwise Operators Compound Operators & (bitwise and) ++ (increment) | (bitwise or) -- (decrement) ^ (bitwise xor) += (compound addition) ~ (bitwise not) -= (compound subtraction) << (bitshift left) *= (compound multiplication) >> (bitshift right) /= (compound division) %= (compound modulo) &= (compound bitwise and) |= (compound bitwise or)
  • 33.
    Structure : Operators 33 BooleanOperators Pointer Access Operators && (and) || (or) ! (not) * dereference operator & reference operator
  • 34.
  • 35.
  • 36.
    Values: Constants 36 ■ HIGH| LOW ■ INPUT | OUTPUT | INPUT_PULLUP ■ LED_BUILTIN ■ true | false ■ integer constants ■ floating point constants
  • 37.
    Values : TypeConversion 37 ■ Type conversion is the process that changes an entity data type into another. ■ Type conversion can be implicitly done or explicitly made. ■ Explicit Type Conversion ■ char() ■ byte() ■ int() ■ word() ■ long() ■ float()
  • 38.
    The Scope Concept 38 ■The scope can be defined as a particular property of a variable. ■ A variable can be global and then is visible and usable everywhere in the source code. ■ But a variable can also be local, declared inside a function, for instance, and that is
  • 39.
    Functions (1) 39 ■ Mat h ■Digital I/O ■ pinMode() ■ digitalWrite() ■ digitalRead() ■ Analog I/O ■ analogReference() ■ analogRead() ■ analogWrite() - PWM ■ Due & Zero only ■ analogReadResolutio n() ■ analogWriteResol ution() ■ t an() ■ min() ■ max() ■ abs() ■ constrain() ■ map() ■ pow() ■ sqrt() ■ Trigonomet ry ■ sin() ■ cos()
  • 40.
    Functions (2) ■ AdvancedI/O ■ tone() ■ noTone() ■ shiftOut() ■ shiftIn() ■ pulseIn() ■ Time ■ millis() ■ micros() ■ delay() ■ Characters ■ isAlphaNumeric() ■ isAlpha() ■ isAscii() ■ isWhitespace() ■ isControl() ■ isDigit() ■ isGraph() ■ isLowerCase() ■ isPrintable() ■ isPunct() ■ isSpace() ■ isUpperCase() 40 ■ delayMicrosec onds()
  • 41.
    Functions (3) 41 ■ Random Numbers ■randomSeed() ■ random() ■ Bits and Bytes ■ lowByte() ■ highByte() ■ bitRead() ■ bitWrite() ■ bitSet() ■ bitClear() ■ bit() 4 6