SlideShare une entreprise Scribd logo
1  sur  78
Télécharger pour lire hors ligne
Arduino Course
AHMED SHELBAYA
“
”
Ahmed Shelbaya
FREELANCER ELECTRONIC DESIGNER
Ahmedshelbaya15@gmail.com 01098870453
Part 1
INTRODUCTION TO EMBEDDED SYSTEM
System
What System mean
 is an arrangement in which all its unit
assemble work together according to a set
of rules.
 defined as a way of working, organizing or
doing one or many tasks according to a
fixed plan.
 in a system, all its subcomponents
depend on each other.
Example
Embedded System
Definition
 Embedded means something that is
attached to another thing.
 a computer hardware system having
software embedded in it
 An embedded system can be an
independent system or it can be a part of a
large system.
 An embedded system is a microcontroller or
microprocessor based system which is
designed to perform a specific task.
Example
Embedded system Component
Hardware Software RTOS
Embedded System Characteristics
 Single Function
 Tightly constrained
Size, Speed, Power ,Cost
 Reactive and Real time
 Microprocessors based
 Memory
 Connected
Connected peripherals to connect input and output devices.
 HW-SW systems
Software is used for more features and flexibility. Hardware is used for performance and
security.
Basic Structure of Embedded System
Basic Structure of Embedded system
 Sensor − It measures the physical quantity and converts it to an electrical signal which
can be read by an observer or by any electronic instrument like an A2D converter. A
sensor stores the measured quantity to the memory.
 A-D Converter − An analog-to-digital converter converts the analog signal sent by the
sensor into a digital signal.
 Processor & ASICs − Processors process the data to measure the output and store it
to the memory.
 D-A Converter − A digital-to-analog converter converts the digital data fed by the
processor to analog data
 Actuator − An actuator compares the output given by the D-A Converter to the actual
(expected) output stored in it and stores the approved output.
Microprocessor VS Microcontroller
Microprocessor
 multitasking in nature. Can perform
multiple tasks at a time.
 RAM, ROM, I/O Ports, and Timers can be
added externally and can vary in
numbers.
Microcontroller
 Single task oriented.
 RAM, ROM, I/O Ports, and Timers cannot
be added externally. These components
are to be embedded together on a chip
and are fixed in numbers.
Arduino Environment
Arduino board
• 8-bit microcontroller
• USB programming
interface
• I/O pins
Software IDE
• Compiler
• Debugger
• Simulator
Shields
• Unique functionalities
• Easy to attach
• Good libraries provided
Arduino Board
Microcontroller
ATmega328
ATmega16U2
• Write your code into
• To communication with USB
Operating voltage → 5V
Input Voltage →7-12V
Digital I/O pins → 14 pins → 0:13
Analog input pins → 6 pins → A0:A5
Flash Memory → 32KB
Clock speed → 16MHz
Arduino Pins
 Pins are wires connected to the micro
controller
 Pins are the interface of micro
controller
 Pins voltages are controlled by a
sketch
 Pins voltages can be read by a sketch
 Output pins
• Voltages is determined by sketch
• Other components can be controlled
through outputs
 Input pins
• Input pins are controlled by other
component
• Arduino read the voltage on the pin
allow it to respond to events
Analog Vs Digital
Digital
 Can be only Two Value 0volt or 5Volt
 Arduino Has 14 Digital Input / Output Pins
Analog
 Can be any Value from 0Volt to 5Volt
 Arduino Has 6 Analog Input Pins
Power
 𝑉𝑖𝑛 to connect external voltage source
 GND the Ground of Arduino
 5V Arduino supply you by 5V
 3.3V Arduino supply you by 3.3V
 USB connector “to connect Arduino with
laptop”
 Power jack “to connect external power
source with Arduino
 Rest button “to restart the program”
Software
Firmware
 Low level code support the main
function
 USB interface, power modes , reset
 Come with Arduino
Application code
 We write this code
Arduino IDE
Setup the Arduino IDE
 Download the IDE https://www.arduino.cc/en/Main/Donate
Setup the Arduino IDE
 Install Arduino app on your PC
 Connect the Board to your PC using USB cable
 Install USB and other drivers
 Launch the Arduino app
 Select your Arduino board “Tools >>board>> Arduino UNO
 Select serial port “Tools >>port>>COM’X’”
 Write your code
Sensors
 How bright is it ?
 How loud is it?
 How humid is it?
 How distance is it ?
 Is the button being pressed?
 Is there motion ?
