SlideShare a Scribd company logo
1 of 37
Introduction to
Arduino
By: Karim El-Rayes
By: Karim El-Rayes, 2015
What about computers !
We all know that we can use computers to do anything like
process control or data ciphering, but to have a computer we need
a CPU, a main memory unit represented in a RAM module, a
secondary storage element represented in Hard Disk Drive
(HDD), some input devices to give instructions/orders like
keyboard and a mouse, and some other output devices like a
monitor and printer to check the system state, and maybe some
communication devices to communicate with external world like
Ethernet card, USB ports and wireless interface cards (Wi-Fi).
By: Karim El-Rayes, 2015
Main
Memory
(RAM & cache)
I/O interface
module
CPU
Control unit
ALURegisters
Input
devices
Output
devices
Bus
Bus
BIOS
L1 Cache memory
Computers basic architecture
Keyboard Mouse
Monitor
RAM
HDD
Motherboard
CPU
Wi-Fi card
By: Karim El-Rayes, 2015
Is it good enough?
Previously described system is very good and will be
very efficient, featuring a very high computing
capabilities BUT:
1. Big in size, you need a space for such system.
2. Very power hungry system, you can run on small
batteries or solar cell in a rural place.
3. Expensive, let’s try to calculate the prices of Intel
Core2Due processor, 1GB RAM slot, 80GB HDD, a
monitor, a keyboard and finally a mouse !!!
By: Karim El-Rayes, 2015
Microcontroller basic architecture
ROM
RAM
CPU
I/Ointerfacemodule
I/Opins
By: Karim El-Rayes, 2015
Function of….
 ROM: To store the program or the code the developer
write for the μC to be used.
 RAM: the program stored in the ROM is transferred
to the RAM when the μC is turned On.
 CPU: the unit responsible processing the program
uploaded in the RAM transferred from the ROM.
 I/O interface module: responsible for data transfer
between the outside world and the CPU in order to take
action either by input or output data.
By: Karim El-Rayes, 2015
How MCU look like??
By: Karim El-Rayes, 2015
CPU and Memory
CPU
Memory
Address
bus
Data
bus
Clock
With every clock tick
the CPU executes one
instruction, this
instruction can be a data
transfer to memory or
an arithmetic operation
or anything else.
By: Karim El-Rayes, 2015
Microcontroller I/O Modules
ROM
RAM
CPU
I/Opins
ADC
DAC
Timers
RS-232
Serial
interface
PWM
USB or
Ethernet
interface
I/Opins
I/Ointerface
By: Karim El-Rayes, 2015
Timers
 Timers are binary counter that counts clock
ticks and upon overflow some action is taken.
 Mainly “Timer” is used for to control and
monitor timing inside a CPU.
Timer
Clock input
With every clock tick the timer increments,
once it reaches its maximum an overflow
happens and interrupt signal is issued to the
CPU.
Overflow signal
(Interrupt signal)
By: Karim El-Rayes, 2015
Binary Counter: Basic concept
Pulse # Output binary Output decimal
0 (no pulse) 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 10
11 1011 11
12 1100 12
13 1101 13
14 1110 14
15 1111 15By: Karim El-Rayes, 2015
Digital Input / Output
Since our microcontroller is a digital system, our basic
inputs and outputs are 1’s and 0’s, between “3.5v” and
5v” for the logic “1” and “Ground” or “0v” for logic
“0”.
Microcontroller
DigitalInputs
Digitaloutputs
By: Karim El-Rayes, 2015
Analog to Digital converter
Analog to digital converter is an IC responsible of
converting analog signal continuous in amplitude and time
to digital signals (binary numbers), but under certain
conditions, for a PC or an ECU like a microcontroller or a
PLC can understand in order to be processed and stored by
these systems (the PC, ECU or PLC).
Analog to
Digital
Converter
1 1 1 10 0 0
V
t
Analog
signal
Binary
code
By: Karim El-Rayes, 2015
Analog to Digital Conversion
Anti aliasing filter
(low pass filter)
Signal sampling
and hold circuit
Quantization
process
Binary output
buffers
Analog
Input
Binary
output
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
t
V
t
V
t
Analog signal Sampled signal
Quantizing sampled signal
By: Karim El-Rayes, 2015
Pulse Width Modulation (PWM)
This method is based
on that the motor
speed is affected on
the input pulse
durations, as duration
of the supplied
voltage increase the
speed increase and
vice versa.
By: Karim El-Rayes, 2015
PWM (cont.)
 The speed of the motor using PWM system is determined
using a simple Methodology: which is the pulse duration
percentage ratio to the whole duration is equivalent to the
same ratio of the supplied voltage to the motor to the main
voltage supply.
 Example: if a motor is supplied with 10 volts and
