You are on page 1of 108

Simplify

Arduino

Arduino

Simplify Arduino

Simplify Arduino

Simplify Arduino

GPL
V3
.

,
:

abdallah.reload92@gmail.com

Simplify Arduino



Arduino IDE

Simplify Arduino


Oscilloscope
Signal Generator

: MakerBot 3D-Printer



Examples Projects

,
.


PDF Foxit PDF
Tablet Ipad Good Reader

Simplify Arduino

Simplify Arduino

Introduction to Arduino & microcontrollers

Simplify Arduino

,,,... .

Integrated Circuits
) (IC


Nano Meter
.

Simplify Arduino
Integrated Circuits
Micro Controllers
,,

,




.


,



...

Simplify Arduino

Arduino

Open Hardware


Arduino C
Arduino IDE: Integrated
Development Environment




Source Codes
Arduino Boards Arduino
IDE
Arduino C

Mikro C
.

10

Simplify Arduino

Micro Controllers PIC


3 ,
" "C
.







MATLAB Java
MATLAB ,
,
JavaVB.NET

11

Simplify Arduino
:
MATLAB
.MATLAB


MATLAB
88

0888

12

Simplify Arduino

Arduino Boards

Arduino UNO, Arduino Mega, Arduino Nano, Arduino


Mini, Arduino Lily, Arduino Demulive, Boarduino


Sensors

13

Arduino Uno

Simplify Arduino


Arduino Uno

ATmega328

41( | )
Digital In/out 41 6 PWM
( )Pulse-Width modulation

Analog Inputs & Outputs

,MHz46
USB,
,
ICSP header




USB
.

14

Simplify Arduino

Power up


USB
AC\DC
9 1
4.1
GndVin .

6 08-,
7
Pin 5V
1 ,
40
voltage regulator
.740 .

15

Simplify Arduino


Power Inputs/Outputs
Vin :

,
,

.
V5:


,
Vin
USB
1.
V3.3:3.3


18.
GND:.

16

Simplify Arduino

Microprocessor

ATmega328 Kilo Byte 30


o

boot loader
Arduino c language
o

0 SRAM

.
o

1 09 Flash Disk
,

4 EEPROM


Hard Disk.
ATmega 328p 46 ,
8
.

17

Simplify Arduino

)Input & Output Pins(I/O

( 41 (Digital Pins

1 18
, 6AnalogA0,A5
1.

18

Simplify Arduino

:
:

19

Simplify Arduino

20

Simplify Arduino

:
:Hardware & Tools

21

Simplify Arduino


Arduino UNO :
(:)

Arduino Uno V.3

ATmega328
)USB printer cable (1 Meter
,

,""

)(Breadboard

,
Half Sized Breadboard

22

Simplify Arduino
( ) Colored Leds

,48

:,,,,

Resistors

:
)Resistor 560 Ohm (x5
Resistor 10 Killo-Ohm (x5
)AVO Meter (multi-meter device

()

Wires


23

Simplify Arduino



Cat5

.


,


breadboard

24

Simplify Arduino
3

http://www.fut -electronics.com
http://egyrobots.com
http://www.ram -e -shop.com


RAM Electronics
" "

Future Electronics
.


( )

http://www.buyincoins.com

25

Simplify Arduino

Arduino Uno


26

Simplify Arduino

Software's
27

Simplify Arduino

)Arduino (IDE

Arduino IDE
Arduino C
.

Arduino C
.

28

Simplify Arduino

Source

Open,

] [ :

Ubuntu
:

http://www.simplyubuntu.com/

29

Simplify Arduino

Arduino IDE

Windows, Linux, MAC
:

http://arduino.cc/hu/Main/Software


, 7zip
arduino.exe

30

Simplify Arduino

Ubuntu
Software center Arduino IDE Install
fedora
Open SUSE
.

Hardware
31

Simplify Arduino
Arduino IDE
:

USB

Found
Arduino Uno Board

4
32

Simplify Arduino

33

Simplify Arduino
:
:
:
:
:



Tools Board
Arduino Uno

34

Simplify Arduino

New File

New

35

Simplify Arduino

Examples File

36

Simplify Arduino



Let's get started

37

Simplify Arduino

Example 1: Blinking led :

38

Simplify Arduino

(:)1
Arduino Uno
Breadboard
168
48

Breadboard
:
(
)100%

Breadboard 1
pin-header

39

Simplify Arduino

Pin-Header

Breadboard

: Arduino IDE

40

Simplify Arduino

// Example 01 : Blinking LED


const int LED = 13;
void setup)(
{
pinMode)LED, OUTPUT(;
}
void loop)(
{
digitalWrite)LED, HIGH(;
delay)1000(;
digitalWrite)LED, LOW(;
delay)1000(;
}

41

Simplify Arduino
:

Verify
IDE


"
Upload "
leds (
)Tx/Rx
,
.

,
.

42

Simplify Arduino

......
;const int LED = 13
constant=43 LED



) (Input/Output Pins ,
43 LED

43
LED
43

) ( Void setup

{
;)pinMode(LED,OUTPUT
}

pin 13
LED

43

Simplify Arduino

3 :
:

: Digital Pins

Pin4 40 43
Pin1 6 ) ( setup
.

Pin

; ) pinMode(pin number, state Pin


Pin
, INPUT OUPUT
( ) . capital


} setup ( ) {write your configurations here
pin
pin :

44

Simplify Arduino

) ( void setup
{

;)pinMode(11,OUTPUT

;)pinMode(12,OUTPUT

);(

;)pinMode(13,OUTPUT

;)pinMode(2,INPUT

verify

) (void loop
LED

{
;)digitalWrite(LED, HIGH
;)delay(1000

1000
LED

;)digitalWrite(LED, LOW

1000

;)delay(1000
}

45

Simplify Arduino
} void loop ( ) {your program ,
;) digitalWrite(LED, HIGH
HIGH = 5 Volt LOW = 0
HIGH
1LOW= .

;)delay (1000

.

;)digitalWrite(LED, HIGH
;)delay(1000
1 HIGH
LED 4888
millisecond
Nano-second Micro-Second

Low
4888 = .

46

Simplify Arduino

// Example 1 Blinking led


comments
, Arduino IDE
.

""//..... :

// Hello I'm Abdallah


// I'm Using comments
// Arduino is Sooooo funny

..... :

/* Hello I'm Abdallah and I Love Arduino, and you


are going to learn The best microcontroller system in
the world (^_^) */
: //
, * /
,*/

.

47

Simplify Arduino

:
Push button

push button
.

48

Simplify Arduino

(:)2

Arduino uno

Breadboard
Push button
Led 10 mm

48

168

5v

0
.


Digital input ,
1 HIGH
LOW
HIGH

Arduino IDE

49

Simplify Arduino

const int ledPin = 13;


const int buttonPin = 2;
int val;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);

}
void loop()
{

val = digitalRead(buttonPin);
if (val == HIGH)
{
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1000);
}
else {digitalWrite(ledPin, LOW); } }
50

Simplify Arduino

Verify
,
Upload

......

:ledPinPin 13

buttonPin

;int ledPin = 13
;int buttunPin = 2
;int val = 0

val

:pin 13
ledPin

()void setup
{
;)pinMode(ledPin, OUTPUT
;)pinMode(inPin, INPUT
}

51

pin

HIGH or LOW

Simplify Arduino

:
;)val = digitalRead(buttunPin

pin 2
val
) ( digitalRead
1=HIGH=LOW

)if (val == HIGH


{
;)digitalWrite(LED, HIGH
;)delay(1000
;)digitalWrite(LED, LOW
;)delay(1000
}
} ;)else {digitalWrite(ledPin, LOW

) if.else = .. ( ,
if
:

val

HIGH1
.

HIGH

.
52

Simplify Arduino

: 2
Push Button ON
OFF

53

Simplify Arduino

(:)3

Arduino uno
Breadboard
Led 5 mm
048
168
0



, 0
push button

.
:
breadboard1
Pin-Headers

54

Simplify Arduino

:Arduino IDE

55

Simplify Arduino

const int ledPin= 13;


const int inputPin1 = 2;
const int inputPin2 = 3;

void setup {
pinMode(ledPin, OUTPUT);
pinMode(inputPin1, INPUT);
pinMode(inputPin2, INPUT);

void loop {
if (digitalRead(inputPin1) == HIGH)
{digitalWrite(ledPin, LOW); }
else if (digitalRead(inputPin2) == HIGH)
{digitalWrite(ledPin, HIGH); }
}

56

Simplify Arduino
if else if
elseif .
:
}If (you like science) {you should read books
}else if (you like sport) {you should play football
}else if (you like art) { you should take art lessons
}else { you should search for a hobby to do in your summer
3 :



0 ...

57

Simplify Arduino

const int ledPin= 13;


const int inputPin1 = 2;
const int inputPin2 = 3;
void setup)(
{
pinMode(ledPin, OUTPUT);
pinMode(inputPin1, INPUT);
pinMode(inputPin2, INPUT);
}
void loop ) (
{
if (digitalRead(inputPin1) == HIGH)
{
digitalWrite(ledPin, HIGH);
delay(300);
digitalWrite(ledPin, LOW);
delay(300);
}
else if (digitalRead(inputPin2) == HIGH(
{
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(100);
}
}

58

Simplify Arduino

( void setup

{}

( void loop
)
{}

;int name = value

;cons int name = value

const
pin

INPUT or OUTPUT

;example: const int led = 13

;)pinMode (pin number, State


;)example1: pinMode(11,INPUT
;)example2: pinMode(led,OUTPUT

digitalWrite (pin number,


; )State

pin )HIGH (1
)or LOW(0

;)example: digitalWrite(13,HIGH

;)digitalRead (pin number

pin
( 1

;)example: digitalRead(4

3.8 HIGH

59

Simplify Arduino
4.8
LOW )
:

;)delay (time

;)example1: delay(100
;) example2: delay(1000


(.....).....

)if (the condition


}{..what to do

)else if (another condition


}{what to do

==
=!
=<

)else (last condition


}{.what to do

=>
<
>

60

Simplify Arduino
:

;int led = 13

Integers

30768 30768

; float sensor = 12.5

Float

;char name= hello

character

;long variable = 99999999

long

618183417 0

(8)

;byte number= 44

byte

011



http://www.arduino.cc/en/Reference/VariableDeclaration

61

Simplify Arduino

:
:

62

Simplify Arduino



Analog Inputs/Outputs and Sensors

63

Simplify Arduino

, 1
(1) HIGH (0) LOW

Analog Signals

((sensor ,
:Photo-
Resistor

AVO-meter..

64

Simplify Arduino



: , , , , , , ,
...

Atmega 328-p Arduino


Uno 6
() A0 A5
1.8


TMP36 LM35
()
.. 48 (
) 0.1 ....

65

Simplify Arduino

: TMP36, TMP35, LM35


:
- 40.01.1
- 0
- 3GND

66

Simplify Arduino
:
- 40AAA4.1
- 040
- 3 AVO
Meter
- 1 :
TMP 35, TMP36, LM 35
0 AAA 1.5
3
()
()

( )
, AVO

67

Simplify Arduino
AVO meter 0.76
(
37
)
:

68

Simplify Arduino

:
Potentiometer
(
)analog input

69

Simplify Arduino

(:)4

Arduino Uno
Breadboard
led 5mm
168
348

:

3
488
088 ,
3

A0

70

Simplify Arduino

71

Simplify Arduino

;const int sensorPin = A0


;const int ledPin = 13
;int sensorValue

( ) void setup
{
;)pinMode(ledPin, OUTPUT
}

( ) void loop
}
;)sensorValue = analogRead(sensorPin
;)digitalWrite(ledPin, HIGH
;)delay(sensorValue
;)digitalWrite(ledPin, LOW
;)delay(sensorValue
}


)analogRead(pin number
1.81
4801
Analog to digital converting

72

Simplify Arduino

A0 :

4.8 = 1

48 = 11
481 = 111
= 218.33

2 = 416.66

5 = 1124
sensorVlaue

;(sensorValue = analogRead(sensorPin

blinking led
.A0
()
(
),


light sensor

73

Simplify Arduino

: (
) Photo resistor as light sensor
,

74

Simplify Arduino

(:)5
Arduino Uno
Breadboard
led 5mm
168


75

Simplify Arduino

76

Simplify Arduino

;const int lightPin = A0


;const int ledPin = 9
;int lightLevel
) (void setup
{
;)pinMode(ledPin, OUTPUT
}
)(void loop
{
;)lightLevel = analogRead(lightPin
;)lightLevel = map(lightLevel, 0, 900, 0, 255
;)lightLevel = constrain(lightLevel, 0, 255
;)analogWrite(ledPin, lightLevel
}

,
.

77

Simplify Arduino

;)analogWrite (pin number, value


analog Output

()Pulse-Width modulation
(~).6:4448961 3

PWM

1 0
255 :
255 = 5 volt
128 = 2.5 volt
0 =0 volt

,3
1
1 ..
() .

78

Simplify Arduino
9()PWM

: PWM

79

Simplify Arduino
(
)44
PWM

:
;const int ledPin = 11
;int i = 0
) (void setup
{
;)pinMode(ledPin, OUTPUT
}
)(void loop
{
)for (i = 0; i < 255; i++
{
;)analogWrite(ledPin, i

;)delay(10
}
)for (i = 255; i > 0; i--
{

;)analogWrite(ledPin, i
;)delay(10
}
}
..

80

Simplify Arduino


)for (i =0; i < 10; i++
loop

counters
, :

}for (i=0; i<255; i++) {what to do here


255

(i

i)analogWrite(ledPin,i

(i

81

) .

Simplify Arduino

255
(i)(i)

(i)

82

Simplify Arduino

Computer interfacing with Arduino

83

Simplify Arduino

()lilypad, mini

computer interface
USB
,

Liliypad

FTDI interface

FTDI chip

serial interface
.

84

Simplify Arduino

85

Simplify Arduino

(:)7
Arduino Uno
Breadboard
TMP 36LM35

USB

86

Simplify Arduino

87

Simplify Arduino
const int sensorPin = A0;
int reading;
float voltage;
float temperatureC;

void setup( )
{ Serial.begin(9600); }
void loop ( )
{
reading = analogRead(sensorPin);
voltage = reading * 5.0/1024;
Serial.print(voltage);
Serial.println(" volts");
temperatureC = (voltage - 0.5) * 100 ;
Serial.println("Temperature is: ");
Serial.print(temperatureC);
Serial.println(" degrees C");
delay(1000);
}

88

Simplify Arduino
Serial
Monitor:

89

Simplify Arduino

Tx
...

(
,
418)
:( - )

90

Simplify Arduino


;)Serial.begin(9600
USB
.
voltage temperatureC
float int
0.1

float .
;)reading = analogRead(sensorPin
reading sesnorPin
A0 .

4801

;voltage = reading * 5/1024

91

Simplify Arduino
;)Serial.print(voltage
Serial
Monitor ;)"Serial.println ("voltage
voltage

;temperatureC = (voltage - 0.5) * 100
CelsiusSerial.print

;)Serial.print(temperatureC
;)" Serial.println(" degrees C

;)delay(1000
.

92

Simplify Arduino

:

,
led, .

11

93

Simplify Arduino
const int photocellPin = A0;
int photocellReading;
void setup(void)
{ Serial.begin(9600); }

void loop(void)
{
photocellReading = analogRead(photocellPin);
Serial.print("Analog reading = ");
Serial.print(photocellReading);

if (photocellReading < 10) { Serial.println(" - Dark");}


else if (photocellReading < 200) { Serial.println(" - Dim");}
else if (photocellReading < 500) {Serial.println(" - Light"); }
else if (photocellReading < 800) { Serial.println(" - Bright"); }
else {Serial.println(" - Very bright"); }
delay(1000);
}

94

Simplify Arduino

Serial Monitor :

95

Simplify Arduino
:
o
o
o

Dim

Dark

Light

Bright Light

96

Simplify Arduino

97

Simplify Arduino

(:)9
Arduino Uno

led 5mm
168

,
,
USB Serial Monitor
Arduino IDE

98

Simplify Arduino
:
;const int ledPin=13
;int value
)( void setup
{
;)Serial.begin(9600
;)pinMode(ledPin,OUTPUT
}
)( void loop
{
;)(value = Serial.read
};)if (value == '1') {digitalWrite(ledPin,HIGH
};)else if (value == '0') {digitalWrite(ledPin,LOW
}
serial
Monitor1 Send
,
...

99

Simplify Arduino

100

Simplify Arduino
;) (Serial.read
USB=value
,USB
value
if.. else if :

value == 1

value == 0

Serial communication
:
http://arduino.cc/en/Reference/serial

101

Simplify Arduino

Arduino Shields

102

Simplify Arduino


Arduino uno
Arduino Mega

PCI
,
Motherboard

network interface
card
..

(Ethernet
)
,

103

Simplify Arduino

Arduino Ethernet Shield

CAT5

104

Simplify Arduino

Xbee Shield

Ethernet ShieldWireless

488(
)

105

Simplify Arduino

() Arduino Motor Shield

DC Motor, Servo Motors,


Stepper Motors3
(:

RobotsCNC

106

Simplify Arduino

Arduino colored Touch


screen

lcd
,
0
1(
0.1)

:
http://shieldlist.org

107

You might also like