Sensors
• Allow the microcontroller receive info. From the environments
• Perform operation based on the state of environment
• Microcontroller sense voltage only
• Sensors logic must convert an environmental effect into voltage
Actuators
 Devices that cause something to happen
in the physical word
 Visual → LEDs , LCDs
 Audio → Buzzer , Speaker
 Motion → Motors , valves
Actuators
Digital Actuators
• They only control the power
• Even complicated actuators can be
controlled via power
Analog Actuators
• Many actuators need an analog voltage for
complete control
• Arduino can’t generate analog outputs
• DAC will convert digital numbers to analog
voltage
• Most microcontrollers don’t have DAC
• Can by one attached
Part 2
INTRODUCTION TO COMPUTER
PROGRAMMING
Setup () Function
• Use for primary order
• Start by powering Arduino
void setup ()
{
arguments
}
Loop() function
• Work as long as Arduino work
• Start after setup function end
• The main code written in it
void loop()
{
Arguments
}
Basics symbol
Operation
Symbol
Every line of code must ended by it
; “semi Colom”
Group line of code
Every function must be start and ended by it
{ }
Curly bracket
To write comments between it
/*…….*/
Variables
Variables Name Conditions
 A sequence of visible character
 Must start with a non-numerical
character
 No C language keywords
Data Types Size
Variable Scope
Local Variable
Variables that are declared
inside a function or block are
local variables. They can be
used only by the statements that
are inside that function or block
of code.
Formal Parameter
can be declared. In the definition of
function parameters
Global Variables
Global variables are defined outside
of all the functions, usually at the top
of the program.
C – operator
 Arithmetic Operators
 Comparison Operators
 Boolean Operators
 Bitwise Operators
 Compound Operators
Arithmetic Operators
Comparison Operators
Boolean Operators
Bitwise Operators
Compound Operators
Control Statements
 If statements
 If-else Statements
 If-else if – else statement
 Switch statement
If statement
if( expression )
{
Statement 1
}
else
{
statement 2
}
If –else if - else
if( expression1 )
{
Statement 1
}
If else (expression2 )
{
statement 2
}
else
{ statement3 }
Switch statement
switch (expression )
{
case ‘const_expr1’ : stat1
break ;
case ‘const_expr2’ : stat2
break ;
default : stat3
}
,
• Compere each case with
expression and operate the case
equal to expression
• Default → operating when no
case is matching
• Break → use to stop operation
Loop Statements
 For Loop
 While Loop
 Do-while loop
 Nested Loop
 Infinite Loop
For statement
for ( expr1; expr2; expr3; )
{ statement }
 expr1→ initialization
 expr2→ termination
 expr3→ step
While Loop
while (expression)
{
Statements
}
Do-while Loop
Nested Loop
 use one loop inside another loop.
Infinite Loop
Functions
Part 3
ARDUINO C
Pin mode function
• These function allow access to the pins
• Set a pin to act as an INPUT or OUTOUT
pinMode( pin , mode )
Pin
• Is the number of the pin “0:13 for digital
• analog” “A0:A5 for analog pins
Mode
• Is the I/O mode the pin is set to “INPUT” “OUTPUT”
Digital output function
• Assign the state of an output pin
• Assign either LOW or HIGH
digitalWrite(pin , Value)
Value
• HIGH
• LOW
Digital input function
• Returns the state of an input pin
• Returns either LOW or HIGH
digitalRead(pin)
Analog input function
• Returns the state of an analog pin
• Returns an integer number from 0 to 1023
• 0 for 0Volt 1023 for 5Volts
analogRead(pin)
Pulse Width Modulation
 On-Time − Duration of time signal is high.
 Off-Time − Duration of time signal is low.
 Period − It is represented as the sum of
on-time and off-time of PWM signal.
 Duty Cycle − It is represented as the
percentage of time signal that remains on
during the period of the PWM signal.
Analog Output Function
 writes an analog value (PWM wave) to a pin
 this function works on pins 3, 5, 6, 9, 10, and 11.
 Values from 0 to 255
 0 mean Zero Volt
 255 mean 5 Volt
analogWrite(pin,value)
Delay function
• Pauses the program for milliseconds
• Useful for human interaction
 delay(m sec)
Delay Microseconds()
 The same function of normal “delay” but
 Normal delay measure in mille second
 This function measure in micro second
delayMicroseconds(time);
pulse In()
• We use this function to calculate time from Arduino call it to end of code
• Frist argument is the pin number
• Second argument is the pulse level we want to detect
pulseIn (Pin, State);
Communication
serial communication
 Used for communication between the Arduino board and a computer or