the PWM circuit has an output pulse duration 10% from the
whole pulse period then the output voltage is 10% the main
supply voltage = 10% x 10 volts = 1 volt.
This mean that the motor is actually supplied with only 1 volt.
 PWM is a relation between the average voltage that will be
supplied to the motor and the pulse duration.
By: Karim El-Rayes, 2015
Serial vs. parallel transmission
0
0
0
1
1
1 1 1 10 0 0
Parallel data lines
(multi-parallel lines for
data transmission, bits
are sent parallel in the
same time)
Serial data line (single data line
used in transmission bit by bit at a
time)
Parallel data
transmission
Serial data transmission
By: Karim El-Rayes, 2015
Serial Communications Interface RS-232
PC legacy 9- pin serial port, which
is also known as RS-232 interface
was one of the most famous serial
interfaces introduced in both home
and industrial computer in the last
35 years, basically was introduced
with modems but later became
widely used in various
applications.
By: Karim El-Rayes, 2015
Transmission Scheme
As shown above RS-232 send/receive protocol consists of 10
bits, 8-bits (1 byte) for data and one start of frame bit and
another bit for the end of frame in order the receiver/transmitter
device understand when data starts and ends.
0 1 2 3 4 5 6 7
Start
bit
Stop
bit
Logic 1
Logic 0
Data sent and/or received
By: Karim El-Rayes, 2015
Building A Control System
Electronic
Control Unit
Actuator
(Motor, valve)
Sensor
Driving
circuits
Feedback Signal
Input
(or set point)
Controller Plant
Feedback
Output
By: Karim El-Rayes, 2015
Going Practical:
How we can program a microcontroller
 You can program it using “C” or Assembly languages (C for
sure easier).
 You first develop your application on PC then after compilation
of your application code we download it to the microcontroller
through special device called “Programmer”.
programmer
By: Karim El-Rayes, 2015
Arduino Uno
Reset switch
USB port
Atmel
microcontroller
General Purpose Inputs/Outputs
(Digital Inputs/Outputs or Analog Inputs)
Digital Inputs/Outputs
By: Karim El-Rayes, 2015
Notes on Arduino Uno Board
• General Purpose Inputs/Outputs are the input & output
interface pins between the Arduino board and outside world.
• Any pin can be configured as either digital input or digital
output.
• The output of digital pins is either 1 (+5v) or 0 (0v).
• Some pins can be configured to be “Analog Inputs”, i.e. you
can input analog signals on these pins.
• Analog signal: they can take any value between 0v and +5v,
the Arduino board converts this analog voltage value to a
number, such pins are commonly used with sensors.
By: Karim El-Rayes, 2015
Introduction to Arduino Syntax
 Coding style.
 Data types.
 I/O: digital read/write, analog read/write.
 Serial interface.
 If-else.
 For loops.
By: Karim El-Rayes, 2015
Arduino Coding Style
#include  Header files (optional)
void setup()  setup() function
{
//Setting up Arduino module to be used
}
Void loop()  loop() function
{
//your application code
//This function will keep repeating forever
}
MyFunction()  Other user defined functions
{
//Other functions (optional)
}
By: Karim El-Rayes, 2015
Basic Data Types
Data type Description Size (in bits)
Char Signed character 8
unsigned char Unsigned character 8
Int Signed integer 32
unsigned int Unsigned integer 32
float Floating number
(Decimal/real number)
single precision
32
bool Boolean number (binary,
i.e. either true or false)
8
By: Karim El-Rayes, 2015
Declaring a variable
 char letter = ‘a’;  char type variable.
 int Num = 0;  int type variable.
 float MyFloatNum = 1.2;  float type variable.
 double MyFloatNum = 1.2;  double type variable.
 bool MyBoolVariable = false;  bool type variable.
By: Karim El-Rayes, 2015
Arrays
Array is a list of variables of the same type, instead of
declaring every variable separately they are declared in the
form list or “Array”.
Example:
int Numbers[10];  Array of 10 integers.
char MyArray[20];  Array of 20 character
Note: a string in C is just an array of characters.
By: Karim El-Rayes, 2015
Digital Write
 Syntax:
digitalWrite(pin, value);
pin: designated digital I/O pin.
value: HIGH (1) or LOW (0);
 Example:
digitalWrite(5, HIGH); //Write “1” to pin 5
digitalWrite(3, LOW); //Write “0” to pin 3
By: Karim El-Rayes, 2015
Digital Read
 Syntax:
digitalRead(pin);
pin: designated digital I/O pin.
 Example:
bool PinValue;
PinValue = digitalRead(9);
//Read digital pin 9 and store the value in variable
//“PinValue”
By: Karim El-Rayes, 2015
Example
void setup()
{
//Configure pin first as either input or output
pinMode(13, OUTPUT); // sets the digital pin as output
}
void loop()
{
digitalWrite(13, HIGH); // sets pin 13 to 1
delay(1000); // waits for a second
digitalWrite(13, LOW); // sets pin 13 to 0
delay(1000); // waits for a second
}
By: Karim El-Rayes, 2015
Analog Read
 Syntax:
