Beruflich Dokumente
Kultur Dokumente
1
:
3
:
6 JAVA -1.1
6 JAVA -1.1
7 JAVA -3.1
8 ArduinoC -1.1
8 ( ) -1.1
8 Android -6.1
11 1.1
11 1.1
11 Linux Kernel : 1.3
11 Libraries 1.1
11 Android Runtime 1.1
11 Application Framework 1.6
11 Application 1.7
11 1.8
11 Activity 1.8.1
17 Intent 1.8.1
:
61 1.1.1
61 3.1
61 - DC 1.3
68 - )) RC 1.3
71 3.1
71 HC-06 3.3
71
71 What is The BlueTooth
71 whatre The
BlueTooth Applications
71 The Naming Reason
71 BlueTooth technical
challenges
76 BlueTooth Tech.
Specifications
76
Does The Bluetooth Reciprocal
Signals Interfere
77 UltraSonic HC-SR04 3.1
81 3.1
V9
81 V21 3.6
81 3.7
81 3.8
87 1.1
91 1.1
93 1.3
91 1.1
91 CODES 1
91 Arduino 1.1
111 1.1
111 1
113 3
111 1
111 1
111 1.1
111 1.1.1
:
111 1.1.1
116 1.1.3
116 1.1.1
:
117 1.1.1
117 1.1.6
117
118 1.1.8
118 6
119 7
111 Smart Car Chassis Model: KYS002
111
L9110_2_CHANNEL_MOTOR_DRIVER
116
Double Speed Measuring Module with
Photoelectric Encoders Model: HC-020K
131
139 Yasser Code of App
RobotControl
Joystick
For ioio board with ld298 or l293d
111
111
111
7 Robotcontroll
1 JoyStickClass robotcontrol
activity_robot_controllayoutl
AndroidManifest robot
Yasser
111
:
)
(
***
***
, , , ,
, .
***
,
.
( ) :
( )
.
, , , ,
, , , , ,
, , , ,
( ) .
: , ,
: , .
: , , , , .
VIVANA Roze :
Simon Monk :
:
***
***
***
***
***
***
(( : ))
(( ))
***
( ) ((
)) :
***
,
***
***
***
***
***
,
( ) , :
***
***
:
, ,
,
. ,
,
***
***
***
***
***
( , ,)
( )
) (
(( , , , , , , , , ))
(( , , ))
, , ,
, ,
.
, ,
***
, , , ,
, (( )):
****
****
****
:
****
, :
, , , , , , , , , , , ......
***
***
***
,
:
***
***
////
:
(( ))
))
((
***
((
***
))
( )14-14
***
***
(2//2)
:
:
,
.
IOIO .
((
,
))
293 298
pwm ((.
(())
)).
:
(
) .
https://www.youtube.com/channel/UCq0RbRuLe3oFb9e12vqzaUg
https://www.facebook.com/groups/micro.fpga.plc/?ref=bookmarks
. Eletorial
. Eletorial
https://www.facebook.com/yasser.karkoukli
https://www.facebook.com/yasser.karkoukli
, .
:
:
37
.
(
)
( , ,
, ,
) PC
, ARMX,FPGA . ,
, ,
,
,
(
1
:
)
,
,
.
,
,
,
.
:
-*1
.
-*2
.
-*3 " : "
Intelligent robots
-*4
.
2
:
:
.
.
( ,
)
.
:
) ARDUINO BOARDS (LIKE UNO ,MEGA, DUE ..etc
OTG/ IOIO
ATmega328p-pu
3
:
Summary:
Arduino is an open source project consisting of both hardware and
software. It was originally created to give designers,artists and
Engineers a prototyping platform for interaction design courses,
According to open-source software offices dealing with multiple
segments.
Also android operating system is the best one for the smart
phones as an open source system Programmable and
development.
Today hobbyists and experts all over the world use them to create
physical computing and programming projects ,
Especially in the field of robot and intelligent control.
Through networked together (slides and PCB Arduino Circuit ,
programs and applications of Android systems) more easily afford
to build , So Arduino Boards and android system make it easier
than ever to build ,develop handcrafted electronics projects
ranging from prototypes to sophisticated gadgets.
KeyWords:
Arduino IOIO/OTG
Arduino Boards /UNO
Integrated circuits (IC) & Microcontrollers
Microprocessor
IDE: Integrated Development Environment
ATmega 328P-PU
Android , Smart phones, Thread , Process
4
:
:
-1.1 :JAVA
machine language
assembly language
High-level languages HLL
JAVA
-2.1 :JAVA
JAVA
( ) operating systems Windows XP
UNIX , JAVA C++
Sun Microsystem
7
JAVA 1990
:
-1 .
-2 .C++
-3
.
:
-1
)OOP (Object Oriented Programming
Classes
Class
Classes main
Object .
5
-2 IOIO/OTG
ArduinoC . Arduino UNO
-3
software ,hardware C
Binary
.
ByteCode
.
()1.1
JAVA
, JAVA
-3.1 JAVA :
:
> > = = % / * -
Switch }{)( | &
,If(){}else{},?:,while(){},for(){},do{}while(){},
C++
Classes () ,
Constructor ,
7
:
Classes manifest , Layout , Activity
-4.1 :ArduinoC
C++
Processing
Arduino IDE
-5.1 ( ):
Windows
, BADA , IOS , Phone , Symbian OS
. Black Berry Android
Open Source Operating System
, .
Proprietary
EULA
EULA
,
-6.1 : Android
8
Android
,
.
( )web Kit OSS
( )Google chrome ( )OpenGL ES
( )SQLite
)GPS(
( )Accelerometer
portable
, ,
.
Open Source Linux
,
Open Handset Alliance
. Google
2005 Google Android
, 5 2007
9
2008 HTC & T-Mobile
G1 Android SDK1.0 . Android Market
, Apache License
) (AOSP
.
, . JAVA
:
) (Gingerbread 2.3 ,
, , , ,
)Session Initiation Protocol (SIP
) (Honeycomb 3.0 , ,
,
) (Ice Cream Sandwich 4.0 ,
19 , 2011 ,
,
, ,
) (Jelly Bean ( 4.2\4.1 )
Google Now
.
1.1 :
, API level
11 ,
API Level Backward Compatibility
01
API Level
,
.
1.2 :
( )2 - 1
0 2: Linux Kernel
00
linux Kernal ( )3 - 1
:
Display Driver
Bluetooth Driver
Camera Driver
Flash Memory Driver
Binder (IPC) Driver
Keypad Driver
USB Driver
Wi-Fi Driver
Audio Driver
Power Management
.
.
1.4 : Libraries
01
( )4 - 1
Surface Manager
Media Framework
SQLite
OpenGL ES
Free Type
Web Kit
SGL
SSL
Libbc
.
.
SQLite ,
SQLite .
Web Kit ,
.
.
02
1.5 : Android Runtime
( )5 - 1 runTime
( )6 1 framework
Framework Manager
Window Manager
.
.
1.1 : Application
03
( )1 - 1
:
Home
Contacts
Phone
Browser
Application Framework
1.1 :
Activity 1.1.1
Activity , Screen
Activity
Activity Layouts
XML
Activity Layout
Activity , class
Intent
)( Activity Lifecycle
Activity src .java
Layout res .xml
R.java APK
bin
mainfest
Activity Launched :
)(: onCreate , .
)( : onStart ( )
04
)( : onResume ,
.
Running ,
:
)(: onPause , .
.
)( onPause() , onStop
)( kill )(onCreate
)( : onStop ,
. .
)(: onRestart )(onStart
.
)( : onDestroy , )( kill
.
05
( )1 - 1 activity
: Intent 1.1.2
Intent ,
. .
.
... .
07
,
. Intent Action ,
Data . Data Intent
Bundle value , key .
1.1.4:Android Manifest
, xml
( API Level
, Permissions , Activities
)
. .
08
:Content Providers 1.1.6
Data ,
URI Public Data Set .
.
Content Providers) (Contacts, Media,
:SDK 1.1
, ) , )IDE
( )Source Code
( )GUI ( )Compiler
:ADT 1.11
) (
: AVD 1.11
,Emulator
AVD Emulator
:APK 1.12
app run
apk app.apk
09
: Eclipse 0 02
Eclipse IDE JAVA
Android , JAVA Eclipse ,Python
Pascal , C#
IDE
plugin
Eclipse
ADT, AVD , SDK
Eclipse
, Eclipse
Eclipse IBM 1996
2004
Eclipse
Eclipse Plug-in
Eclipse
Android studio
11
1. Android SDK (Android Studio, no longer Eclipse)
http://developer.android.com/sdk/index.html
2. All the Android tools and Android APIs (e.g. Android 4.4.2). This might take a couple of
hours
Some packages might not get installed but thats ok.
http://developer.android.com/sdk/installing/adding-packages.html
3. The latest IOIO libraries (Client Software, 5.06/5.05: App-IOIO0505.zip)
https://github.com/ytai/ioio/wiki/Downloads
: Arduino IDE 0 03
/http://www.arduino.cc ArduinoC
10
Genymotion 0 04 :
APK
: C
11
-1.1 : IOIO
,
IOIO jar apk
IOIOLib , ,
IOIO
( IOIOLibPC Eclipse ) IOIOLib/target/pc
IOIO
( IOIOLibAndroid Eclipse
) IOIOLib/target/android IOIO
, IOIOLibAccessory , IOIOLibBT
IOIOLibAndroid Bluetooth Android Open
Accessory , IOIO
IOIOLibAndroid
( ) v1.5 Bluetooth
v2.x () 2.3.4
,
IOIO ,USB
IOIOLib API JAVA ,
IOIOLib
IOIOLib Workspace
Eclipse :
File > Import... > General > Existing Projects>workspace
12
IOIOLib
properties
IOIOLibAndroid "" Finish
, Bluetooth , Android Open Accessory
IOIOLibAndroid IOIOLibAccessory
android.permission.INTERNET
android.permission.bleutooth
, AndroidManifest.xml
tab > Add... > Uses Permission > android.permission.INTERNET
Settings > Applications > Development > Enable USB Debugging.
IOIOLibPC " . "Finish
IOIOLibPC , JAVA
IOIOLib
The IOIOLib Core API API
IOIO
The IOIOLib Application Framework
, IOIO ,
IOIO
JAVA
ioio.lib.api IOIOLib API
, IOIO ,
, PC PC
Android
ioio.lib.util IOIOLib IOIO
ioio.lib.util.android
13
Android , IOIO
ioio.lib.util.pc JAVA PC
14
62
()1
1.1 IOIO
IOIO , )1
USB Bluetooth
JAVA
IOIO USB
2
,PWM , , I C
, , SPI , UART
IOIO .
, ,
, Bluetooth , ,
.
62
IOIO ,
.
PIC -1
USB HOST
.
6Port , 64Pin
TPS62112 1.8 , -2
)5-15 5 Pin VBUSS USB
)34 IC1 3.3
IC1 3.3 PIC24F -3
)Trimpot smd) R2 USB -4
1.1 :PIC24FJ256DA210
16 32Mhz
8Mhz
17Bit 17Bit
16Bit\32Bit
1616
C
16Mbyte
1.8
62
3.3v , 800uA/MIPS :
20uA
32Khz 22uA
2.2v-3.6v
5.5v
18mA
POR
BOR
RC
ICSP
\ ) EPMP/PSP
UART
\ 16Bit
, 16Bit
PWM
RTCC
CRC
)2
62
)3
03
1.1 :IOIO
IOIO :
)4
USB ) A
9 GND ) .
3 Vin )
)5-15.
3 3.3 V ) : 3.3 V
3 5V ) 5V
Vin
.
.
mclr ,
Bootloader IOIO firmware
.
03
)CHG
USB VBUS
. )+ .
)5
IOIO I/O
,
3.3v , 3.3v
, .
, , , Legend
,)3.3v
, 5v 5v
. I/O
.
06
Schimatic
)5-1
00
P
) . .SPI-PWM-UART
Pi ) ,
. DAx CLx
. (two wire interface )TWI
) 1.5v )
. 33-40 45-48 P
. PWM
A/D .
PPSi
)UART-SPI- :
.
PPSo
:
. )UART-SPI-
5V 5V , 5V 5V
.
. Comp
-1 : / )(GPIO
-2 .
03
03
/RG9
31 Y Y Y 1A C3 11 PGEC3/AN5/C1INA/VBUS
ON/RP18/CN7/RB5
32 Y Y Y 1B D3 12 PGED3/AN4/C1INB/USB
OEN/RP28/CN6/RB4
33 Y 2A 13 AN3/C2INA/VPIO/CN5/R
B3
34 Y Y Y 2B 14 AN2/C2INB/VMIO/RP13/
CN4/RB2
35 )Y (ref + Y Y C1 15 PGEC1/AN1/VREF-
/RP1/CN3/RB1
36 )Y (ref - Y Y D1 16 PGED1/AN0/VREF+/RP0/
CN2/RB0
37 Y Y Y C2 17 PGEC2/AN6/RP6/CN24/R
B6
38 Y Y Y D2 18 PGED2/AN7/RP7/RCV/C
N25/RB7
39 Y Y Y 21 AN8/RP8/CN26/RB8
40 Y Y Y 22 AN9/RP9/CN27/RB9
41 Y 23 TMS/CVREF/AN10/CN28
/RB10
42 Y 24 TDO/AN11/CN29/RB11
43 Y 27 TCK/AN12/CTEDG2/CN3
0/RB12
44 Y 28 TDI/AN13/CTEDG1/CN31
/RB13
45 Y Y Y 29 AN14/CTPLS/RP14/CN32
/RB14
46 Y Y Y 30 AN15/RP29/REFO/CN12/
RB15
47 DA1 Y Y Y 31 SDA2/RP10/GD4/CN17/R
F4
48 CL1 Y Y Y 32 SCL2/RP17/GD5/CN18/R
F5
stat Y Y Y 33 RP16/USBID/CN71/RF3
LED
mclr Vpp 7 MCLR
02
.
,
.
PWM
, PWM DC
. (1-2)ms 1ms
) , 2ms
) , 1.5ms .
,
.
)6 PWM
, ,
)6
IOIO
, ,
,
.
,
.
.
,
.
IOIO
. 16Bit
02
65535
32Bit 4.3 .
,
HIGH LOW
) ,
, 4 16 ,
. .
.
API
) .
.
65535
) .
02
16MHz 1 62.5ns 4.096ms 244.1Hz
2MHz 16 31.25ns 2.048ms 488.3Hz
16MHz 4 15.6ns 1.024ms 976.6Hz
16MHz 16 3.9ns 256us 3.906KHz
. 16Mhz
:
:
)IOIO.openPulseInput(n n
PulseMode.POSITIVE
PulseMode.NEGATIVE
PulseMode.FREQ
;)(pulse.close
.
,
.
. .
02
IOIO
.
, .
. AnalogInput
, .
AnalogInput
Pinnum
AnalogInput
, .
, :
;)(In.close
)floating ,
,
) .
.
, .
;)In.SetBuffer(capacity
33
capacity
. ,
.
)( In.getOverFlowCount
)(in.getsampleret
: 1000 )1khz
. ) .
IOIO
500khz ) .
1.1 :IOIO
)
. GPIO -LOW
HIGH 0 true , 1 . false
, ,
) .
IOIO ,
, . LED ,
.
33
, , IOIO
:
LOW 0V
.
HIGH 3.3V
.
, LOW
LOW HIGH . HIGH , LED
,)LED 220
. HIGH
,
:
LOW 0V
, .
HIGH
, .
.
5V / 0V .3.3V / 0V
.
5V . 5V
. 5V
.
.
: ,
0V / 5V . ,
36
,
, bus
,
, ,
3.3V . 5V
BUS , , 0V
BUS . , HIGH
, BUS " "
.
IOIO ,
. IOIO
.
, ..
IOIO .
.20MA 20MA
. 150ohm 3.3V
222 .
,
.
, ,
, ) ,
) .
, .
30
, IOIO ,
.
,0V LOW
,3.3V . HIGH ,5v
,5V . HIGH
, :
.
, . " " ,
.
, .3.3v HIGH
0V . 6 "
0V LOW
3.3V 5V ) .
" .
.
. , ,
. HIGH ,
,0V . LOW
. 3.3V
IOIO DigitalOutput.
,
. DigitalOutput
, IOIO.openDigitalOutput(). :
;)DigitalOutput out = ioio_.openDigitalOutput(pinNum
pinNum ,
) ,
:
= DigitalOutput out
ioio_.openDigitalOutput(pinNum,DigitalOutput.Spec.Mode.OPEN_DRAIN,
;)startValue
33
startValue LOW ) HIGH .
. Javadocs
IOIO .
.
:
LOW HIGH
.
,DigitalOutput LOW :
;)out.write(false
HIGH :
;)out.write(true
, , :
;)(out.close
, floating
IOIO . DigitalInput
,
. DigitalInput
IOIO.openDigitalInput(). :
;)DigitalInput in = ioio_.openDigitalInput(pinNum
pinNum ,
) , ,
, ,
:
;)DigitalInput in = ioio_.openDigitalInput(pinNum,DigitalInput.Spec.Mode.PULL_UP
33
false true ,
.
DigitalInput
, , ,
:
;)in.waitForValue(true
. HIGH false ,
. , ,
, :
;)(in.close
PWM :
;)PwmOutput pwm = ioio.openPwmOutput(pinNum, freq
. Hz pinNum PWMfreq
5 .
5
PwmOutput pwm = ioio.openPwmOutput(new DigitalOutput.Spec(pinNum,
;)Mode.OPEN_DRAIN), freq
dc DutyCycle
;)pwm.setDutyCycle(dc
dc )1-2 )%122-%2
dc 2.5 . %52
32
;)pwm.setPulseWidth(pw
pw 1222 2
;)(pwm.close
12 12 .
1.1 :IOIO
)
.
.
. Q V
. Q/V )
. C ,
,
) , .
.
IOIO 16
. 31 - 46 16 64
. Charlieplexing 88
16 16ms
,
IOIO .
) .
.
32
, 20-50ms
.
IOIO
. IOIO
.
, IOIO
)7
)7
3.3
. 27pf IOIO
,
.
.
%10
2700 pf ) ,
.
32
IOIO .Capcence
.
)( IOIO.OpenCapSence
;)CapSence capSence=IOIO_.openCapSence(pinNum
25ms
:
;)CapSence capSence=IOIO_.openCapSence(pinNum,FilterTime
FilterTime ms
CapSence
pf
.
.
, 50pF waitUnder
)( waitOver 60pF
;)Capsence.setfiltercoef(timeInMs
. 25ms
.
32
1.1 ARDUINO
Arduino
Platform Micro-
.Controller
.
1.1.1 :
Ivrea 6333
.Microcontrollers
...
.Arduino
" " Massimo Banzi " David
" cuartielles " Gianluca Martino
Arduino of Ivrea
100
Integrated %
Environment Development
Development Boards
.
Wiring platform
Hardware Design
Processing
33
Arduino C C++
.
6333
ATmega168 AVR Atmel
. Arduino Serial V.1
:
Arduino UNO, ArduinoMEGA, Arduino Llypad , Arduino Duemilanove ,
Arduino FIO
AVR Atmel
033.333 .
6332 LeafLabs
The Maple Board
ARM cortex
ARM 26
3.3 .
ARM Cortex "
") Field-Programmable Gate Arrays (FPGA 6333
Papilio Arduino
FPGA .Arduino C
FPGA
Decoding
.
: 333 .
33
:
VHDL .Verilog
papilio Arduino
papilio Arduino IDE Arduino
IDE FPGA papilio boards
6333 33 .
papilio Arduino
AVR ARM Cortex
.FPGA
.
1.1.1 :
Open Hardware
Arduino C :
Arduino IDE: Integrated Development Environment
http://arduino.cc.: ( )3.6 .
1.1.1
source
codes arduino IDE arduino boards
Arduino C
Micro C
.
36
Micro controllers Development Boards
6333
processing " "C .
MATLAB , labview Java
MATLAB Java
VB.NET .
! .
( )1 - 2
1.1 :
Sensors
:
Arduino UNO , Arduino Mega , Arduino Nano , Arduino mini , Arduino
Demulive , Boarduino . Lilypad , Arduino
:
30
: Arduino Mega 1.1.1
.)Atmega2560( ATMEL
( 33/)
33 32 3
32 USB
. ( )6.6 . Arduino Mega
( )1.1Arduino Mega
33
) ATmega168 (Arduino Nano 2.x Mini-
.B USB ( )0.6 Arduino Nano
33
( )3.6 UNO
( )1 - 2
1.1 : Power UP
USB
AC/DC 2
2 3.3 / / Gnd
Vin .
][ 63- 2
2 Pin 5V
3
36 voltage regulator
2
36
1.1.1 :
: VIN .
: V5
Vin
32
USB 3
333 .
: V3.3 0.0
33 .
: GND .
( )3.6
( )1.1
32
FLASH=32K Bytes
SRAM=2K Bytes
:compare mode
16bit .8bit
6 PWM .
2 . ADC
.
.
60 .
V1.8. V3.3
32
2 AnalogA0 A5
3 . ( )2.6
)input & output Pins (I/O
32
1.1.1 :
3 (1) High
.(0) Low ( )2.6 .
( ) 1.1
1.1.1 :
ATmega 328P-PU Arduino Uno 2
( ) A0
A5 3.2
.
23
1.1 :
RC SERVO
()12
( )12 RC Servo
- 1.1 : DC
( )Shaft ( )Wheel
( )Gear .
( )rpm
.
.
)8000( )3000(
( )rpm )24( )1.5( .
.
)50%(
. ( )30%
23
( ) .
( )(Pulse Width modulation
( )off( )on
. ( )
( 100% ) .
)Stall Current(
. ) (torque rating
. (. )lb/ft( )g/cm( )oz/in
( )2-13
) (inefficient
.
( )2-13
.
26
()13
.
.
. ( )14 :
ujt Scr
()off( )on
RC
NAND
MOSFET
. RC
. NAND on/off
CMOS .
( )14 555
R2 ).(Low duty cycle
clock . C R1 , R2
on off :
20
ton = 0.693R1C toff = 0.693R2C
()14
:
DPDT ( )15
.
DPDT .
- ( )15
NPN PNP
).(Similar beta )+5V( high ) (On
) (npn
( )0V ( )PNP ()NPN
PNP VCC
.
23
()15
( )
. H
( )16 H
MOSFET
( )forward direction ( )V5+
( ) .
.
( )Q3 Q3
Q2
( . )
( )Q3 ( )Q4 ( (Q1) )Q4
H MOSFET .
. (
) .
23
()16
H-bridge
LMD 18200 National semiconductor
3A
)55-12( ) ) TTL ) ,( Cmos
) (L293D ( )Ic
) (LMD 18200
.
.
LS_298 DC
22
22
IL = 2A 33 32
3.3 2 23
63 0 .
.
- 1.1 ) ) RC
) RC (Remote Control Servo
).(Pointer like position control
PWM
180 210 ((
023 )
( )
. ))robotics
.
RC
) ) ( )
( SG90
)0.5kg .
180 210
.
( ) .
(
22
)
. pwm :
333 pwm 33
pwm :
3 3 33 %3
%333 3*323 33
32 33 323
323
()17
( )1.5ms
( 90 ) 0-180
1.5ms
1.5ms
1ms
2ms
1.25ms
1.75ms 4.8v 6v
.
. 555
22
R2 .
)microprocessor) ) Microcontroller)
(
)
) (radiowave
.
) ) rudder
. ( )11-6 )72mhz(
50mhz 72mhz
)(RC Servos
.
() ( )gear system ()360
( )
.
.
( )1.5ms
- .
()1.5ms
23
1.1 :
3
23
R= (Vs-Vf_max) / If
IF VF VF VR Luminous Viewing
Type Colour Wavelength
max. typ. max. max. intensity angle
1.1 :HC-06
RX/TX
0
0.0
Commander
26
.
USB
USB
122 .
20
What is The BlueTooth
( ) )(RF
( ) (PAN 01 .....
...
) (BlueTooth 0994
( ) (
( ) )BlueTooth special interest group (SIG
)(Wireless
.
( )InfraRed
whatre The BlueTooth Applications
BlueTooth
: - pager - - -
- laptop
23
Harold BlueTooth .
.
.
BlueTooth technical challenges
:
) 0 ...
) (Industrial Scientific and Medical( (ISM
.. ()
)2 transceiver
) 3
power
)4
23
)5
)6 ""
BlueTooth Tech. Specifications
:
)0 ( 01011)
( )RF (2.45)
.
)2 (BlueTooth
.)Zone
)3 ( )21-5.
)4 .
)5 ( )power .
)6 ( )
)7 .
)8
).(Module
Does The Bluetooth
Reciprocal Signals Interfere
01
0 3 .
01
Spread-Spectrum
Frequency Hopping 2.41 2.48
0611 .
2.40
2.44
22
.
.
()
.
:
.
330 m/s
.
:
22
( )
.
20000 20) . )Hz
.
:
( )
( ).
:
:
Hz )20000-20( .
Hz 20.
() Hz 20000.
.
.
.
:
100 : 1
- .
- .
1 1 :
- ( ) SONAR .
-
- .
- .
22
) (SONAR .
.
.
.
3cm-
.3.3m
.
The Ping))) ultrasonic Sensor
( ) 2 ( )
( . )
5V TTL
0V
( ) 5V
( , ,),
22
23
-1 :
))) PING :
3.
.
.
)))PING
-2 :
.
))) PING
.
-3 :
:
Cair=331.5+(0.6*Tc) m/s
Cair: Tc:
23
)))PING Parallax
.40 in. (101.6 cm) :
), 3.5 in. (8.9 cm ) 4 ft. (121.9 cm .
.
.40 in. (101.6 cm) :
: . (30.5 cm x 30.5 cm) 12 in. x 12 in
26
.
:
. (0.8 in to 3.3 yd) 2cm -3m
.
TTL I/O 5V TTL .3.3 V CMOS
20
TTL .)2 s min, 5 s typ)
TTL .)115 s min to 18.5 ms max)
HC-SR04
:
.5V dc :
.30 mA typ; 35 mA max :
: TTL.
.) 0 70) C :
9 :.
GND )Ground (Vss
.
5V )5 VDC (Vdd
trigger
Echo Signal pulse
recive
1.1 :9V
1.1 :12V
23
LapTop
12v
2800mA
1.1 :
1.1 :
23
66
1.1 :
.
:
Rasspbery PI IOIO/OTG Arduino uno R3
MODEL B
Arm oc Microcontroller
Arm 11 PIC24FJ256DA210 Atmega328
JAVA C
ArduinoC
51 i2c
i2c Spi ,
,spi ,UART UART i2c ,spi ,UART
56 6
GPIO 4 14 GPIO 51
51 6 pwm
320-480MA 100MA 40MA
usb
5V 5-15V 5-17V
JAVA ,C++
$51 $51 $51
68
VS
VS
66
:
)1 :
ENC28J60
Esp8266
ip
ip
FTDI RF
MCU ENC28J60
ASCII .
)2 :
Arduino Ethrnet Enc28j60 8266
68
:
-*1 Xbee ,ZigBee . KM
-*2 HC_06/HC_05
.
ASCII
)3 : .
)4
.
)5 :
:
- *1
USb debugging
IP Boss
IP .
- *2 FTDI_USB USB
RX/TX ESp8266 ioio
IP
.
- *3 USB USB BLUETOOTH DONGLE
100m (( .
)) .
.
.
89
1.1 :
Wireless Networks
.
.
)Wireless Personal Area Network (PAN
. Bluetooth
.
)Wireless Local Area Network (WLAN
.
.
LAN IEEE 802.11
GHz 5\3.6\2.4
.
)Metropolitan Area Network (MAN
LAN
:
).Internet Service Provider (ISP
81
.
Global System for Mobile (GSM)
The third generation of mobile telecommunications
)technology (3G
Long-Term evolution (4G LTE)
IOIO ARDUINO
..
.
Protocol
.
) Internet Protocol (IP
TCP/IP .
Default Gateway
.
Repeater
.
Router .
82
(AP) Access Point (
Lan )
.
:
Wireless Router
(SSID) Service Set Identifier
Password .
Default Gateway .
).(IP
CMD
.IPconfig IP
IOIO .
1.1
Wi-Fi Bluetooth Internet
83
Bluetooth
.
.
/ /
.
Google
( =
) Accelerometer
x , y , z
.
IOIO RobotControl
JoyStickClass
84
lm298
RobotControl
RobotControl
.
85
39
1.1 :
1 : CODES
1.1 :Arduino
( ) 1- 3
39
( )2 - 3
( )3 - 3
39
( )4 - 3
( )5 - 3
39
( )6 - 3
37
()7 - 3
39
( )8 - 3
33
1.2
( )1 - 4
111
( ) 2 - 4
111
() 3 - 4
111
() 4 - 4
() 5 4
OnClick
119
() 6 - 4
119
( )7 - 4
119
119
117
119
( )8- 4
113
1 :
111
111
111
9 :
119
9 :
9 :
* - android developer
.mitchtech, pinterest robotistan
* -
* -
* -
* -
.
* - .
* -
eclips
119
.
:
5.1
9.1.1
.
.
5.1.2
,
119
5.1.3
5.1.4 :
.
119
5.1.5 :
. Baud rate
5.1.6 :
ui thread
5.1.7 :
117
.
5.1.8 :
object
( ,
, , )
object
static object
.
.
9 :
-1 (.)
-1 .
-9 .
-9 .
119
-9 . IOIO/OTG
7 :
-1
.
-1
:
PLC
( ) .
CNC .
WIFI/3G/GPS -9
-9
:
:
: .
: .
: .
: .
: .
.
113
.
111
111
.. :
. :
. :
: ) (
111
****-----*******-----*******-----*******-----*******-----*******-----
IOIO
.
1119/7/11
/191997 /
https://www.youtube.com/channel/UCq0RbRuLe3oFb9e12vqzaUg
119
123
41 1/48
124
21
125
088
9 058
05
%288 4.5 .
126
Specifications:
1. Module Working Voltage: 4.5-5.5V
5. Resolution: 0.01mm
11. Speed measuring sensor configuration: measure line 1 motor speed 12. Application: For
experiment
127
012 42 , 02
02 on 002:
ACS712
128
129
:
.
( )stepper ()
on/off---8/2
8.0 524.1
(068)
clock .
0.72
90 .
( )30-15 .
360 ( DC
dc )
.
) )Plotters .
.
.
:
:
. :
(
)
.
:
288 158-258
Step = :
360/n
130
:
hz 088- hz188 . rpm 088-188
:
_ m-mN
:
:
-
-
.
.
8.9 98 .
:
8.9 488 .
2.0 188 .
0.6 288 .
0.5 40 .
25 14 .
( ) .
.
2 28
kg / cm
( ) .
0
.
.
.
-
:
* .
*
131
( ) ( ) 42 0.2 .
.
4 :
(
) ( +
) ( ) -
.
.
.
0 :
( )
-
.
,
,
8
3 ( ) 3
_ :
.
.
,
.
132
0C00
DC00
D000
D00A
AC AC-BD AC
AC-BD BD-CA BD
BD CA-DB CA
BD-CA DB-AC DB
133
CA AC-BD AC
CA-DB -- --
DB -- --
DB-AC --
AC
--
. ( )
.
.
.
134
( ,
, )
n
:
:
( ) + ( ) -
.
( ) :
( ) 4.0 = 8 = 3 :
8 ( , ) 12 = 8 / 032 3 ( ) 32 = 3 / 032
42 = 12 32 . 42 .
) = / 032 )
1 1+2 1
1+2 2+3 2
3 3+1 3
2+3 --
135
3 -- -
3+1 -- -
-- -- -
-- --
( ) 3
C ( ) 1
136
:
translator
IC ULN200X Allegro
, Microsystems DS200X .National Semiconductors
ULN 2003 ( )21 TTL
. 7404
ULN 2003 .
MC1413
.
L293 2A
LMDI 8200 3A
L298 L293
137
.
.
.
.
.
()26
. .
138
931
941
Pinout from IOIO to L293d or ld298
ioio 1 to IN2
ioio 2 to IN1
ioio 3 to EN1/2
ioio 8 to Laser Pointer
ioio 10 to Digital Servo in
ioio 13 to EN3/4
ioio 16 to IN4
ioio 17 to IN3
949
941
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\RobotControll.java 31 :
package com.example.robotcontrol;
//YasserKarKouKli // Java Code
//
import ioio.lib.api.DigitalOutput;
import ioio.lib.api.PwmOutput;
import ioio.lib.api.exception.ConnectionLostException;
import ioio.lib.util.AbstractIOIOActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
@SuppressLint("ClickableViewAccessibility") @SuppressWarnings("deprecation")
public class RobotControll extends AbstractIOIOActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_robot_controll);
//
-1-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\RobotControll.java 31 :
servo.setOnClickListener(new OnClickListener(){
});
});
//
seekBar_ = (SeekBar)findViewById(R.id.seekBar1);
textView_ = (TextView)findViewById(R.id.textView1);
textView_.setText("PWM Frequenz: " + String.valueOf(3100 - 650 - seekBar_.getProgress
()));
seekBar_.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
-2-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\RobotControll.java 31 :
layout_joystick = (RelativeLayout)findViewById(R.id.layout_joystick);
js = new JoyStickClass(getApplicationContext(), layout_joystick, R.drawable.
image_button);
js.setStickSize(screenHeight / 7, screenHeight / 7);
js.setLayoutSize(screenHeight / 2, screenHeight / 2);
js.setLayoutAlpha(50);
js.setStickAlpha(255);
//js.setOffset((int)((screenHeight / 9) * 0.6));
//js.setMinimumDistance((int)((screenHeight / 9) * 0.6));
js.setOffset((int)(0));
js.setMinimumDistance((int)(40));
layout_joystick.setOnTouchListener(new OnTouchListener() {
long time = System.currentTimeMillis();
public boolean onTouch(View arg0, MotionEvent arg1) {
js.drawStick(arg1);
if(arg1.getAction() == MotionEvent.ACTION_DOWN) {
command();
} else if(arg1.getAction() == MotionEvent.ACTION_MOVE) {
if(System.currentTimeMillis() - time > 10) {
command();
time = System.currentTimeMillis();
}
} else if(arg1.getAction() == MotionEvent.ACTION_UP) {
textView_.setText("STOP");
direction_state = "STOP";
direction_state = "STOP";
}
return true;
}
if(direction == JoyStickClass.STICK_UP) {
textView_.setText("UU " + strSpeed);
direction_state = "UU";
} else if(direction == JoyStickClass.STICK_UPRIGHT) {
textView_.setText("UR " + strSpeed);
direction_state = "UR";
} else if(direction == JoyStickClass.STICK_RIGHT) {
textView_.setText("RR " + strSpeed);
direction_state = "RR";
} else if(direction == JoyStickClass.STICK_DOWNRIGHT) {
textView_.setText("DR " + strSpeed);
direction_state = "DR";
} else if(direction == JoyStickClass.STICK_DOWN) {
textView_.setText("DD " + strSpeed);
direction_state = "DD";
} else if(direction == JoyStickClass.STICK_DOWNLEFT) {
textView_.setText("DL " + strSpeed);
direction_state = "DL";
} else if(direction == JoyStickClass.STICK_LEFT) {
-3-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\RobotControll.java 31 :
}
});
private DigitalOutput D1A, D1B, D2A, D2B, D3A, D3B, D4A, D4B;
private PwmOutput PWM1, PWM2, PWM3, PWM4, PWM10, statLed;
} catch (ConnectionLostException e) {
throw e;
}
}
-4-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\RobotControll.java 31 :
if(direction_state == "UU") {
PWM1.setDutyCycle((float)jsSpeed / 100);
PWM2.setDutyCycle((float)jsSpeed / 100);
PWM3.setDutyCycle((float)jsSpeed / 100);
PWM4.setDutyCycle((float)jsSpeed / 100);
D1A.write(true);
D1B.write(false);
D2A.write(true);
D2B.write(false);
D3A.write(true);
D3B.write(false);
D4A.write(true);
D4B.write(false);
} else if(direction_state == "DD") {
PWM1.setDutyCycle((float)jsSpeed / 100);
PWM2.setDutyCycle((float)jsSpeed / 100);
PWM3.setDutyCycle((float)jsSpeed / 100);
PWM4.setDutyCycle((float)jsSpeed / 100);
D1A.write(false);
D1B.write(true);
D2A.write(false);
D2B.write(true);
D3A.write(false);
D3B.write(true);
D4A.write(false);
D4B.write(true);
} else if(direction_state == "LL") {
PWM1.setDutyCycle((float)jsSpeed / 100);
PWM2.setDutyCycle((float)jsSpeed / 100);
PWM3.setDutyCycle((float)jsSpeed / 100);
PWM4.setDutyCycle((float)jsSpeed / 100);
D1A.write(false);
D1B.write(true);
D2A.write(false);
D2B.write(true);
D3A.write(true);
D3B.write(false);
D4A.write(true);
D4B.write(false);
} else if(direction_state == "RR") {
PWM1.setDutyCycle((float)jsSpeed / 100);
PWM2.setDutyCycle((float)jsSpeed / 100);
PWM3.setDutyCycle((float)jsSpeed / 100);
PWM4.setDutyCycle((float)jsSpeed / 100);
D1A.write(true);
D1B.write(false);
D2A.write(true);
D2B.write(false);
D3A.write(false);
D3B.write(true);
D4A.write(false);
D4B.write(true);
} else if(direction_state == "UR") {
PWM1.setDutyCycle((((float)jsSpeed / (float)1.5) + 20) / 100);
-5-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\RobotControll.java 31 :
-6-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\RobotControll.java 31 :
D2B.write(false);
D3A.write(false);
D3B.write(false);
D4A.write(false);
D4B.write(false);
}
sleep(10);
} catch (ConnectionLostException e) {
throw e;
}
}
@Override
protected AbstractIOIOActivity.IOIOThread createIOIOThread() {
return new IOIOThread();
}
-7-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\JoyStickClass.java 31 :
package com.example.robotcontrol;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
stick = BitmapFactory.decodeResource(mContext.getResources(),
stick_res_id);
stick_width = stick.getWidth();
stick_height = stick.getHeight();
-1-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\JoyStickClass.java 31 :
if(arg1.getAction() == MotionEvent.ACTION_DOWN) {
if(distance <= (params.width / 2) - OFFSET) {
draw.position(arg1.getX(), arg1.getY());
draw();
touch_state = true;
}
} else if(arg1.getAction() == MotionEvent.ACTION_MOVE && touch_state) {
if(distance <= (params.width / 2) - OFFSET) {
draw.position(arg1.getX(), arg1.getY());
draw();
} else if(distance > (params.width / 2) - OFFSET){
float x = (float) (Math.cos(Math.toRadians(cal_angle(position_x, position_y
))) * ((params.width / 2) - OFFSET));
float y = (float) (Math.sin(Math.toRadians(cal_angle(position_x, position_y
))) * ((params.height / 2) - OFFSET));
x += (params.width / 2);
y += (params.height / 2);
draw.position(x, y);
draw();
} else {
mLayout.removeView(draw);
}
} else if(arg1.getAction() == MotionEvent.ACTION_UP) {
mLayout.removeView(draw);
touch_state = false;
}
}
-2-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\JoyStickClass.java 31 :
return 0;
}
-3-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\JoyStickClass.java 31 :
-4-
D:\\ + \ \\ \ \ RobotControll\src\com\example\robotcontrol\JoyStickClass.java 31 :
return params.width;
}
-5-
D:\\ + \ \\ \ \ RobotControll\res\layout\activity_robot_controll.xml 31 :
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/large_text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="1900"
android:progress="850" />
<RelativeLayout
android:id="@+id/layout_joystick"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="14dp"
android:background="@drawable/image_button_bg" >
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right" >
</LinearLayout>
<Button
android:id="@+id/servos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/servo" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/temp" />
<ImageView
-1-
D:\\ + \ \\ \ \ RobotControll\res\layout\activity_robot_controll.xml 31 :
android:id="@+id/imageView1"
android:layout_width="3dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</LinearLayout>
-2-
D:\\ + \ \\ \ \ RobotControll\AndroidManifest.xml 31 :
//
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.robotcontrol"
android:versionCode="1"
android:versionName="1.0" android:installLocation="auto">
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.robotcontrol.RobotControll"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</manifest>
-1-