other devices.
 All Arduino boards have at least one serial port
 It communicates on digital pins 0 (RX) and 1 (TX) as well as with the
computer via USB.
 Thus, if you use these functions, you cannot also use pins 0 and 1 for
digital input or output.
Serial functions
 Serial . begin(Baud Rate)
 To start communication with other devices
 Sets the data rate in bits per second (baud) for serial data transmission
 Serial . print(Value, Format)
 To show data received from Arduino on serial monitor on your PC .
 Format is optional Parameter [BIN, OCT, HEX, DEC]
 Printed Data shown in the same line
Serial Communication
 Serial.available()
 Get the number of bytes available for reading from the serial port.
 Data Returned stored in Serial Buffer Register
 Serial.read()
 Reads incoming serial data
 Return Data
Part 4
SENSORS AND ACTUATORS
Basic Electronic Component
 LED
 LDR
 Button
 Potentiometer
 Buzzer
LED
 Two terminal “ anode + the long terminal
cathode – the short terminal “
 Current only flow in one direction + to –
 Anode – cathode voltage must be above
threshold
 LEDs have a maximum current limit
 Don’t connect LEDs directly with power
supply
Push button
• Closing switch complete circuit
• Voltage on both terminal is identical when switch is closed
Potentiometer
A potentiometer, informally a pot, is a three-terminal resistor with a sliding or rotating
contact that forms an adjustable voltage divider. If only two terminals are used, one end
and the wiper, it acts as a variable resistor or rheostat.
Light Depended Resistor “ LDR”
• Two terminal device
• Analog sensor
• In darkness resistance increase
• In brightness resistance decrease
Buzzer
• Two input :- signal / ground
• Produces a sound when applying voltage
Most Important Modules
 Liquid Crystal Display (LCD)
 Ultrasonic HC-SR04
 Relay Module
 H-Bridge
 Bluetooth Module HC-05
Liquid Crystal Display
 Has it’s own Library to use with Arduino
 Need variable resistor to control display
contrast
 Use Parallel interface
Ultrasonic
 4 terminal device
• Vcc → 5V
• GND → 0V
• Trig → output
• Echo→ input
 To calculate distance in cm use the
following equation
Time in micro second /58 = distance in cm
Relay Module
 Use to Control High Power Devices
 Digital Control
 NC → Normally Open
 NO → Normally Close
Bluetooth Module
 Use Serial Communication
 TX in Bluetooth connected to RX with
Arduino and Vise Versa
H-Bridge
 Each motor has two control Line
 Can control both direction and speed
 Need external power source
H-bridge truth table
DC-Motors
 Need H-bridge to control
 Never Connect directly with Arduino
Servo Motor
• You can control in it’s angle
• Use PWM to control
• Only 180 degree rotate
Part 5
CIRCUIT DIAGRAMS

Contenu connexe

Tendances

Introduction to FPGA, VHDL
Introduction to FPGA, VHDL  Introduction to FPGA, VHDL
Introduction to FPGA, VHDL Amr Rashed
 
AVR programming - BASICS
AVR programming - BASICSAVR programming - BASICS
AVR programming - BASICSRobotix 2011
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Dr. Pankaj Zope
 
Functional verification techniques EW16 session
Functional verification techniques  EW16 sessionFunctional verification techniques  EW16 session
Functional verification techniques EW16 sessionSameh El-Ashry
 
UVM REF GUIDE (1).pdf
UVM REF GUIDE (1).pdfUVM REF GUIDE (1).pdf
UVM REF GUIDE (1).pdfsauryakumar3
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Aarav Soni
 
ATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part IATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part IVineethMP2
 
8085 microproceesor ppt
8085 microproceesor ppt8085 microproceesor ppt
8085 microproceesor pptRJ Aniket
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the ArduinoWingston
 
8051 microcontroller and embedded system
8051 microcontroller and embedded system8051 microcontroller and embedded system
8051 microcontroller and embedded systemsb108ec
 

Tendances (20)

Introduction to FPGA, VHDL
Introduction to FPGA, VHDL  Introduction to FPGA, VHDL
Introduction to FPGA, VHDL
 
Arduino
ArduinoArduino
Arduino
 
AVR programming - BASICS
AVR programming - BASICSAVR programming - BASICS
AVR programming - BASICS
 
Embedded c
Embedded cEmbedded c
Embedded c
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
Chapter5
Chapter5Chapter5
Chapter5
 
Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming Unit III ARM Interface and ARM Programming
Unit III ARM Interface and ARM Programming
 
