You are on page 1of 229

1


" " PDF
Creative Common v4
: .
.1 ( CC-NC- ) :

( ).
.2 :BY - .
.3 :SA-
( :
).


" "
.

https://asnadstore.com/p/67no


0.1
0341 () 4103
abdallah.ali.abdallah.elmasry@gmail.com



.
.
..


()

arabdigitalexpression.org

( )



fablab-egypt.com


.
hacking15.org



()
3alemni.com


" "
.

4 ............................................................................................
4 ......................................................................................................
3.......................................................................................................
1 ......................................................................................
6 .....................................................................................................
7 ............................................................................................
0 ......................................................................................................
: 4 ...............................................................................
: 40 .......................................................................
: 30..........................................................
: 17......................................................
: 74...................................................
: 88 ................................................
: 006 .............................................................
: 041 ..............................................................
: 036 ..............................................
: 018.......................................................
: 070 ......................................................
: 011 ...........................................................

- 00 ................
04 ...

04......

06 ........................................
07................ Hardware

4 .................................

ARM Cortex 01 ..................

4 ...........................................

01 .........................

3............................................

1 ...........................

41 ..

6 ..........................................

: 40 ............

7 .................................

44........

0 ...........................................

46 ...........

: 4 .....................

48 ...............

4 ...................

41.

3 ........

41 ...........

3 ............

"" 1 .....

41 ................................

7 ...................

7 ............................... Model A
7 ................................ Model B
8 ....................
ARM Cortex 00 ....
00 ........

44 .................................
: Ubuntu Image Writer

44 ........................................
: 44..................... dd
43 .........................
41 ....................


41 ................
31 .......................
31 ..............
:
30........................................

34 ......................
34................... LXDE
33 ...............
33 .......... Accessories
31 ....... Education

:
17 ...........................................


18 ................................... SSH
SSH server
18 ..........................
60 ... SSH
VNC

64............................... protocol
VNC server
61 ..................

31 ............... Internet

IP Address

31 ... Programming

67 .................................

36 ...... System tools

36 ........ Preferences

61.........................

37...........................
38 ....
31 ................................
11 ........
10 ............................. Sudo
10 ...............
14 ...............
14 ................
11 ..........
16................... .deb
16...........................

: 61 .............
: 71 .............
:
74 .......................................

74 ............. Resistor
74.................... :
73 ................
71 ........................
76 ......... Ohm's Law
76 ......................... Power
77 ..................... LED
78 ...................... Motors

71.......................... BreadBoard

17 ........................ Blinking Led

81 .................

18 .........................

80 ................

011 ..............................

:0 84 .........

014 .....................

:4

() 83...............................

() 014 ...........................

:4 +

013 .........................

86 ................

013 .............................

:3

011 ......................

87 ..................................
:
88 ......................................

81................... GPIO
81 ............................
11 ...........................
11 ...............
11 ....
GPIO
10 .........................................
14 ......................
14 ......................
13 .......................
13 ....................

:
016 .............................
017 ........................ :
017 .............................
0 018 ..................
4 018 ..................
: PIR Motion

011 .............................. Detector


PIR Motion

011 ............................. Detector


000 ........................ :
000 .............................
004 ......................
BCM

13 .....................

004 ..................................

16.............

004 ......................

16 ....................


003 . Adafruit

003 ..................

041 ..................................

Adafruit GPIO breakout

044 .......................... i2C

001 ................................. cable

044 ...............

: 006 ...

043 ........ i2C

007 . PWM

041 .................. i2c

001 .................... Software PWM

046 ............................. BMP085

041 ........................ :

048 ........... i2C

041 .............................

: 041 ...

PWM

MIT 031 ............

044........................................

GPIO

044............. PWM

034 ................................ Scratch

034................... GPIO

044 ...................................

034 ...

033 .

044 .......................
041.......
046.......
: auto login

046 .......................................
:
046 ..............
047 ..............

031...........
031....................
:
036 ...................................


037 ............................. WebIOPi
037 ................... WebIOPi

048 ...............

038 ...............................

041.......................

038 .........


061 ...........................
031 ......... WebIOPi
GPIO list & GPIO Header

066........

011 ........................................

067 ........

010 WebIOPi

014 ............. Device Monitor

068 ...............................


014 ...............................

061......
071 ......

014 ............... 1Wire

011 .........

070 ....................................

016........

074 ...

016......

017.............. WebIOPi
WebIOPi

017 .......................................
:
018.......................................
USB Web

074.......................................

073 .......................................

071 .......................................
)USB (3G

011 ............................... Camera

076 ............................... Modem

011 ........................

: 076 .......... 3G modem

061 ........................

: 077 ........

060 ............................

: 077 .......... 3G modem

064

064.............. Motion
064..............
064
061........ Motion

078 .......................................
071 .................
: 080........
Sakis3G
084 .......................................

: 011

084......................... 3G modem

FM 411 ...

083 .........................

411 ....................

086 .............. Raspi-Config

411 ......................

086 ........... Change user password

410 ...............

087 ........................

414..................

088 ...........

414.........

010 .................

414 .....................

014 ....... Rastrack

414 .............................

( ) 014 ...........

413 ....Supercomputers

014 ................

411..

013 ..................

411............

011........................................

417 ..............................

011......................

418 ..........

016 ................ Advanced Options

411....

017 .......................

404................

017 ......................

406 .......

018 .......................
018 ......................

2112





.



) IT (Information Technology


!
" "

IT
.
" "

3
" ".


Raspberry Pi
2012
25 " "
.



CPU
700 GPU
250 HD
RAM
512
Microcontrollers
" " SoC: System on Chip
.
8.6 cm x 5.4 cm 45


.


2 2112 2113
Arduino.


Libreoffice

Microcontrollers :
Smart Home Automation
ROV and UAV Robots
Camera Streamers
Remote Monitor
Smart TV
Linux: Http server, FTP, MySql, SSH, Etc.
Supercomputers
)Balloon Satellites (weather balloon




.
!

""
2112



(
).
Eben Upton

.



.
!!
.
Jack Lang Rob Mullins Alan Mycroft
3 5

2111



USB
HMDI
.


GPIO

.



25.







:
http://www.raspberrypi.org
http://youtu.be/gov0BfJ2RqA :


Module A 25 Module B
35 RAM
USB Ethernet
.



RAM
USB

Model A

Model B

700 MHz Low Power


ARM1176JZ-F
Dual Core 250 MHz with
Shared Memory
256 MB

700 MHz Low Power


ARM1176JZ-F
Dual Core 250 MHz with
Shared Memory
512 MB

Ethernet
GPIO
HMDI
3.5 audio jack
RCA-Video

(--)

5 volt (400 mA) = 2.4 watt

5 volt (700 mA) = 3.5 watt

8.6cm x 5.4cm x 1.5cm

8.6cm x 5.4cm x 1.7cm

25

35

: Module B
Ethernet

)" Broadcom BCM2835 (SoC ":



CPU RAM GPU
( 1 ).

:HDMI Output

" "Video & Audio
.

:RCA Video Output



.

:Audio Jack 3.5mm


.

:Ethernet port
.

2 : USB
USB
Keyboard Mouse
USB flash disk

.

:MicroUSB

5.

10