analogRead(pin);
Pin: designated analog input pin, analog pin names start
with “A” e.g. A3, A5…
 Example:
int AnalogValue;
value = analogRead(A5);
//Read analog pin A5 and store the value in
//variable “AnalogValue”
By: Karim El-Rayes, 2015
Analog Write (PWM)
 Syntax:
analogWrite(pin, value);
pin: PWM designated pin.
Value: PWM duty cycle value, has to be between 0-255.
 Example:
analogWrite(7, 125);
By: Karim El-Rayes, 2015
Serial Output
void setup()
{
// Configure serial first: open the serial port at 9600 bps:
Serial.begin(9600);
}
void loop()
{
// read the analog input on pin 0:
analogValue = analogRead(0);
// print it out in many formats:
Serial.println(analogValue); // print as an ASCII-encoded decimal
delay(1000); //delay for 1 second
}
By: Karim El-Rayes, 2015
“if – else” statement
“if-else” is a conditional statement to check if a condition is true or not:
if(i == 1)
{
//do something
}
else if(i == 2)
{
//do something else
}
else
{
//do something else if the previous conditions aren’t true
}
By: Karim El-Rayes, 2015
Loops: “for” Loop
To repeat some action(s) several times:
for (initial condition; stop condition; increment/decrement)
{ //start
//do something here
} //end
Example:
for(i = 0;i<10;i++)
{
//Your code here
}
“trying for loop” will be printed on screen 10 times
By: Karim El-Rayes, 2015
List of acronyms & abbreviations
 ADC: Analogue to Digital Converter.
 ALU: Arithmetic & Logical Unit.
 BIOS: Basic Input/Output System
 CPU: Central Processing Unit.
 DAC: Digital to Analogue Converter.
 GPM (μP): General Purpose
Microprocessor.
 I/O: Input/Output.
 MCU (μC): Microcontroller unit.
 PWM: Pulse Width Modulation.
 RAM: Random Access Memory.
 ROM: Read Only Memory.
Acronym of Serial Interfaces
 UART: Universal Asynchronous
Receiver Transmitter.
 SPI: Serial Peripheral Interface.
 I2C: Inter-Integrated Circuit
 USB: Universal Serial Bus.
By: Karim El-Rayes, 2015

More Related Content

What's hot

How to measure frequency and duty cycle using arduino
How to measure frequency and duty cycle using  arduinoHow to measure frequency and duty cycle using  arduino
How to measure frequency and duty cycle using arduinoSagar Srivastav
 
SENSORS AND BLUETOOTH COMMUNICATION
SENSORS AND BLUETOOTH COMMUNICATIONSENSORS AND BLUETOOTH COMMUNICATION
SENSORS AND BLUETOOTH COMMUNICATIONsoma saikiran
 