Arduino- Serial communication
Arduino-  Serial communicationArduino-  Serial communication
Arduino- Serial communication
 
Functional verification techniques EW16 session
Functional verification techniques  EW16 sessionFunctional verification techniques  EW16 session
Functional verification techniques EW16 session
 
UVM REF GUIDE (1).pdf
UVM REF GUIDE (1).pdfUVM REF GUIDE (1).pdf
UVM REF GUIDE (1).pdf
 
AVR ATmega32
AVR ATmega32AVR ATmega32
AVR ATmega32
 
What is Arduino ?
What is Arduino ?What is Arduino ?
What is Arduino ?
 
Getting started with arduino uno
Getting started with arduino unoGetting started with arduino uno
Getting started with arduino uno
 
Arduino Uno Pin Description
Arduino Uno Pin DescriptionArduino Uno Pin Description
Arduino Uno Pin Description
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
ATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part IATmega32-AVR microcontrollers-Part I
ATmega32-AVR microcontrollers-Part I
 
8085 microproceesor ppt
8085 microproceesor ppt8085 microproceesor ppt
8085 microproceesor ppt
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
Embedded system.ppt
Embedded system.pptEmbedded system.ppt
Embedded system.ppt
 
8051 microcontroller and embedded system
8051 microcontroller and embedded system8051 microcontroller and embedded system
8051 microcontroller and embedded system
 

Similaire à arduinocourse-180308074529 (1).pdf

Similaire à arduinocourse-180308074529 (1).pdf (20)

Arduino_Beginner.pptx
Arduino_Beginner.pptxArduino_Beginner.pptx
Arduino_Beginner.pptx
 
Arduino_Beginner.pptx
Arduino_Beginner.pptxArduino_Beginner.pptx
Arduino_Beginner.pptx
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
introductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdfintroductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdf
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
Introduction to Arduino.pptx
Introduction to Arduino.pptxIntroduction to Arduino.pptx
Introduction to Arduino.pptx
 
Arduino.pptx
Arduino.pptxArduino.pptx
Arduino.pptx
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
ARDUINO Presentation1.pptx
ARDUINO Presentation1.pptxARDUINO Presentation1.pptx
ARDUINO Presentation1.pptx
 
Embedded systems presentation
Embedded systems presentationEmbedded systems presentation
Embedded systems presentation
 
Arduino
ArduinoArduino
Arduino
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 

Dernier

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 

Dernier (20)

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 