:

:SD card Slot

.

:GPIO Pins


. Microcontrollers

:CSI Camera input


:DSI Display
Touch Screen
.

http://youtu.be/PWgXXtXvNxM :

11

ARM Cortex


( .)Android

ARM 111 1 051
5 !
ARM
( )PIC16f877
CPU GPU RAM .
ARM Cortex
( )
.


( )GNU-Linux


() Source Code

" ".

-
1791 AT&T Unix
Assembly


.

12




GNU


.

1771

( +).







Embedded Devices
( )Routers
Switches & Access Points .
%01 Servers ( )

.

.

.
http://youtu.be/mxvqL3JlSdI :

13



51

.
ARM Cortex
Intel x86 AMD x64
ARM x86 AMD64
.
C
11
.

: ""

Linux Debian

- :
raspbian.org

OpenElec

Media Center

XBMC -
openelec.tv :

14
Occidentalis v0.2

:


Adafruit

- :
learn.adafruit.com

- Kali
BackTrack


kali.org :

ROS Robotics Operating System


""


Debian Ubuntu :
ros.org




ARM

( ) :
androidpi.wikia.com

15

Arch


:
archlinuxarm.org

NOOBS 2
:
Raspbian, Pidora, RaspBMC, OpenELEC

- :
raspberrypi.org

RISC OS

RISC OS
Acorn Computers Ltd
ARM

riscosopen.org :

http://raspberrypidiskimages.com
http://youtu.be/P0B1qb4SuXk :

16

3
: BegaleBone Raspberry Pi
.Arduino UNO

( )ARM SoC

(
.)GPIO

() Microcontroller Atmega328
Arduino C


http://simplyarduino.com

17

Hardware

Beaglebone Black

Raspberry Pi

Arduino Uno

55
Rev A5A

25
Model B

20
R3

SoC

ARM Cortex-A8

ARM11

ATMega 328

1000 MHz

700MHz

16MHz

20

512 MB

1111
512 MB

2 +


5V

5V

5-17V

210 to 460 mA

320 to 480 mA

42mA

66

14

7 12-bit

PWM

6 10-bit
6

i2C

SPI

UART

USB

: 1

: 2

10/100

10/100

microHDMI

Analog