02 General Purpose Input - Output on the Arduino
02   General Purpose Input -  Output on the Arduino02   General Purpose Input -  Output on the Arduino
02 General Purpose Input - Output on the ArduinoWingston
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to ArduinoQtechknow
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (Dhruwank Vankawala
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينوsalih mahmod
 
Introduction to MPLAB IDE
Introduction to MPLAB IDEIntroduction to MPLAB IDE
Introduction to MPLAB IDEKarim El-Rayes
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing Raghav Shetty
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduinoAhmed Sakr
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR FundamentalsVinit Vyas
 
An Introduction to Robotics and Embedded System
An Introduction to Robotics and Embedded SystemAn Introduction to Robotics and Embedded System
An Introduction to Robotics and Embedded SystemPeeyush Sahu CAPM®
 
Interrupts at AVR
Interrupts at AVRInterrupts at AVR
Interrupts at AVRHamdy Fouad
 
Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2DIPAN GHOSH
 
Interfacing with Atmega 16
Interfacing with Atmega 16Interfacing with Atmega 16
Interfacing with Atmega 16Ramadan Ramadan
 
Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Mahmoud Sadat
 
Developing an avr microcontroller system
Developing an avr microcontroller systemDeveloping an avr microcontroller system
Developing an avr microcontroller systemnugnugmacmac
 

What's hot (20)

How to measure frequency and duty cycle using arduino
How to measure frequency and duty cycle using  arduinoHow to measure frequency and duty cycle using  arduino
How to measure frequency and duty cycle using arduino
 
SENSORS AND BLUETOOTH COMMUNICATION
SENSORS AND BLUETOOTH COMMUNICATIONSENSORS AND BLUETOOTH COMMUNICATION
SENSORS AND BLUETOOTH COMMUNICATION
 
02 General Purpose Input - Output on the Arduino
02   General Purpose Input -  Output on the Arduino02   General Purpose Input -  Output on the Arduino
02 General Purpose Input - Output on the Arduino
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (
 
Visitor counter
Visitor counterVisitor counter
Visitor counter
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Introduction to MPLAB IDE
Introduction to MPLAB IDEIntroduction to MPLAB IDE
Introduction to MPLAB IDE
 
AVR Micro controller Interfacing
AVR Micro controller Interfacing AVR Micro controller Interfacing
AVR Micro controller Interfacing
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
AVR Fundamentals
AVR FundamentalsAVR Fundamentals
AVR Fundamentals
 
An Introduction to Robotics and Embedded System
An Introduction to Robotics and Embedded SystemAn Introduction to Robotics and Embedded System
An Introduction to Robotics and Embedded System
 
ATmega 16
ATmega 16ATmega 16
ATmega 16
 
Interrupts at AVR
Interrupts at AVRInterrupts at AVR
Interrupts at AVR
 
Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2Bidirectional Visitor Counter with Automatic ON-OFF Switch2
Bidirectional Visitor Counter with Automatic ON-OFF Switch2
 
Interfacing with Atmega 16
Interfacing with Atmega 16Interfacing with Atmega 16
Interfacing with Atmega 16
 
Presentation
PresentationPresentation
Presentation
 
Introduction to AVR Microcontroller
Introduction to AVR Microcontroller Introduction to AVR Microcontroller
Introduction to AVR Microcontroller
 
Developing an avr microcontroller system
Developing an avr microcontroller systemDeveloping an avr microcontroller system
Developing an avr microcontroller system
 

Viewers also liked

Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoEoin Brazil
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduinoavikdhupar
 
Community Based Ground Water Management field observations
Community Based Ground Water Management field observationsCommunity Based Ground Water Management field observations
Community Based Ground Water Management field observationsSai Bhaskar Reddy Nakka
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
Build your own electronics lab
Build your own electronics labBuild your own electronics lab
Build your own electronics labKarim El-Rayes
 
2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshoptrygvis
 
RFID based design for vehicle location system
RFID based design for vehicle location systemRFID based design for vehicle location system
RFID based design for vehicle location systemmsc84
 
Electronic Measurement Beginner's Guide
Electronic Measurement Beginner's GuideElectronic Measurement Beginner's Guide
Electronic Measurement Beginner's GuideKarim El-Rayes
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
The arduino uno is a microcontroller board based on the
The arduino uno is a microcontroller board based on theThe arduino uno is a microcontroller board based on the
The arduino uno is a microcontroller board based on thePramod Kumar
 
20150826 Introduction to Arduino
20150826 Introduction to Arduino20150826 Introduction to Arduino
20150826 Introduction to ArduinoSyuan Wang
 
Getting Started with Arduino
Getting Started with ArduinoGetting Started with Arduino
Getting Started with ArduinoWee Keat Chin
 
DIY! Introduction to Arduino (Development Board)
DIY! Introduction to Arduino (Development Board) DIY! Introduction to Arduino (Development Board)
DIY! Introduction to Arduino (Development Board) Dignitas Digital Pvt. Ltd.
 
Geo 3 water filter test results hamali basti Hyderabad
Geo 3 water filter test results hamali basti HyderabadGeo 3 water filter test results hamali basti Hyderabad
Geo 3 water filter test results hamali basti HyderabadSai Bhaskar Reddy Nakka
 

Viewers also liked (20)

Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
 
Arduino
ArduinoArduino
Arduino
 
An introdution to MPLAB
An introdution to MPLABAn introdution to MPLAB
An introdution to MPLAB
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Mplab user guide_51519c
Mplab user guide_51519cMplab user guide_51519c
Mplab user guide_51519c
 
Biochar Bathrooms
Biochar BathroomsBiochar Bathrooms
Biochar Bathrooms
 
Community Based Ground Water Management field observations
Community Based Ground Water Management field observationsCommunity Based Ground Water Management field observations
Community Based Ground Water Management field observations
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Build your own electronics lab
Build your own electronics labBuild your own electronics lab
Build your own electronics lab
 
2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop
 
RFID based design for vehicle location system
RFID based design for vehicle location systemRFID based design for vehicle location system
RFID based design for vehicle location system
 
Electronic Measurement Beginner's Guide
Electronic Measurement Beginner's GuideElectronic Measurement Beginner's Guide
Electronic Measurement Beginner's Guide
 
Capacity Building and Sustainability
Capacity Building and SustainabilityCapacity Building and Sustainability
Capacity Building and Sustainability
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Community Based Ground Water Management
Community Based Ground Water ManagementCommunity Based Ground Water Management
Community Based Ground Water Management
 
The arduino uno is a microcontroller board based on the
The arduino uno is a microcontroller board based on theThe arduino uno is a microcontroller board based on the
The arduino uno is a microcontroller board based on the
 
20150826 Introduction to Arduino
20150826 Introduction to Arduino20150826 Introduction to Arduino
20150826 Introduction to Arduino
 
Getting Started with Arduino
Getting Started with ArduinoGetting Started with Arduino
Getting Started with Arduino
 
DIY! Introduction to Arduino (Development Board)
DIY! Introduction to Arduino (Development Board) DIY! Introduction to Arduino (Development Board)
DIY! Introduction to Arduino (Development Board)
 
Geo 3 water filter test results hamali basti Hyderabad
Geo 3 water filter test results hamali basti HyderabadGeo 3 water filter test results hamali basti Hyderabad
Geo 3 water filter test results hamali basti Hyderabad
 

Similar to Introduction to Arduino

Similar to Introduction to Arduino (20)

Embedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower BotEmbedded Application : An Autonomous Robot or Line Follower Bot
Embedded Application : An Autonomous Robot or Line Follower Bot
 
Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
The Basics of programming
The Basics of programmingThe Basics of programming
The Basics of programming
 
Embeded system by Mitesh Kumar
Embeded system by Mitesh KumarEmbeded system by Mitesh Kumar
Embeded system by Mitesh Kumar
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
how to generate sms
how to generate smshow to generate sms
how to generate sms
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 
Picmico
PicmicoPicmico
Picmico
 
Arduino course
Arduino courseArduino course
Arduino course
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
 
car wash system
car wash systemcar wash system
car wash system
 
Final Presentation
Final PresentationFinal Presentation
Final Presentation
 
Best-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbaiBest-embedded-corporate-training-in-mumbai
Best-embedded-corporate-training-in-mumbai
 
Port Interfacing
Port InterfacingPort Interfacing
Port Interfacing
 
MICROCONTROLLER.pptx
MICROCONTROLLER.pptxMICROCONTROLLER.pptx
MICROCONTROLLER.pptx
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
Arduino
ArduinoArduino
Arduino
 
Embedded system 8051 Microcontroller
Embedded system 8051 MicrocontrollerEmbedded system 8051 Microcontroller
Embedded system 8051 Microcontroller
 
Assignment
AssignmentAssignment
Assignment
 

Recently uploaded

萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程1k98h0e1
 
Dubai Call Girls O525547819 Spring Break Fast Call Girls Dubai
Dubai Call Girls O525547819 Spring Break Fast Call Girls DubaiDubai Call Girls O525547819 Spring Break Fast Call Girls Dubai
Dubai Call Girls O525547819 Spring Break Fast Call Girls Dubaikojalkojal131
 
existing product research b2 Sunderland Culture
existing product research b2 Sunderland Cultureexisting product research b2 Sunderland Culture
existing product research b2 Sunderland CultureChloeMeadows1
 
Presentation.pptxjnfoigneoifnvoeifnvklfnvf
Presentation.pptxjnfoigneoifnvoeifnvklfnvfPresentation.pptxjnfoigneoifnvoeifnvklfnvf
Presentation.pptxjnfoigneoifnvoeifnvklfnvfchapmanellie27
 
Vip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts ServiceVip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts Serviceankitnayak356677
 
Real Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCR
Real Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCRReal Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCR
Real Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCRdollysharma2066
 
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一ss ss
 
(办理学位证)韩国汉阳大学毕业证成绩单原版一比一
(办理学位证)韩国汉阳大学毕业证成绩单原版一比一(办理学位证)韩国汉阳大学毕业证成绩单原版一比一
(办理学位证)韩国汉阳大学毕业证成绩单原版一比一C SSS
 
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...nagunakhan
 
NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...
NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...
NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...Amil baba
 
(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一C SSS
 
威廉玛丽学院毕业证学位证成绩单-安全学历认证
威廉玛丽学院毕业证学位证成绩单-安全学历认证威廉玛丽学院毕业证学位证成绩单-安全学历认证
威廉玛丽学院毕业证学位证成绩单-安全学历认证kbdhl05e
 
Call Girls In Munirka>༒9599632723 Incall_OutCall Available
Call Girls In Munirka>༒9599632723 Incall_OutCall AvailableCall Girls In Munirka>༒9599632723 Incall_OutCall Available
Call Girls In Munirka>༒9599632723 Incall_OutCall AvailableCall Girls in Delhi
 
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一Fi sss
 
毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree z zzz
 
定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一ss ss
 
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》o8wvnojp
 

Recently uploaded (20)

CIVIL ENGINEERING
CIVIL ENGINEERINGCIVIL ENGINEERING
CIVIL ENGINEERING
 
萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程萨斯喀彻温大学毕业证学位证成绩单-购买流程
萨斯喀彻温大学毕业证学位证成绩单-购买流程
 
Dubai Call Girls O525547819 Spring Break Fast Call Girls Dubai
Dubai Call Girls O525547819 Spring Break Fast Call Girls DubaiDubai Call Girls O525547819 Spring Break Fast Call Girls Dubai
Dubai Call Girls O525547819 Spring Break Fast Call Girls Dubai
 
existing product research b2 Sunderland Culture
existing product research b2 Sunderland Cultureexisting product research b2 Sunderland Culture
existing product research b2 Sunderland Culture
 
Presentation.pptxjnfoigneoifnvoeifnvklfnvf
Presentation.pptxjnfoigneoifnvoeifnvklfnvfPresentation.pptxjnfoigneoifnvoeifnvklfnvf
Presentation.pptxjnfoigneoifnvoeifnvklfnvf
 
Vip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts ServiceVip Noida Escorts 9873940964 Greater Noida Escorts Service
Vip Noida Escorts 9873940964 Greater Noida Escorts Service
 
Real Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCR
Real Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCRReal Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCR
Real Sure (Call Girl) in I.G.I. Airport 8377087607 Hot Call Girls In Delhi NCR
 
young call girls in Gtb Nagar,🔝 9953056974 🔝 escort Service
young call girls in Gtb Nagar,🔝 9953056974 🔝 escort Serviceyoung call girls in Gtb Nagar,🔝 9953056974 🔝 escort Service
young call girls in Gtb Nagar,🔝 9953056974 🔝 escort Service
 
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
定制(UI学位证)爱达荷大学毕业证成绩单原版一比一
 
(办理学位证)韩国汉阳大学毕业证成绩单原版一比一
(办理学位证)韩国汉阳大学毕业证成绩单原版一比一(办理学位证)韩国汉阳大学毕业证成绩单原版一比一
(办理学位证)韩国汉阳大学毕业证成绩单原版一比一
 
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
Slim Call Girls Service Badshah Nagar * 9548273370 Naughty Call Girls Service...
 
NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...
NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...
NO1 Qualified Best Black Magic Specialist Near Me Spiritual Healer Powerful L...
 
(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一(办理学位证)多伦多大学毕业证成绩单原版一比一
(办理学位证)多伦多大学毕业证成绩单原版一比一
 
威廉玛丽学院毕业证学位证成绩单-安全学历认证
威廉玛丽学院毕业证学位证成绩单-安全学历认证威廉玛丽学院毕业证学位证成绩单-安全学历认证
威廉玛丽学院毕业证学位证成绩单-安全学历认证
 
Call Girls In Munirka>༒9599632723 Incall_OutCall Available
Call Girls In Munirka>༒9599632723 Incall_OutCall AvailableCall Girls In Munirka>༒9599632723 Incall_OutCall Available
Call Girls In Munirka>༒9599632723 Incall_OutCall Available
 
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
(办理学位证)加州州立大学北岭分校毕业证成绩单原版一比一
 
Low rate Call girls in Delhi Justdial | 9953330565
Low rate Call girls in Delhi Justdial | 9953330565Low rate Call girls in Delhi Justdial | 9953330565
Low rate Call girls in Delhi Justdial | 9953330565
 
毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree加拿大瑞尔森大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一定制(USF学位证)旧金山大学毕业证成绩单原版一比一
定制(USF学位证)旧金山大学毕业证成绩单原版一比一
 
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
《1:1仿制麦克马斯特大学毕业证|订制麦克马斯特大学文凭》
 

Introduction to Arduino

  • 1. Introduction to Arduino By: Karim El-Rayes By: Karim El-Rayes, 2015
  • 2. What about computers ! We all know that we can use computers to do anything like process control or data ciphering, but to have a computer we need a CPU, a main memory unit represented in a RAM module, a secondary storage element represented in Hard Disk Drive (HDD), some input devices to give instructions/orders like keyboard and a mouse, and some other output devices like a monitor and printer to check the system state, and maybe some communication devices to communicate with external world like Ethernet card, USB ports and wireless interface cards (Wi-Fi). By: Karim El-Rayes, 2015
  • 3. Main Memory (RAM & cache) I/O interface module CPU Control unit ALURegisters Input devices Output devices Bus Bus BIOS L1 Cache memory Computers basic architecture Keyboard Mouse Monitor RAM HDD Motherboard CPU Wi-Fi card By: Karim El-Rayes, 2015
  • 4. Is it good enough? Previously described system is very good and will be very efficient, featuring a very high computing capabilities BUT: 1. Big in size, you need a space for such system. 2. Very power hungry system, you can run on small batteries or solar cell in a rural place. 3. Expensive, let’s try to calculate the prices of Intel Core2Due processor, 1GB RAM slot, 80GB HDD, a monitor, a keyboard and finally a mouse !!! By: Karim El-Rayes, 2015
  • 6. Function of….  ROM: To store the program or the code the developer write for the μC to be used.  RAM: the program stored in the ROM is transferred to the RAM when the μC is turned On.  CPU: the unit responsible processing the program uploaded in the RAM transferred from the ROM.  I/O interface module: responsible for data transfer between the outside world and the CPU in order to take action either by input or output data. By: Karim El-Rayes, 2015
  • 7. How MCU look like?? By: Karim El-Rayes, 2015
  • 8. CPU and Memory CPU Memory Address bus Data bus Clock With every clock tick the CPU executes one instruction, this instruction can be a data transfer to memory or an arithmetic operation or anything else. By: Karim El-Rayes, 2015
  • 9. Microcontroller I/O Modules ROM RAM CPU I/Opins ADC DAC Timers RS-232 Serial interface PWM USB or Ethernet interface I/Opins I/Ointerface By: Karim El-Rayes, 2015
  • 10. Timers  Timers are binary counter that counts clock ticks and upon overflow some action is taken.  Mainly “Timer” is used for to control and monitor timing inside a CPU. Timer Clock input With every clock tick the timer increments, once it reaches its maximum an overflow happens and interrupt signal is issued to the CPU. Overflow signal (Interrupt signal) By: Karim El-Rayes, 2015
  • 11. Binary Counter: Basic concept Pulse # Output binary Output decimal 0 (no pulse) 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 10 11 1011 11 12 1100 12 13 1101 13 14 1110 14 15 1111 15By: Karim El-Rayes, 2015
  • 12. Digital Input / Output Since our microcontroller is a digital system, our basic inputs and outputs are 1’s and 0’s, between “3.5v” and 5v” for the logic “1” and “Ground” or “0v” for logic “0”. Microcontroller DigitalInputs Digitaloutputs By: Karim El-Rayes, 2015
  • 13. Analog to Digital converter Analog to digital converter is an IC responsible of converting analog signal continuous in amplitude and time to digital signals (binary numbers), but under certain conditions, for a PC or an ECU like a microcontroller or a PLC can understand in order to be processed and stored by these systems (the PC, ECU or PLC). Analog to Digital Converter 1 1 1 10 0 0 V t Analog signal Binary code By: Karim El-Rayes, 2015
  • 14. Analog to Digital Conversion Anti aliasing filter (low pass filter) Signal sampling and hold circuit Quantization process Binary output buffers Analog Input Binary output 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 t V t V t Analog signal Sampled signal Quantizing sampled signal By: Karim El-Rayes, 2015
  • 15. Pulse Width Modulation (PWM) This method is based on that the motor speed is affected on the input pulse durations, as duration of the supplied voltage increase the speed increase and vice versa. By: Karim El-Rayes, 2015
  • 16. PWM (cont.)  The speed of the motor using PWM system is determined using a simple Methodology: which is the pulse duration percentage ratio to the whole duration is equivalent to the same ratio of the supplied voltage to the motor to the main voltage supply.  Example: if a motor is supplied with 10 volts and the PWM circuit has an output pulse duration 10% from the whole pulse period then the output voltage is 10% the main supply voltage = 10% x 10 volts = 1 volt. This mean that the motor is actually supplied with only 1 volt.  PWM is a relation between the average voltage that will be supplied to the motor and the pulse duration. By: Karim El-Rayes, 2015
  • 17. Serial vs. parallel transmission 0 0 0 1 1 1 1 1 10 0 0 Parallel data lines (multi-parallel lines for data transmission, bits are sent parallel in the same time) Serial data line (single data line used in transmission bit by bit at a time) Parallel data transmission Serial data transmission By: Karim El-Rayes, 2015
  • 18. Serial Communications Interface RS-232 PC legacy 9- pin serial port, which is also known as RS-232 interface was one of the most famous serial interfaces introduced in both home and industrial computer in the last 35 years, basically was introduced with modems but later became widely used in various applications. By: Karim El-Rayes, 2015
  • 19. Transmission Scheme As shown above RS-232 send/receive protocol consists of 10 bits, 8-bits (1 byte) for data and one start of frame bit and another bit for the end of frame in order the receiver/transmitter device understand when data starts and ends. 0 1 2 3 4 5 6 7 Start bit Stop bit Logic 1 Logic 0 Data sent and/or received By: Karim El-Rayes, 2015
  • 20. Building A Control System Electronic Control Unit Actuator (Motor, valve) Sensor Driving circuits Feedback Signal Input (or set point) Controller Plant Feedback Output By: Karim El-Rayes, 2015
  • 21. Going Practical: How we can program a microcontroller  You can program it using “C” or Assembly languages (C for sure easier).  You first develop your application on PC then after compilation of your application code we download it to the microcontroller through special device called “Programmer”. programmer By: Karim El-Rayes, 2015
  • 22. Arduino Uno Reset switch USB port Atmel microcontroller General Purpose Inputs/Outputs (Digital Inputs/Outputs or Analog Inputs) Digital Inputs/Outputs By: Karim El-Rayes, 2015
  • 23. Notes on Arduino Uno Board • General Purpose Inputs/Outputs are the input & output interface pins between the Arduino board and outside world. • Any pin can be configured as either digital input or digital output. • The output of digital pins is either 1 (+5v) or 0 (0v). • Some pins can be configured to be “Analog Inputs”, i.e. you can input analog signals on these pins. • Analog signal: they can take any value between 0v and +5v, the Arduino board converts this analog voltage value to a number, such pins are commonly used with sensors. By: Karim El-Rayes, 2015
  • 24. Introduction to Arduino Syntax  Coding style.  Data types.  I/O: digital read/write, analog read/write.  Serial interface.  If-else.  For loops. By: Karim El-Rayes, 2015
  • 25. Arduino Coding Style #include  Header files (optional) void setup()  setup() function { //Setting up Arduino module to be used } Void loop()  loop() function { //your application code //This function will keep repeating forever } MyFunction()  Other user defined functions { //Other functions (optional) } By: Karim El-Rayes, 2015
  • 26. Basic Data Types Data type Description Size (in bits) Char Signed character 8 unsigned char Unsigned character 8 Int Signed integer 32 unsigned int Unsigned integer 32 float Floating number (Decimal/real number) single precision 32 bool Boolean number (binary, i.e. either true or false) 8 By: Karim El-Rayes, 2015
  • 27. Declaring a variable  char letter = ‘a’;  char type variable.  int Num = 0;  int type variable.  float MyFloatNum = 1.2;  float type variable.  double MyFloatNum = 1.2;  double type variable.  bool MyBoolVariable = false;  bool type variable. By: Karim El-Rayes, 2015
  • 28. Arrays Array is a list of variables of the same type, instead of declaring every variable separately they are declared in the form list or “Array”. Example: int Numbers[10];  Array of 10 integers. char MyArray[20];  Array of 20 character Note: a string in C is just an array of characters. By: Karim El-Rayes, 2015
  • 29. Digital Write  Syntax: digitalWrite(pin, value); pin: designated digital I/O pin. value: HIGH (1) or LOW (0);  Example: digitalWrite(5, HIGH); //Write “1” to pin 5 digitalWrite(3, LOW); //Write “0” to pin 3 By: Karim El-Rayes, 2015
  • 30. Digital Read  Syntax: digitalRead(pin); pin: designated digital I/O pin.  Example: bool PinValue; PinValue = digitalRead(9); //Read digital pin 9 and store the value in variable //“PinValue” By: Karim El-Rayes, 2015
  • 31. Example void setup() { //Configure pin first as either input or output pinMode(13, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(13, HIGH); // sets pin 13 to 1 delay(1000); // waits for a second digitalWrite(13, LOW); // sets pin 13 to 0 delay(1000); // waits for a second } By: Karim El-Rayes, 2015
  • 32. Analog Read  Syntax: analogRead(pin); Pin: designated analog input pin, analog pin names start with “A” e.g. A3, A5…  Example: int AnalogValue; value = analogRead(A5); //Read analog pin A5 and store the value in //variable “AnalogValue” By: Karim El-Rayes, 2015
  • 33. Analog Write (PWM)  Syntax: analogWrite(pin, value); pin: PWM designated pin. Value: PWM duty cycle value, has to be between 0-255.  Example: analogWrite(7, 125); By: Karim El-Rayes, 2015
  • 34. Serial Output void setup() { // Configure serial first: open the serial port at 9600 bps: Serial.begin(9600); } void loop() { // read the analog input on pin 0: analogValue = analogRead(0); // print it out in many formats: Serial.println(analogValue); // print as an ASCII-encoded decimal delay(1000); //delay for 1 second } By: Karim El-Rayes, 2015
  • 35. “if – else” statement “if-else” is a conditional statement to check if a condition is true or not: if(i == 1) { //do something } else if(i == 2) { //do something else } else { //do something else if the previous conditions aren’t true } By: Karim El-Rayes, 2015
  • 36. Loops: “for” Loop To repeat some action(s) several times: for (initial condition; stop condition; increment/decrement) { //start //do something here } //end Example: for(i = 0;i<10;i++) { //Your code here } “trying for loop” will be printed on screen 10 times By: Karim El-Rayes, 2015
  • 37. List of acronyms & abbreviations  ADC: Analogue to Digital Converter.  ALU: Arithmetic & Logical Unit.  BIOS: Basic Input/Output System  CPU: Central Processing Unit.  DAC: Digital to Analogue Converter.  GPM (μP): General Purpose Microprocessor.  I/O: Input/Output.  MCU (μC): Microcontroller unit.  PWM: Pulse Width Modulation.  RAM: Random Access Memory.  ROM: Read Only Memory. Acronym of Serial Interfaces  UART: Universal Asynchronous Receiver Transmitter.  SPI: Serial Peripheral Interface.  I2C: Inter-Integrated Circuit  USB: Universal Serial Bus. By: Karim El-Rayes, 2015