arduinocourse-180308074529 (1).pdf

  • 2. “ ” Ahmed Shelbaya FREELANCER ELECTRONIC DESIGNER Ahmedshelbaya15@gmail.com 01098870453
  • 3. Part 1 INTRODUCTION TO EMBEDDED SYSTEM
  • 4. System What System mean  is an arrangement in which all its unit assemble work together according to a set of rules.  defined as a way of working, organizing or doing one or many tasks according to a fixed plan.  in a system, all its subcomponents depend on each other. Example
  • 5. Embedded System Definition  Embedded means something that is attached to another thing.  a computer hardware system having software embedded in it  An embedded system can be an independent system or it can be a part of a large system.  An embedded system is a microcontroller or microprocessor based system which is designed to perform a specific task. Example
  • 7. Embedded System Characteristics  Single Function  Tightly constrained Size, Speed, Power ,Cost  Reactive and Real time  Microprocessors based  Memory  Connected Connected peripherals to connect input and output devices.  HW-SW systems Software is used for more features and flexibility. Hardware is used for performance and security.
  • 8. Basic Structure of Embedded System
  • 9. Basic Structure of Embedded system  Sensor − It measures the physical quantity and converts it to an electrical signal which can be read by an observer or by any electronic instrument like an A2D converter. A sensor stores the measured quantity to the memory.  A-D Converter − An analog-to-digital converter converts the analog signal sent by the sensor into a digital signal.  Processor & ASICs − Processors process the data to measure the output and store it to the memory.  D-A Converter − A digital-to-analog converter converts the digital data fed by the processor to analog data  Actuator − An actuator compares the output given by the D-A Converter to the actual (expected) output stored in it and stores the approved output.
  • 10. Microprocessor VS Microcontroller Microprocessor  multitasking in nature. Can perform multiple tasks at a time.  RAM, ROM, I/O Ports, and Timers can be added externally and can vary in numbers. Microcontroller  Single task oriented.  RAM, ROM, I/O Ports, and Timers cannot be added externally. These components are to be embedded together on a chip and are fixed in numbers.
  • 11. Arduino Environment Arduino board • 8-bit microcontroller • USB programming interface • I/O pins Software IDE • Compiler • Debugger • Simulator Shields • Unique functionalities • Easy to attach • Good libraries provided
  • 13. Microcontroller ATmega328 ATmega16U2 • Write your code into • To communication with USB Operating voltage → 5V Input Voltage →7-12V Digital I/O pins → 14 pins → 0:13 Analog input pins → 6 pins → A0:A5 Flash Memory → 32KB Clock speed → 16MHz
  • 14. Arduino Pins  Pins are wires connected to the micro controller  Pins are the interface of micro controller  Pins voltages are controlled by a sketch  Pins voltages can be read by a sketch  Output pins • Voltages is determined by sketch • Other components can be controlled through outputs  Input pins • Input pins are controlled by other component • Arduino read the voltage on the pin allow it to respond to events
  • 15. Analog Vs Digital Digital  Can be only Two Value 0volt or 5Volt  Arduino Has 14 Digital Input / Output Pins Analog  Can be any Value from 0Volt to 5Volt  Arduino Has 6 Analog Input Pins
  • 16. Power  𝑉𝑖𝑛 to connect external voltage source  GND the Ground of Arduino  5V Arduino supply you by 5V  3.3V Arduino supply you by 3.3V  USB connector “to connect Arduino with laptop”  Power jack “to connect external power source with Arduino  Rest button “to restart the program”
  • 17. Software Firmware  Low level code support the main function  USB interface, power modes , reset  Come with Arduino Application code  We write this code
  • 19. Setup the Arduino IDE  Download the IDE https://www.arduino.cc/en/Main/Donate
  • 20. Setup the Arduino IDE  Install Arduino app on your PC  Connect the Board to your PC using USB cable  Install USB and other drivers  Launch the Arduino app  Select your Arduino board “Tools >>board>> Arduino UNO  Select serial port “Tools >>port>>COM’X’”  Write your code
  • 21. Sensors  How bright is it ?  How loud is it?  How humid is it?  How distance is it ?  Is the button being pressed?  Is there motion ?
  • 22. Sensors • Allow the microcontroller receive info. From the environments • Perform operation based on the state of environment • Microcontroller sense voltage only • Sensors logic must convert an environmental effect into voltage
  • 23. Actuators  Devices that cause something to happen in the physical word  Visual → LEDs , LCDs  Audio → Buzzer , Speaker  Motion → Motors , valves
  • 24. Actuators Digital Actuators • They only control the power • Even complicated actuators can be controlled via power Analog Actuators • Many actuators need an analog voltage for complete control • Arduino can’t generate analog outputs • DAC will convert digital numbers to analog voltage • Most microcontrollers don’t have DAC • Can by one attached
  • 25. Part 2 INTRODUCTION TO COMPUTER PROGRAMMING
  • 26. Setup () Function • Use for primary order • Start by powering Arduino void setup () { arguments }
  • 27. Loop() function • Work as long as Arduino work • Start after setup function end • The main code written in it void loop() { Arguments }
  • 28. Basics symbol Operation Symbol Every line of code must ended by it ; “semi Colom” Group line of code Every function must be start and ended by it { } Curly bracket To write comments between it /*…….*/
  • 29. Variables Variables Name Conditions  A sequence of visible character  Must start with a non-numerical character  No C language keywords Data Types Size
  • 30. Variable Scope Local Variable Variables that are declared inside a function or block are local variables. They can be used only by the statements that are inside that function or block of code. Formal Parameter can be declared. In the definition of function parameters Global Variables Global variables are defined outside of all the functions, usually at the top of the program.
  • 31. C – operator  Arithmetic Operators  Comparison Operators  Boolean Operators  Bitwise Operators  Compound Operators
  • 37. Control Statements  If statements  If-else Statements  If-else if – else statement  Switch statement
  • 38. If statement if( expression ) { Statement 1 } else { statement 2 }
  • 39. If –else if - else if( expression1 ) { Statement 1 } If else (expression2 ) { statement 2 } else { statement3 }
  • 40. Switch statement switch (expression ) { case ‘const_expr1’ : stat1 break ; case ‘const_expr2’ : stat2 break ; default : stat3 } , • Compere each case with expression and operate the case equal to expression • Default → operating when no case is matching • Break → use to stop operation
  • 41. Loop Statements  For Loop  While Loop  Do-while loop  Nested Loop  Infinite Loop
  • 42. For statement for ( expr1; expr2; expr3; ) { statement }  expr1→ initialization  expr2→ termination  expr3→ step
  • 45. Nested Loop  use one loop inside another loop.
  • 49. Pin mode function • These function allow access to the pins • Set a pin to act as an INPUT or OUTOUT pinMode( pin , mode ) Pin • Is the number of the pin “0:13 for digital • analog” “A0:A5 for analog pins Mode • Is the I/O mode the pin is set to “INPUT” “OUTPUT”
  • 50. Digital output function • Assign the state of an output pin • Assign either LOW or HIGH digitalWrite(pin , Value) Value • HIGH • LOW
  • 51. Digital input function • Returns the state of an input pin • Returns either LOW or HIGH digitalRead(pin)
  • 52. Analog input function • Returns the state of an analog pin • Returns an integer number from 0 to 1023 • 0 for 0Volt 1023 for 5Volts analogRead(pin)
  • 53. Pulse Width Modulation  On-Time − Duration of time signal is high.  Off-Time − Duration of time signal is low.  Period − It is represented as the sum of on-time and off-time of PWM signal.  Duty Cycle − It is represented as the percentage of time signal that remains on during the period of the PWM signal.
  • 54. Analog Output Function  writes an analog value (PWM wave) to a pin  this function works on pins 3, 5, 6, 9, 10, and 11.  Values from 0 to 255  0 mean Zero Volt  255 mean 5 Volt analogWrite(pin,value)
  • 55. Delay function • Pauses the program for milliseconds • Useful for human interaction  delay(m sec)
  • 56. Delay Microseconds()  The same function of normal “delay” but  Normal delay measure in mille second  This function measure in micro second delayMicroseconds(time);
  • 57. pulse In() • We use this function to calculate time from Arduino call it to end of code • Frist argument is the pin number • Second argument is the pulse level we want to detect pulseIn (Pin, State);
  • 59. serial communication  Used for communication between the Arduino board and a computer or other devices.  All Arduino boards have at least one serial port  It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB.  Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.
  • 60. Serial functions  Serial . begin(Baud Rate)  To start communication with other devices  Sets the data rate in bits per second (baud) for serial data transmission  Serial . print(Value, Format)  To show data received from Arduino on serial monitor on your PC .  Format is optional Parameter [BIN, OCT, HEX, DEC]  Printed Data shown in the same line
  • 61. Serial Communication  Serial.available()  Get the number of bytes available for reading from the serial port.  Data Returned stored in Serial Buffer Register  Serial.read()  Reads incoming serial data  Return Data
  • 62. Part 4 SENSORS AND ACTUATORS
  • 63. Basic Electronic Component  LED  LDR  Button  Potentiometer  Buzzer
  • 64. LED  Two terminal “ anode + the long terminal cathode – the short terminal “  Current only flow in one direction + to –  Anode – cathode voltage must be above threshold  LEDs have a maximum current limit  Don’t connect LEDs directly with power supply
  • 65. Push button • Closing switch complete circuit • Voltage on both terminal is identical when switch is closed
  • 66. Potentiometer A potentiometer, informally a pot, is a three-terminal resistor with a sliding or rotating contact that forms an adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a variable resistor or rheostat.
  • 67. Light Depended Resistor “ LDR” • Two terminal device • Analog sensor • In darkness resistance increase • In brightness resistance decrease
  • 68. Buzzer • Two input :- signal / ground • Produces a sound when applying voltage
  • 69. Most Important Modules  Liquid Crystal Display (LCD)  Ultrasonic HC-SR04  Relay Module  H-Bridge  Bluetooth Module HC-05
  • 70. Liquid Crystal Display  Has it’s own Library to use with Arduino  Need variable resistor to control display contrast  Use Parallel interface
  • 71. Ultrasonic  4 terminal device • Vcc → 5V • GND → 0V • Trig → output • Echo→ input  To calculate distance in cm use the following equation Time in micro second /58 = distance in cm
  • 72. Relay Module  Use to Control High Power Devices  Digital Control  NC → Normally Open  NO → Normally Close
  • 73. Bluetooth Module  Use Serial Communication  TX in Bluetooth connected to RX with Arduino and Vise Versa
  • 74. H-Bridge  Each motor has two control Line  Can control both direction and speed  Need external power source
  • 76. DC-Motors  Need H-bridge to control  Never Connect directly with Arduino
  • 77. Servo Motor • You can control in it’s angle • Use PWM to control • Only 180 degree rotate