HDMI, RCA
)Video (analog
HDMI, Analog


1080p

Ethernet

2KB
32KB




Arduino C
Embedded C
Scratch

18


Arduino C
.



20 25
51

.



Sleep mode 7

.




311

.
22 10 9

Analog to Digital

.converter

19

RCA video
HDMI

.

ARM Cortex
ARM Cortex
25
( 51)

() 111 .

Raspberry Pi

Rascal Mi-

pcDuino

cro

Cubie-

Beagle-xM BeagleBone

board

$25,00

$199,00

$60,00

$49,00

$89,00

$201,00

)700 MHz to 1 Ghz (overclock

400 MHz

1 GHz

1 GHz

720 MHz

1 GHz



ARM Raspberry Pi

projects ( ) .
25 : A 35 B

05
pCduino 51
= 111 .
( ) *_*




pCduino

20



ARM
( Debian )Ubuntu
ARM
pCduino

( ).

%91
BegalBoard, UDOO, pCduino, Parallela
.
%31 GPIO GPIO


.

ARM :
http://www.cooking-hacks.com/blog/new-linux-embedded-devices-comparison-arduinobeagleboard-rascal-raspberry-pi-cubieboard-and-pcduino
http://youtu.be/ysltNeQ8r5I :

21

22



.
( SD Card) :
0 32
Full Size SD card MicroSD
+ :

Classes:

class
class class 4
.

: 0
Kali-linux 0

12

23

( USB charger) :

MicroUSB
5 700 (0.7
( .
911 USB

211
511 911

1111 ( 1)

( Keyboard & Mouse) :


() :


HDMI

24


( HDMI) :

( RCA Video) :
HD

(Memory Card reader) :


.

() :
0
.

25

paper box

for raspberry
.

26


(
)
( BreadBoard):



.

() : Female-to-
.male wires

(Raspberry Pi Breakout Cable):




short

circuit

27

Adafruit

28

:

LED


5
:

Resistors

:
)Resistor 300 Ohm (x5
)Resistor 10 Killo-Ohm (x5
Push Buttons
2
.
LDR


(
).
( 2 5) Relay Board

Relay

.

compenent-list.txt

29




http://www.raspberrypi.org/downloads
Raspbian
.

7zip WinRAR
wheezy-raspbian.img


SD card USB SD Card
USB
My Computer
F: .

30

Format FAT32
Format

Win32 Disk Image Writer


http://sourceforge.net/projects/win32diskimager/files/latest/download

31

: Device ( )F:
wheezy-raspbian.img

: Write
(
).

32

Win32 Disk image

Writer Ubuntu Image Writer dd .

: Ubuntu Image Writer


( )Terminal :
sudo apt-get install usb-imagewriter

sudo imagewriter

33

: dd

dd DVD, USB

flash .

ls /dev/

mmcblk0p1 sdb1
mmcblk0p1
" "unmounts
umount /dev/mmcblk0p1

sdb1
umount /dev/sdb1

(
) /download/wheezy.img
sudo dd bs=1M if=~/Downloads/2012-08-16-wheezy-raspbian.img of=/dev/sdb
:

dd bs=1M if/Downloads/2012-08-16-wheezy-raspbian.img" of=/dev/mmcblk0p1


1850+0 records in
1850+0 records out
1939865600 bytes (1.9 GB) copied, 379.351 s, 5.1 MB/s

34

( ) MicroUSB
5 911

35

Keyboard Mouse HDMI RCA

36

: Expand rootfs o
( 2 )
:Overscan o HD

.
: Configure Keyboard o
() ( )
:Change Pass o
raspberry pi

: Change Locale o ()

: Change time zone o
:Memory split o
( )
:Overclock o
911 711 1111

37

:
.
:SSH o ( )Secure Shell server
(
)
: Boot Behavior o
:Update o

:Finish o
Expand rootfs
2
Finish

38


Boot behavior

39





Raspian
QEMU
.


Raspberry Pi emulation for Windows
511 QEMU
Download
http://sourceforge.net/projects/rpiqemuwindows/

40

run.bat
:

: Ctrl+Alt

GPIO

(2

41

( Shell )

42

:Kernal

Applications

() :Shell

()

GUI

Shell

( DOS

command line
).

kernel

Graphical User

) Interface (GUI

LXDE
.
Unity

KDE

Elementary

Cinnamon

43

LXDE

LXDE Explorer
Desktop ( lxde start )
0
LXTerminal, Scratch, Debian Refrence, PiStore
.

lxde
..Internet, Education, System Tools, Games

44


Accessories

Accessories 9 :
: Debian Reference ()

: File Manager

:Image Viewer
:LeafPad Notepad
: LXTerminal Shell
.
: Root Terminal
( )Root ( :
LXTerminal).

45

Education

Scratch Squeak
.

Internet

3
:
""
"" " "
( ).

Programming

0 IDE (integrated development

)environment IDLE "Python"


.

46

System tools


" Task Manager "

.

Preferences

:
: Customise Look
: Desktop Session
: Keyboard & Mouse
: Monitor Setting
Resoultion
: Openbox configuration openbox
( )lxde
.
:Preferred Applications

47


Folders
pCmanFM
LXDE Accessories
/home/pi:

pCmanFM Windows 7


(.)/home/pi

Copy
Cut Delete Rename
( )Copmress ...

Tab
Open in New Tab

48

( / ) My Computer
:


( )root ( My Computer )


pi

/home/pi ( )

/
/etc
/home
/home/pi
/root

( )

/media

/proc

/sbin

/dev

USB Modem ..
+ ()

/lib

49

/tmp

/usr

/var


)SElinux (Security-Enhanced Linux

/boot
/selinux
/opt





.
LXterminal
Shell
LXDE

50


pwd /home/pi:

pi ls list everything

/home/pi :


(
..python game, Documents, Scratch
).
hello mkdir (make a directory )
mkdir hello ls
:

( cd )change directory
cd hello pwd

51

Sudo


()
System Administrator
.
Pi



sudo super user do
( ) root

().
sudo sudo
sudo programe1
sudo programe2

Root Terminal sudo



command

Show manual
of command

man command

Print Working
Directory

pwd

Show date

date

52


( ) name

Make
directory

mkdir name



.txt
txt
folder

List everything

ls

List everything
in a list

ls -l

List .txt files


only

ls *.txt

Change
directory

cd folder

Back directory

cd ..


/destination

)Copy file(s

cp file
/destination


/destination

)Move file(s

mv file
/destination

Remove files

rm file1 file2
file3

Remove folder

rm -r folder1
folder2

Super user do
Conver to root
accoount

sudo command
Sudo su

Download
file.zip
Network
configerations

wget
site.com/file.zip

file1 file2 file3


folder1 folder2

command ( root)

file.zip site.com



.zip

Extract file.zip

ifconfig

unzip file.zip

53



Repositories ( )

.


.

( )
.
apt-get

.



apt-get

sudo apt-get update

54

apt-get () sudo


:
sudo apt-get install programe1

programe1
Geany
sudo apt-get install geany

Enter apt-get

)(y

Enter :

( ) -y "
" y :
sudo apt-get install -y geany
sudo apt-get install geany -y
install
remove geany :
sudo apt-get remove geany

( ) -y
apt-get
upgrade

55
sudo apt-get update
sudo apt-get upgrade


Pi Store Play
ITunes
MagiPi .

: Pi Store
1 0 .

IndieCity


http://store.indiecity.com

" " Login " "
IndieCity .

56

.deb

.deb
( ) .deb .msi

dpkg :
sudo dpkg -i application.deb


Bash
( )
:
http://ss64.com/bash/
http://www.pixelbeat.org/cmdline.html
http://linuxcommand.org/learning_the_shell.php



http://librebooks.org/simply-ubuntu

http://librebooks.org/gnu-linux-advanced-administration

http://librebooks.org/linuxawy-diaries-2

57

SSH

VNC

Routers Switchs

58

SSH
SSH Secure Shell
( )
( Terminal )

( .)Secure Shell
SSH : ( )server
: ( ) client
clients
.

SSH server
SSH Raspbian

sudo raspi-config
Advanced Options :

SSH

59

Finish
SSH :

IP address
ifconfig
192.168.1.4

60


SSH client
PuTTY
( ):
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
FTP,

SSH, Telnet, Serial SSH Host Name


22 Port :

Open
pi ( raspberry )

61

SSH
o
ssh pi@192.168.1.4
o ConnectBot
https://play.google.com/store/apps/details?id=org.connectbot
o

Iphone Ipad Server Auditor


https://itunes.apple.com/us/app/server-auditor-ssh-client/id549039908?mt=8

SSH clients
http://en.wikipedia.org/wiki/Comparison_of_SSH_clients

62

VNC protocol
VNC Virtual Network Computing
VNC

) (Server
) (Viewer
VNC







VNC protocol
Ethernet

tightvncserver
:
sudo apt-get update
sudo apt-get install -y tightvncserver

VNC server :
vncserver :1

63

(
) :


(
n )Enter

IP address :
ifconfig
192.168.1.4


VNC RealVNC viewer
http://www.realvnc.com/download/viewer/

64


1 192.168.1.4:1 " "connect :

Ok
continue

65

VNC server
VNC
vncserver :1 VNC

. VNC
pi :
cd /home/pi

.config config :
mkdir .config
autostart :
mkdir autostart
cd autostart

VNC :
nano tightvnc.desktop

Ctrl+X

66
Y Enter

:

][Desktop Entry
Type=Application
Name=TightVNC
Exec=vncserver :1
StartupNotify=false

67

IP Address
SSH VNC
IP Address ifconfig
IP
address
( )

192.168.1.10 .

http://192.168.1.1 http://192.168.0.1 TP-Link


Username: admin
Password: admin
( DHCP
).

DHCP client list


MAC ( ).

68

)B8-27-EB-48-48-D7( MAC Address rasberrypi


Address Reservation MAC Address
Save :

192.168.1.10

: MAC 12
(
)MAC

69



( ) Switch

.

:

My Computer boot :

Boot cmdline.txt

:
ip=192.168.1.10

70


cmdline.txt :

:




.

71

:
IP Address: 192.168.1.5
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.5
PuTTY VNC viewer

:
Obtain IP Address Automatically

72

Ohm's Law

Resistors

Breadboard

Switchs
Motors
BreadBoard

73

Resistor

() ()-

Ohm
R ( 1111)
1
1K
1M

1 Ohm
1000 Ohms = 1 K Ohm
1000000 Ohms = 1 M Ohm

:
.1 .
.2 .
.3 .
.0 .

:
.

"
"
.
.
: :




.

74

: 11 ()
100
.%5

:
( ) = %5
( ) = %11

Multimeter

( 5)
ohm

75




(
)
1 11 ( 1111 )

:

76

Ohm's Law

(
Amp )I ( ) (
)V
R
=

(
)

:
: )Current( I
: )Voltage( V
: )Resistance( R

:1 2 2 = 3 = 2\2
:2 5 = 11 = 51 = 5*11
:3 = 11 = 0
: = \ = ( 2.5 = 0\11 )

Power

Watt 221 11
2211.

77

LED
light emitting diode

) (LED


1.5 .
(
) ( )
Anode Cathode
)Ground (GND

0
( 0 )
.



7
.

78

Motors


:
..

:
()DC Servo Stepper
()3 Phase 1 Phase
DC Motor

Servo Motor
.

DC Motor

Servo Motor

79

BreadBoard

(
)soldering iron

"
"BreadBoard
Test Board .prototype board



.

80

81


(
) jumpers
.

Cat5
.
( )

.

82

:1


221
3 +

:1

0 15

( 15 )

= (3)\(221) = ( 1.113) = 13 .
led ( ) ()
221 (

).

: 3 3 221

83

84

:2 ()


221
()
3 +

:1
Push button switch

85

: 2 2 1
2 ( 2 221)

86

:3 +

221

()
2 ()
3 +

:0

111
3 +

87

88

GPIO

GPIO

Microcontrollers

89

GPIO
GPIO ( General-purpose input/output
) 20 ( )pins GPIO
( )outputs ( ) imput
.


) : Pin (1, 17 3.3
51 51
.
) : Pin (2, 4 ( ) 5
MicroUSB
MicroUSB
5 .
) : Pin (6, 9, 14, 20, 25 )Ground (GND

90

) : Pin (3, 5, 7, 8, 10, 11, 12, 13, 15, 16, 18, 19, 21, 22, 23, 24, 26 19
Output Input
.
: Pins GPIO Pin 3
GPIO2 11 GPIO 17
Raspberry Pi GPIO pin map
.



802.11 g
WiFi
TCP/IP .
0 i2C, SPI, UART, 1Wire



" ".
GPIO input
Output Communication Protocol
.



...C, C++, C# (Mono), Java, Python, Perl, Ruby, Pascal

GPIO

91

GPIO
Python Scratch C WiringPi
.

GPIO

GPIO
C
GPIO ()
251 ( 250,000,000 ).

(
).

.
GPIO

http://elinux.org/RPi_Low-level_peripherals

92


""
1771

.

GUI

)Supercmputers (cluster parrallel programming

GPIO .

.

"."NASA
(
GitHUB ) CWI
" " Guido van Rossum
1771 C ""

Monty Python


: ()
() Symbian Android

93


.....
++C Java

()

Oracle, sybase , PostGres, mSQL , persistence , dbm o
GPIO



.

2.9

GPIO
.
( )
.. "
" :
http://librebooks.org/learn_programming_with_python3/

94



()

python IDLE Python Shell
:


" " Hello World print
:
" print " Hello World
Enter

95

:
.
1+1 Enter

( 2*2-1 2 2 )1

:
( = )
print
x=2
print x

( ) = " "
" " :
"myName = "Abdallah El-Masry
print myName


x=2+3+2
print x

Ctrl+D

96



( )
py .


x=3
y=1+2
sum=x+y
print sum

LeafPad Accssories sum.py


/home/pi


python sum.py


GPIO rpi.gpio

:
sudo apt-get update
sudo apt-get install y python-dev python-rpi.gpio

97

: Blinking Led


(
)Flash

:
Bread Board


Led

311

:
311
11

.

98


import time
import RPi.GPIO as GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(11, GPIO.OUT
while True:
)GPIO.output(11,0
)time.sleep(1
)GPIO.output(11,1
)time.sleep(1

Leafpad
nano
(
).

LeafPad
LeafPad Accssories blinkpin11.py
/home/pi


while True
Tab

Nano

99

nano Your-File
Your-File

nano blinkpin11.py

Ctrl+x
y Enter .


:
sudo python blinkpin11.py

( ).
( Ctrl + C

100


)

Led "
"

( )Pin
) GPIO.setwarnings(False :


import time
import RPi.GPIO as GPIO

:
time

RPi.GPIO GPIO .
)GPIO.setmode(GPIO.BOARD

: GPIO

.
)GPIO.setup(11, GPIO.OUT

:Pin Pin

GPIO OUT IN 11 Pin


Pin IN OUT
pin 11 Pin 23 :
)GPIO.setup(11, GPIO.OUT
)GPIO.setup(23, GPIO.IN

101


while True:

: loops

while True:
.

Tab

)GPIO.output(11,0

while True:
command to do
another thing to do
another thing to do

: GPIO.output(pin,
) status GPIO pin

status = 1
( = 3.3) = ( = ).
)Time.sleep(1

) time.sleep(time
11 ) time.sleep(5 11 5.
)GPIO.output(11,0
( 11 = )

( 11 = 3.3)

)time.sleep(1
)GPIO.output(11,1
)time.sleep(1

) GPIO.output(pin,status True False True


( )1 False ( )0
:
import time
import RPi.GPIO as GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(11, GPIO.OUT
while True:
)GPIO.output(11, False
)time.sleep(1
)GPIO.output(11, True
)time.sleep(1

102


print :
import time
import RPi.GPIO as GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(11, GPIO.OUT
while True:
)GPIO.output(11,False
")print "Led on Pin 11 is now OFF (output = zero volt
)time.sleep(1
)GPIO.output(11,True
")print "Led on Pin 11 is now ON (output = 3.3 volt
)time.sleep(1

103

: ()

Digital Input

Bread Board

11
( push button)

:
3.3
11
23 GND
""
nano inputRead.py

104

:

import time
import RPi.GPIO as GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(23, GPIO.IN
while True:
if (GPIO.input(23)==True):
")print "'Input is True (3.3 volt
else:
")print "'Input is False (zero volt
)time.sleep(1


import time
import RPi.GPIO as GPIO

.GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(23, GPIO.IN

) GPIO.setmode(GPIO.BOARD GPIO
) GPIO.setup(23,GPIO.IN 23
input .

105



) = if-else
- (
(

if (GPIO.input(23)==True):
")print "'Input is True (3.3 volt
else:
")print "'Input is False (zero volt
)time.sleep(1

) ( )
if:

)GPIO.input(23

True 3.3 Input is


)True (3.3 volt

( )False Input is False


).(zero volt

if
): ( if

1
else:

2

) : (something1 == something2 1 2
) :(something1 != something2 ( 1 ) 2
( :(something1 > something2 1 2
( :(something1 < something2 1 2
( :(something1 >= something2 1 2
( :(something1 <= something2 1 2


True if False

( ).

106

:
311

11

Bread Board

( ).

11

Light Detremnid Resistor (LDR):

()


311 ( )

:
11
GND 3.3
23
nano lightSensor.py

107

:
import time
import RPi.GPIO as GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(23, GPIO.IN
)GPIO.setup(11, GPIO.OUT
while True:
if (GPIO.input(23) == True):
)GPIO.output(11,0
else:
)GPIO.output(11,1

:
sudo python lightSensor.py

( )
.



if
11
= 11

if (GPIO.input(23)==True):
")print "'Input is True (3.3 volt
else:
")print "'Input is False (zero volt
)time.sleep(1

23 3.3 = 11
( 23 = ).

108

False if True
.) (
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(23, GPIO.IN)
GPIO.setup(11, GPIO.OUT)
while True:
if (GPIO.input(23) == False):
GPIO.output(11,0)
else:
GPIO.output(11,1)

2
GPIO.output print
.
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(23, GPIO.IN)
GPIO.setup(11, GPIO.OUT)
while True:
if (GPIO.input(23) == False):
GPIO.output(11,0)
print " Led on pin 11 is now OFF "
else:
GPIO.output(11,1)
print " Led on pin 11 is now ON "
time.sleep(1)

109

: PIR Motion Detector


PIR Motion Detector







.

Ultrasonic (
)Radar IR: Infra-red
PIR motion detector
( 9 )
9 11 71 111

( ) .

110


3 3
5 (

) (Digital Out

) (Ground )
:

1 ( 5)

23 2 ()
:
nano motion.py

111

:
import time
import RPi.GPIO as GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(23, GPIO.IN
while True:
if (GPIO.input(23) == True):
" pritn " Motion Detected
else:
" pritn " There is No Motion
)time.sleep(1


3 23
True
if Motion Detected .

112

311 ( )
3 .


import time
import RPi.GPIO as GPIO
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(23, GPIO.IN
)GPIO.setup(11, GPIO.OUT
while True:
if (GPIO.input(23) == True):
)GPIO.output(11,1
" print " Motion Detected, Now Turning On Led
)time.sleep(3
)GPIO.output(11,0
" print " There is No motion

else:

)time.sleep(1

113

BCM

( )BOARD ( BCM
Broadcom )
BCM BOARD Adafruit Breakout cable
( BCM
BOARD ).


GPIO
GPIO :
)GPIO.setmode(GPIO.BOARD
BCM :
)GPIO.setmode(GPIO.BCM

BCM
.

114

Adafruit
Adafruit Open Source Electronics

.
( )
Adafruit Breakout Cable

.GPIO
: GPIO Adafruit breakout cable BCM
GPIO BCM

115

Adafruit GPIO breakout cable

116

i2C

SPI

117

PWM

Digital 3.3( HIGH) ( LOW )
.

HIGH LOW 3.3
1 2 3 (
3.3).


Pulse Width

Modulation .
HIGH LOW
HIGH LOW

()
HIGH LOW . Duty Cycle

118

PWM :

.. (
) (
).

PWM Hardware PWM Software PWM


) pin12( 12
GPIO
PWM .
Software PWM GPIO
PWM

119

: Software PWM

Bread Board

Software PWM


Led

311


nano

pwm.py :
nano pwm.py

120
:

:

import RPi.GPIO as GPIO
import time
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(11, GPIO.OUT
)p = GPIO.PWM(11, 50
)p.start(5
)p.ChangeDutyCycle(10
)time.sleep(3
)p.ChangeDutyCycle(40
)time.sleep(3
)p.ChangeDutyCycle(80
)time.sleep(3
)p.ChangeDutyCycle(100
)time.sleep(3
)(p.stop
)(GPIO.cleanup

sudo python pwm.py


3 .



GPIO time PWM:
)p = GPIO.PWM(11, 50
11 PWM 51
p
p .
)p.start(5

%5 = Duty Cycle
)p.ChangeDutyCycle(10
)time.sleep(3

) p.ChangeDutyCycle(10 Duty Cycle PWM


11 %11 ) time.sleep(3
PWM Duty cycle 10% 3.

121
)p.ChangeDutyCycle(40
)time.sleep(3
)p.ChangeDutyCycle(80
)time.sleep(3
)p.ChangeDutyCycle(100
)time.sleep(3

Duty Cycle %11 %01


%01 %111 .

)DutyCycle(10

)DutyCycle(40

)DutyCycle(80

)(p.stop
)(GPIO.cleanup

)( p.stop PWM )( GPIO.cleanup .


( ) PWM

Raspi.tv 2 .
http://raspi.tv/2013/how-to-use-soft-pwm-in-rpi-gpio-pt-2-led-dimming-andmotor-speed-control

ULN2003

122

PWM

PWM GPIO
( ATmega ) PWM

Expanders .

PWM
PWM Adafruit Occidentalis
http://learn.adafruit.com/adafruit-raspberry-pi-lesson-9-controlling-a-dc-motor?view=all
PWM Wiring Pi
https://sites.google.com/site/semilleroadt/raspberry-pi-tutorials/gpio
12 Servo i2C PWM Adafruit PWM
http://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi/overview
32 PWM Pridopia
http://www.pridopia.co.uk/pi-9685-2-lp.html

123




11
13 ( ).

Bread Board


2 311
2

124


blink11.py:
import time
import RPi.GPIO as GPIO
)GPIO.setwarnings(False
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(11, GPIO.OUT
while True:
)GPIO.output(11,True
)time.sleep(2
)GPIO.output(11,Flase
)time.sleep(2

blink13.py:
import time
import RPi.GPIO as GPIO
)GPIO.setwarnings(False
)GPIO.setmode(GPIO.BOARD
)GPIO.setup(13, GPIO.OUT
while True:
)GPIO.output(13, True
)time.sleep(.1
)GPIO.output(13, True
)time.sleep(.1

) & ( and
( )
& :

2577 2579

sudo kill
:
sudo kill 2577
sudo kill 2579

125


killall :
sudo killall sudo python blink11.py
killall :



.


:
.1 ( )

.
.2 (
).

( )

126

: auto login
pi
( ) /etc/inittab
:
sudo nano /etc/inittab
Ctrl + w
1:2345:respawn:/sbin/getty --noclear 38400 tty1
( ) #
#1:2345:respawn:/sbin/getty --noclear 38400 tty1

1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
Ctrl+X y Enter

:
boot auto login /etc/profile
:
sudo nano /etc/profile
(&(
sudo python
:
& sudo python /home/pi/python_programe_1.py
& sudo python /home/pi/python_programe_2.py
& /home/pi/your_programe_1.sh
& /home/pi/your_programe_2.sh

127




Htop
Task Manager
...
:
sudo apt-get install htop y

sudo htop

:

( )21 %25

Kill
F9 F10

128



Nanpy

:
wget https://pypi.python.org/packages/source/n/nanpy/nanpy-v0.8.tar.gz
tar xvf nanpy-v0.8.tar.gz
Nanpy
cd nanpy-0.8
sudo python setup.py install
Nanpy
Firmware Nanpy
firmware :
cd firmware
make boards nanpy
:

nanpy firmware
( mega2560 uno )mini
export BOARD=mega2560
make
make upload

129



from nanpy import Arduino
from nappy import serial manager
from time import sleep
LED =13
Arduino.pinMode(LED, Arduino.OUTPUT)
print ("Start Arduino Blink 5 time")
for i in range(0,5):
Arduino.digitalWrite(LED, Arduino.HIGH)
sleep(0.5)
Arduino.digitalWrite(LED, Arduino.LOW)
sleep(0.5)


ttyACM0

13
13

5

.) (
http://simplyarduino.com/?page_id=5
https://pypi.python.org/pypi/nanpy
https://github.com/nanpy/nanpy
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=46881&p=368522&hi
lit=Arduino#p368522

130



:
sudo apt-get install -y arduino
sudo apt-get install -y python-serial

USB
/dev/ ttACM0 ttyACM1
:
*ls /dev/tty

( LXDE )Electronics
Arduino


UART python-serial
:
http://www.andremiller.net/content/raspberry-pi-and-arduino-via-gpio-uart

131

http://www.fritz-hut.com/2012/08/27/connecting-an-arduino-and-raspberry-pi/
http://codeandlife.com/2012/07/29/arduino-and-raspberry-pi-serialcommunication/

http://www.instructables.com/id/The-Raspberry-Pi-Arduino-Connection/
http://robot-kingdom.com/ways-link-raspberry-pi-with-arduino-using-gpio-serialusb-i2c/

132

i2C
I2C Inter Integrated Circuit Communications
( ) IC
()

.
( )129


.

PIC

i2C Nodes
( SDA )Serial data line (SCL )Serial clock line

133

i2C
address Datasheet

.


( )Master
( )Slave
.
7 Bits:

( START .1 ) : (
)
9( Slave Address .2) :
( Read/Write .3 ) : (
) (
).
( ACK .0 ) :
( read )Write .
: Data (1) .5 .
: ACK .2 .
: Data (2) .9 .
: ACK .0 .
: STOP .7
i2C 51.111 ( 51 )

134

i2C

Digital-to-analogue converters (DACs)


Analogue-to-digital converters (ADCs)
LCD displays
OLED Screens
Keyboards
Motor drivers
LED drivers
Memory chips and cards (EEPROM, RAM, FERAM, Flash)
Bus expanders/extenders (chips with 8 or 16 I/O pins controllable via I2C)
Other microcontrollers (Arduino based, genral AVR families, PIC).


: i2C

135

i2c
i2C GPIO
Inputs/output i2C :
nano :
sudo nano /etc/modules

:
i2c-bcm2708
i2c-dev

:
sudo nano /etc/modprobe.d/raspi-blacklist.conf
( )# ( )
blacklist spi-bcm2708
blacklist i2c-bcm2708

sudo reboot
i2C i2C:
sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools

: Adafruit i2c SPI


UART .

136

: BMP085

BMP085
( ) i2C

( ) i2C Address
2 ( 512)
1 (1 252) .
sudo i2cdetect -y 1 #if you use raspberry pi V.2
sudo i2cdetect -y 0 #if you use raspberry pi V.1
i2C

0x77

137

Adafruit (
) Github :
git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git

i2C :
cd Adafruit-Raspberry-Pi-Python-Code
cd Adafruit_I2C

2 B
Adafruit_I2C nano Adafruit_I2C
def __init__(self, address, bus=smbus.SMBus(0), debug=False):

( )
)def __init__(self, address, bus=smbus.SMBus(1), debug=False
Adafruit_BMP085

sudo python Adafruit_BMP085_example.py

:
from Adafruit_BMP085 import BMP085
)bmp = BMP085(0x77
)(temp = bmp.readTemperature
)(pressure = bmp.readPressure
)(altitude = bmp.readAltitude
print "Temperature: %.2f C" % temp
)print "Pressure: %.2f hPa" % (pressure / 100.0
print "Altitude: %.2f" % altitude

Adafruit_BMP085

138

i2C
GPIO GPIO Expander
i2C
http://learn.adafruit.com/mcp230xx-gpio-expander-on-the-raspberry-pi
Character 16x2
http://learn.adafruit.com/adafruit-16x2-character-lcd-plus-keypad-for-raspberry-pi
RTC
http://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi

)Seven Segment(
http://learn.adafruit.com/matrix-7-segment-led-backpack-with-the-raspberry-pi
Digital to Analog Converter (DAC)
http://learn.adafruit.com/mcp4725-12-bit-dac-with-raspberry-pi

12 Servo Motor
http://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi
) ( BMP085
http://learn.adafruit.com/using-the-bmp085-with-raspberry-pi

139

):

GPIO

140

MIT
MIT
.


( 0 )

.

()



...

141


01
:

:
:


0
http://scratch.uaeu.ac.ae/

: GPIO
( )
.

142

GPIO Scratch


GPIO
.

GPIO
Raspian
GPIO
:
sudo wget https://db.tt/mwn3LsYv -O isg.sh
sudo bash isg.sh


ScratchGPIO3 :

""

143


ScratchGPIO
( 11 ) File
Open Blink11 :

11 311 (
) " "
.
" ".

144


( ) controls
When Key pressed :

forever When Key pressed

space up arrow

145



:
( )Scratch
GPIO

(
)http://www.pridopia.co.uk/rs-pi-set-scratch.html:


http://scratch.uaeu.ac.ae/
http://cymplecy.wordpress.com/2013/04/22/scratch-gpio-version-2-introduction-for-beginners/
http://cymplecy.wordpress.com/2013/12/27/scratchgpio-documentation/

146

WebIOPi

GPIO

147

WebIOPi


WebIoPI Internet of Things
( + ) GPIO
.
WebIOPi
Firefox, Chrome,
Opera
.
GPIO

Expanders Shift Registers
i2C SPI 31
https://code.google.com/p/webiopi/

WebIOPi
WebIOPi
wget http://webiopi.googlecode.com/files/WebIOPi-0.6.0.tar.gz
:

148



:
tar xvzf WebIOPi-0.6.0.tar.gz
cd WebIOPi-0.6.0
sudo ./setup.sh

( )

21
21 .



Home Automation
:
sudo update-rc.d webiopi defaults
( ) Reboot


Ip Address ifconfig
192.168.1.8

149

( )
:8000 :
http://192.168.1.8:8000

webiopi raspberry
:

WebIOPi
0 :
.1 :GPIO Header
.
.2 :GPIO list .
.3 :Serial Monitor

( Serial Monitor )Arduino IDE
.0 :Device Monitor
(
).

150

GPIO list & GPIO Header



:
GPIO Header

GPIO List

( | )
IN OUT .
1 22 Pin
HIGH
3.3
( ).

3.3
3.3 .

151

WebIOPi
Led 311 2
OUT IN


221
Relay Board

152

Device Monitor

WebIOPi
DS1822 ADS1014
:
http://code.google.com/p/webiopi/wiki/DEVICES
/etc/webiopi/config


.
Device Monitor Expansion Board

.ADC

153

Bread Board

DS18B20

WebIOPi

DS18B20

4.7

1Wire
1Wire
sudo modprobe w1-gpio
sudo modprobe w1-therm

154


( 1Wire )
cd /sys/bus/w1/devices
ls

ls 28-000004598ef8 :

WebIOPi
/etc/webiopi/config :
sudo nano /etc/webiopi/config

#temp0 #temp1
( # ).

DS18b20 :
temp3 = DS18B20 slave:28-000004598ef8

28-000004598ef8 .

155

Ctrl+X
Y Enter
WebIOPi Devcies Monitor :


DS18B20 1Wire
:

156


WebIOPi :
temp3 = DS18B20 slave:28-0000045348ev5
temp4 = DS18B20 slave:28-00000411984n
temp5 = DS18B20 slave:28-000006698xcf
/sys/bus/w1/devices


1Wire i2C :
temp1 = TMP102 slave:0x49
temp2 = TMP102 slave:0x50
temp3 = DS18B20 slave:28-0000045348ev5
temp4 = DS18B20 slave:28-00000411984n


WebIOPi
5
1Wire 3 i2C
:

Temperature sensor
Temperature sensor
Temperature sensor
Temperature sensor
Temperature sensor
Temperature sensor
Temperature sensor
Temperature sensor

1-Wire
1-Wire
1-Wire
1-Wire
1-Wire
I2C
I2C
I2C

DS1822
DS1825
DS18B20
DS18S20
DS28EA00
TMP75
TMP102
TMP275


1Wire
:
http://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20temperature-sensing/overview


http://raspbrew.tumblr.com/post/39850791984/reading-temperatures-ona-raspberry-pi-using-ds18b20
http://www.sbprojects.com/projects/raspberrypi/temperature.php

157

WebIOPi
: Client Server

client
WebIOPi Server
.
WebIOPi .
Pi-2-Pi communication

Serial monitor
.Firmata


http://code.google.com/p/webiopi/wiki/README?tm=6

WebIOPi



http://trouch.com/2013/03/04/webiopi-in-themagpi-cambot-tutorial/




http://inductible.wordpress.com/2013/02/23/tel
emus-a-remotely-operated-vehicle-based-onraspberry-pi-and-arduino/

158

159

USB Web Camera


( )


.
3 ( 21
)
4Tech .


Web

Camera
USB (
)


USB Boot .
USB
/dev/ :
lsusb
*ls /dev/v

( )

( video0 ).

160


fswebcamera :
sudo apt-get install fswebcam y
test.jpg
/home/pi :
fswebcam -d /dev/video0 -r 640x480 test.jpeg

fswebcam
-d /dev/video0 /dev

-r 640x480 Resolution
test.jpeg
/home/pi

161


ffmpeg
mplayer :
sudo apt-get install ffmpeg -y
sudo apt-get install mplayer -y

test.avi 640x480 :
ffmpeg -f video4linux2 -r 25 -s 640x480 -i /dev/video0 test.avi
ffmpeg avi Ctrl+C

/home/pi :


mplayer /home/pi/test.avi


VNC .

162




.
Motion

:
Motion Detector
.


Frame Rate

Motion
:
sudo apt-get install motion-y


motion
etc/default/motion/ "" :
sudo nano /etc/default/motion

start_motion_daemon=no no yes
motion Ctrl+X :

163


""

:
sudo nano /etc/motion/motion.conf

:
: daemon off daemon on

: 201 001

164


: webcam_localhost on on off

Ctrl+X
sudo reboot


( ) :
http://192.168.1.7:8081

192.168.1.7 :8081

VLC
File Open network stream .

165

Motion


HD
http://www.codeproject.com/Articles/665518/Raspb
erry-Pi-as-low-cost-HD-surveillance-camera



http://www.makeuseof.com/tag/how-to-capturetime-lapse-photography-with-your-raspberry-piand-dslr-or-usb-webcam/


https://medium.com/p/2d5a2d61da3d


http://astrobeano.blogspot.com/2012/08/raspberrypi-with-two-webcams.html



.

.

166






:
Face Recognetion




ASIMO


Word fiel

Motion Estimation

Image Restoration

Object Recognition

Video Tracking


) OpenCV (Open Computer Vision
Python, C, Java, Ruby,
VB, C#.net Windows, Mac, Linux, Solaris

167



( )Compiling

.
Debian
python-opencv
( : ):
sudo apt-get install y python-opencv
sudo apt-get install y libcv-dev libopencv-dev libcv2.3 opencv-doc

35 11
openCV
( wget ):
wget http://stevenhickson-code.googlecode.com/svn/trunk/AUI/Imaging/test
chmod +x test
./test


( Terminal ) .

168


" "

face_detect_rpi.zip ( wget

):
wget http://goo.gl/oA8SB0


unzip face_detect_rpi.zip

facedetect.py face.xml
python facedetect.py cascade=face.xml 0

( Vendetta )V for Vendetta



( 291 ).

169



""
Magic mirror
openCV
Face Recognition


:
http://www.youtube.com/watch?v=yzYIxNgDZu4
""



""
9
:
http://thinkrpi.wordpress.com/2013/05/22/opencv-and-camera-board-csi/
: openCV
compile
.

170



OpenCV
http://opencv.org/books.html

171

WiFi

3G Usb
Modem

WiFi

Internet

3G

172


USB
2
( ) Alfa Wifi 3
Tplink WN321, Dlink-802.11n, Alfa Wifi AUS036

Alfa Wifi

external powered usb


hub

173


WiFi Config
:

Scan


add

174


connect
.



/etc/network/interfaces ( )
:
sudo nano /etc/network/interfaces


iface wlan0 inet dhcp
"wpa-ssid "ssid
"wpa-psk "password

ssid
password
my-network-ssid my-wifi-password
iface wlan0 inet dhcp
" wpa-ssid " my-network-ssid
"wpa-psk "my-wifi-password

175

Ctrl+X wifi


ifconfig
wlan0 eth0
wlan0 192.168.1.10:

176

USB (3G) Modem


3G modem
:
o
3G modems
.
o ( )USB flash disk
o 3G internet 1 02
3G modem

: 3G modem
3G modem :
" ."Etisalat Egypt

:

177

:

sudo apt-get install sg3-utils ppp wvdial -y

: 3G modem
3G modem


*ls /dev/tty

dev/ttyUSB0/

(
).

3G modem
USB flash disk

sudo apt-get install usb-modeswitch
sudo /usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00

usb-modeswitch

.


*ls /dev/tty
dev/ttyUSB0/ dev/ttyUSB1/
USB modem

178

:


...
etc/wvdial.conf/

sudo nano /etc/wvdial.conf


][Dialer etisalat
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Phone = *99***1#
ISDN = 0
" " = Username
" " = Password
Init1 = ATZ
"Init3 = AT+CGDCONT=1,"IP","internet.etisalat
Modem = /dev/ttyUSB2
Baud = 7200000
Auto DNS = 1
Dial Command = ATDT
Carrier Check = yes
Stupid Mode = 1

" "

179


:Phone ( ) server
( - -)
*99***1#
*99#

o
o

:Username ( )
""blank
:Password ( )
: Baud
:
115200
7200000
9600

o
o
o

:Modem ls /dev
o /dev/ttyUSB0
o /dev/ttyUSB1
o /dev/ttyUSB2



ZTE MF190S
Configurations :
ZTE MF190S Linux connection configurations

180


USB Modems

ZTE -
[Dialer etisalat]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Phone = *99***1#
ISDN = 0
Username = " "
Password = " "
Init1 = ATZ
Init3 = AT+CGDCONT=1,"IP","internet.etisalat"
Modem = /dev/ttyUSB2
Baud = 7200000
Auto DNS = 1
Dial Command = ATDT
Carrier Check = yes
Stupid Mode = 1
Huawei -
[Dialer vodafone]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Phone = *99***1#
ISDN = 0
Username = "internet"
Password = "internet"
Init1 = ATZ
Init3 = AT+CGDCONT=1,"IP","internet.vodafone.net"
Modem = /dev/ttyUSB0
Baud = 115200
Auto DNS = 1
Dial Command = ATDT
Carrier Check = yes
Stupid Mode = 1
internet

:
etc/wvdial.conf/

181

:

sudo wvdial etisalat &
Etisalat

sudo wvdial vodafon &
IP address

WvDial: Internet dialer version 1.61


--> Initializing modem.
--> Sending: ATH
ATH
OK
--> Sending: ATE1
ATE1
OK
--> Sending: AT+CGDCONT=1,"IP","internet"
AT+CGDCONT=1,"IP","internet"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Fri Jun 14 22:35:19 2013
--> Pid of pppd: 3145
--> Using interface ppp0
--> pppd: y
--> pppd: y
--> local IP address 10.133.163.246
--> pppd: y
--> remote IP address 10.64.64.64
--> pppd: y
--> primary DNS address 89.108.202.20
--> pppd: y
--> secondary DNS address 89.108.195.20
--> pppd: y

182

Sakis3G

Sakis3G 3G modem
.

"wget "http://raspberry-at-home.com/files/sakis3g.tar.gz
sudo mkdir /usr/bin/modem3g
sudo chmod 777 /usr/bin/modem3g
sudo cp sakis3g.tar.gz /usr/bin/modem3g
cd /usr/bin/modem3g
sudo tar -zxvf sakis3g.tar.gz
sudo chmod +x sakis3g


sudo ./sakis3g --interactive

183

3G modem
3G modem
" LAN "Ethernet Wi-Fi IP
VNC SSH WebIoPi .

:
NAT 3G modem

Static IP address

.

184

USB modem Power usb Hub



.

o USB modem

https://wiki.archlinux.org/index.php/Wvdial
http://john.de-graaff.net/wiki/doku.php/links/umts_debian
http://www.instructables.com/id/Raspberry-Pi-as-a-3g-Huawei-E303-wirelessEdima/
http://lakm.us/logit/2013/03/modem-usb_modeswitch-raspberry-pi/
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=18996

185

Raspi-Config


1111

186

Raspi-Config
raspi-config

.
:
sudo raspi-config

( ) 2

Change user password


2
pi raspberry
( 0 ).

Enter

187

raspi-config .


Enable Boot to Desktop
Boot 3
:

: Console text .1
( boot)
: Desktop log in as user "pi" .2 LXDE
( ) booting
: Scratch start .3 Scratch


Scratch .
Desktop log in
.

188


Internationalisation option
:

: Change Local

:


ar_EG.UTF-8 (space)

189


Tab Ok

Enter

( )

( ).

.
Internationalisation option
( ).

(
)

190

" "Cairo Tab ok Enter

Internationalisation option
Change Keyboard Layout :

() ()

191


Enable Camera
CSI Camera
CSI Enable Camera Raspi-

. Config

192

Rastrack


.

rastrack
( )http://rastrack.co.uk .

193

( )
Overclocking " " CPU
GPU RAM
overclock raspi-config
.
:

.


5 :

: None .1 CPU GPU


.
:Modest .2 011 .
:Medium .3 711
051 ( 011 ).
:High .0 751 051
: Turbo .5 ( 1111)
GPU 511 ( )251
211 .

194


%51
%211

High Turbo




.
() Heat Sink


Sticky Thermal Compound
.
( )

= 52
= 19 .

:
http://www.michaeldornisch.com/2012/06/diy-raspberry-pi-heat-sink.html

195


( BCM )


:
vcgencmd measure_temp

00.9 :


http://elinux.org/RPiconfig
http://htpcbuild.com/htpc-software/raspberry-pi-openelec/openelec-overclocking/
http://www.raspberrypi.org/archives/2008

196
Advanced Options

" "Advanced option 2 :

: Overscan
HD
.
: Hostname
.
: Memory Split RAM
512

GPU
( RAM 20 20 = GPU 448 = RAM

).

: SSH
( )
: SPI SPI GPIO
.
:Update raspi-config .

197


Backup


Ghost backup .


Win32 Image Writer
Read .Write
:
d:\raspberry-pi-backup.img
raspberry-pi-backup.img ( ) /:d

: Read raspberry-pi-

backup.img (
)
.

198

dev/sdb/

ls /dev
*sudo umount sdb
raspberry-pi.backup.img
sudo dd if=/dev/sdb of=~/raspberry-pi-backup.img bs=1M

3810+0 records in
3810+0 records out
3995074560 bytes (4.0 GB) copied, 340.63 s, 11.7 MB/s


Win32 Disk
image Writer Write

199

FM

200

FM



FM.
" "

FM :
http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_F
M_Transmitter


( )
FM Modulation ( 911 )
+ 9 .


:
11 21 ( )
jumber
Antenna .
FM
( FM )
111 .

201


.1 9
.2 fm
FM :

mkdir fm
cd fm
wget http://www.icrobotics.co.uk/wiki/images/c/c3/Pifm.tar.gz

202


:
tar -zxvf Pifm.tar.gz


sound.wav
FM
(
fm

).
sudo ./pifm sound.wav 100.0

( )SuperMan
111
sound.wav 111 :
sudo ./pifm sound.wav 101

1 251

01 111 ( FM ).



sudo python
:
sudo python
>>> import PiFm
)">>> PiFm.play_sound("sound.wav

203


wav files mono
mp3 ogg wav
Mono sound
Stereo
Stereo :
http://www.reddit.com/r/raspberry_pi/comments/14k5o3/raspberry_pi_fm_transm
itter_with_no_additional/c9mt1l5
:
%91 .
.

:
21 ( 11 ).
FM 11
( 21 ).

(
)
.
.
.

:
http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Tran
smitter

204

Supercomputers

Cluster computers


NASA


%71
Parallel Programming
..

205


:
: 3
121 .
: 3
.
: 05 .


3 :
.1 :Master
.2 :Slaves
.3 :Switch

206

207


http://www.huntrods.com/teaching/raspberrypi.html
http://raspberrywebserver.com/raspberrypicluster/raspberry-pi-cluster.html
http://www.lab7.io/test/rpi-cluster-1/
https://www.southampton.ac.uk/~sjc/raspberrypi/
https://blogs.nvidia.com/blog/2013/07/19/secret-recipe-for-raspberry-pi-servercluster-unleashed/
http://blog.afkham.org/2013/01/raspberry-pi-control-center.html
http://blog.afkham.org/2013/02/building-raspberry-pi-cluster-part-2.html

208


!

.

511 !!!
" "Dave Akramen

.

209

210

211


01
.



Raspberry pi in

space .
PDF
.
www.daveakerman.com/wp-content/uploads/2013/01/Raspberry-Jam-Pi-In-The-Sky.pdf


http://www.daveakerman.com

212


Quadcopter UAV





http://www.ctndev.org/index.php?page=phoenix
https://github.com/cTn-dev/PhoenixFlightController
EggPot

( )


http://www.instructables.com/id/How-to-Embed-aRaspberry-Pi-into-your-eggbot/?ALLSTEPS

Mini Nerf Gun Robot




Mini Nerf Gun Robot
http://jordanbalagot.com/blog/2013/02/26/rasp
berry-jolt-my-mini-nerf-gunrobot/?autoplay=false

213







http://www.instructables.com/id/Making-anautonomous-boat-with-a-Raspberry-Pi-a-/




()

.
http://www.instructables.com/id/Raspberry-PiTemperature-Humidity-Network-Monitor/





http://www.lvaqi.org/2013/

214

:


netduino
ATiny

20

http://homealarmpluspi.blogspot.com/2013/04/
blog-post.html
Web Cluster



Web server 0
Web


0
211 011

http://raspberrywebserver.com

()Cloud Server



http://blog.petrockblock.com/2012/08/15/yourown-cloud-server-with-owncloud-on-theraspberry-pi/

215



( )


SNMP
http://www.bigi.com/wiki/Envmon


Torrent




http://blog.snapdragon.cc/raspberry-pi-as-bittorrentserver/

" "
Khan-Academy

()



.
http://pi.mujica.org/





.
http://contractorwolf.wordpress.com/raspberry-piradio/

216


http://learn.adafruit.com/category/raspberry-pi
http://readwrite.com/2014/01/21/raspberry-pi-great-projects
http://www.instructables.com/tag/type-id/?sort=none&q=raspberry+pi
http://www.daveakerman.com/
http://makezine.com/2013/04/14/47-raspberry-pi-projects-to-inspire-your-next-build/
http://www.wolfram.com/raspberry-pi/
http://blog.sheasilverman.com/raspberry-pi-emulation/
http://www.instructables.com/id/How-to-Make-a-ArduinoRaspberry-Pi-Robot-Platform