Robo Presentation arduino

download Robo Presentation arduino

of 16

Transcript of Robo Presentation arduino

  • 8/16/2019 Robo Presentation arduino

    1/16

    OBSTACLE DETECTION/BLUETOOTH

    CONTROLLED CAR

    EE Semester 2

    Section -B

    Group Memers

    NAME Ro!! Numer

    AHMED RA"A MEHMOOD EE-##$$

    ABU"AR RI"%I EE-##22

    M &OUSHA EE-##$'

  • 8/16/2019 Robo Presentation arduino

    2/16

     The project has basically two diferent unctions:

    1- Obstacle avoidance2- Bluetooth controlling

    However due to lac! o technical e"perience we were unable to i#ple#ent

    both o unctions together we can operate our car on only one o the above

    unctions$Both unctions have their respective advantages and disadvantages so the

    purpose it is to use this in diferent environ#ent where on unction ails to

    use %or e"a#ple in public area obstacle detector car would not be easible

    because the #ove#ent o person would cause the detector to read the data$&and the situations where there is no obstacle in the straight path and we

    would be giving signals ro# the Bluetooth this would not be efective

    because there would not be any need to #anually operate or such scenario$

    COM(ONENTS USED IN THE (RO)ECT

    1- ARDUINO UNO

     The 'no is a #icrocontroller board based on the (T#ega)2*+$ ,t has 1

    digital input.output pins %o which / can be used as +0 outputs& / analog

    inputs a 1/ H 3uart crystal a '4B connection a power jac! an ,54+

    header and a reset button$ ,t contains everything needed to support the

    #icrocontroller6 si#ply connect it to a co#puter with a '4B cable or power it

    with a (5-to-75 adapter or battery to get started$

    http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdfhttp://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf

  • 8/16/2019 Robo Presentation arduino

    3/16

    2- BLUETOOTH MODULE HC-05

    H5-89 #odule is an easy to use Bluetooth 4++ %4erial +ort +rotocol& #odule

    designed or transparent wireless serial connection setup$

    4erial port Bluetooth #odule is ully 3ualied Bluetooth ;2$8 %=nhanced7ata >ate& )bps odulation with co#plete 2$?H radio transceiver andbaseband$ ,t uses 54> Bluecore 8-="ternal single chip Bluetooth syste#with 5O4 technology and with (@H%(daptive @re3uency Hopping @eature&$ ,thas the ootprint as s#all as 12$A##"2A##

    4pecications

    H*r+,*re e*tures

    •  Typical -*8dB# sensitivity

    • 'p to @ trans#it power

    • ow +ower 1$*; Operation 1$* to )$/; ,.O

    • +,O control

    • '(>T interace with progra##able baud rate

    • 0ith integrated antenna

    • 0ith edge connector

  • 8/16/2019 Robo Presentation arduino

    4/16

    3- L298N MOTOR DRIVER 

     The 2C* is an integrated #onolithic circuit in a 19- lead ultiwatt and

    +ower4O28 pac!ages$ ,t is a high voltage high current dual ull-

    bridge driver de- signed to accept standard TT logic levels and drive

    inductive loads such as relays solenoids 75 and stepping #otors$

    @ollow the steps below to congure the #otor controller board to wor! as atypical robot #otor driver or use with two 75 #otors$

    1$ (ttach your robotDs #otors to the green otor ( and otor B screwter#inals$

    2$ 5onnect the =E( and =EB to +0 capable digital outputs on yourrobotDs #icrocontroller$

    )$ 5onnect the ,E1 2 ) and pins to any digital outputs your robotDs#icrocontroller$

    $ (pply 9-1/; to the board by connecting positive %

  • 8/16/2019 Robo Presentation arduino

    5/16

    4- ULTRASONIC SENSOR HC-SR04

     The H5-4>8 ultrasonic sensor uses sonar to deter#ine distance to an objectli!e bats do$ ,t ofers e"cellent non-contact range detection with highaccuracy and stable readings in an easy-to-use pac!age$ @ro# 2c# to 88c# or 1F to 1) eet$ ,t operation is not afected by sunlight or blac! #aterialli!e 4harp rangenders are %although acoustically sot #aterials li!e clothcan be diGcult to detect&$ ,t co#es co#plete with ultrasonic trans#itter andreceiver #odule$

    e*tures• +ower 4upply :anging 7istance : 2c# K 88 c#.1L K 1)t

    • >esolution : 8$) c#

    • easuring (ngle: )8 degree

    •  Trigger ,nput +ulse width: 18u4

    • 7i#ension: 9## " 28## " 19##

  • 8/16/2019 Robo Presentation arduino

    6/16

    (ins

    • ;55:

  • 8/16/2019 Robo Presentation arduino

    7/16

    FOR BLUETOOTH CONTROLLED SYSTEM

    FOR OBSTACLE DETECTION SYSTEM

  • 8/16/2019 Robo Presentation arduino

    8/16

    (ROGRAMMING

    CODE OR BLUETOOTH CONTROLLED S&STEM

    MincludeI4otware4erial$hN

    int trig)6

    int echo26

    int in1C6

    int in2186

    int in)96

    int in/6

    int =n(*6

    int =nBA6

    int led1)6

  • 8/16/2019 Robo Presentation arduino

    9/16

    int ,B86

    void setup%&P

      4erial$begin%C/88&6

      pinode%in1O'T+'T&6

      pinode%in2O'T+'T&6

      pinode%in)O'T+'T&6

      pinode%inO'T+'T&6

      pinode%trigO'T+'T&6

      pinode%echo,E+'T&6

      pinode%ledO'T+'T&6

      pinode%=n(O'T+'T&6

      pinode%=nBO'T+'T&6

    Q

      void loop%&P

    i%4erial$available%&N8&P

      ,B4erial$read%&6Q

     

    switch%,B&

      P

      case R@R:

      P#oveSorward%&6Q

      brea!6

      case RBR:

      P#oveSbac!ward%&6Q

  • 8/16/2019 Robo Presentation arduino

    10/16

      brea!6

      case R>R:

      P#oveSright%&6Q

      brea!6

      case RR:

      P#oveSlet%&6Q

      brea!6

      case R4R:

      Pstoprobo%&6Q

      brea!6

     

    Q

     

    Q

    void #oveSorward%&P

      analog0rite%=n(299&6

      digital0rite%in1H,?H&6

      digital0rite%in2O0&6

      analog0rite%=nB299&6

      digital0rite%in)H,?H&6

      digital0rite%inO0&6

      4erial$println%@O>0(>7&6

      Q

      void #oveSbac!ward%&P

      analog0rite%=n(299&6

      digital0rite%in1O0&6

  • 8/16/2019 Robo Presentation arduino

    11/16

      digital0rite%in2H,?H&6

      analog0rite%=nB299&6

      digital0rite%in)O0&6

      digital0rite%inH,?H&6

      4erial$println%B(5U0(>7&6

     

    Q

      void #oveSlet%&P

      analog0rite%=n(8&6

      digital0rite%in1O0&6

      digital0rite%in2O0&6

      analog0rite%=nB1*8&6

      digital0rite%in)H,?H&6

      digital0rite%inO0&6

      4erial$println%=@T&6

      Q

      void #oveSright%&P

      analog0rite%=n(1*8&6

      digital0rite%in1H,?H&6

      digital0rite%in2O0&6

      analog0rite%=nB8&6

      digital0rite%in)O0&6

      digital0rite%inO0&6

      4erial$println%>,?HT&6

      Q

      void stoprobo%&P

      analog0rite%=n(8&6

  • 8/16/2019 Robo Presentation arduino

    12/16

      digital0rite%in1O0&6

      digital0rite%in2O0&6

      analog0rite%=nB8&6

      digital0rite%in)O0&6

      digital0rite%inO0&6

      4erial$println%4TO+&6

      Q

    CODE OR OBSTACLE DETECTION

    int trig)6

    int echo26

    int in196

    int in2/6

    int in)A6

    int in*6

    int =n(6

    int =nBC6

    void setup%&P

      4erial$begin%C/88&6

      pinode%in1O'T+'T&6

      pinode%in2O'T+'T&6

      pinode%in)O'T+'T&6

      pinode%inO'T+'T&6

  • 8/16/2019 Robo Presentation arduino

    13/16

      pinode%trigO'T+'T&6

      pinode%echo,E+'T&6

      pinode%=n(O'T+'T&6

      pinode%=nBO'T+'T&6

    Q

      void loop%&P

      long distanceduration6

      long rdistanceldistance6

     #oveSorward%&6

    digital0rite%trig O0&6 .. (dded this line

      delayicroseconds%2&6 .. (dded this line

      digital0rite%trig H,?H&6

      delayicroseconds%18&6 .. (dded this line

      digital0rite%trig O0&6

     

    durationpulse,n%echoH,?H&6

      distanceduration.9*6

      4erial$print%distance : &6

      4erial$println%distance&6

      i%distanceI)8&P .. chec!s whether there is an obstacle in the specied range$

      stoprobo%&6

      delay%1888&6

  • 8/16/2019 Robo Presentation arduino

    14/16

     

    #oveSright%&6

      delay%988&6

      stoprobo%&6

      delay%988&6

     

    Q

    else P

      #oveSorward%&6

      Q

      Q

     

    ..@unction declaration

      void #oveSorward%&P

      analog0rite%=n(299&6

      digital0rite%in1H,?H&6

      digital0rite%in2O0&6

      analog0rite%=nB299&6

      digital0rite%in)H,?H&6

      digital0rite%inO0&6

      4erial$println%@O>0(>7&6

      Q

      void #oveSbac!ward%&P

      analog0rite%=n(299&6

  • 8/16/2019 Robo Presentation arduino

    15/16

      digital0rite%in1O0&6

      digital0rite%in2H,?H&6

      analog0rite%=nB299&6

      digital0rite%in)O0&6

      digital0rite%inH,?H&6

      4erial$println%B(5U0(>7&6

     

    Q

      void #oveSlet%&P

      analog0rite%=n(8&6

      digital0rite%in1O0&6

      digital0rite%in2O0&6

      analog0rite%=nB1*8&6

      digital0rite%in)H,?H&6

      digital0rite%inO0&6

      4erial$println%=@T&6

      Q

      void #oveSright%&P

      analog0rite%=n(1*8&6

      digital0rite%in1H,?H&6

      digital0rite%in2O0&6

      analog0rite%=nB8&6

      digital0rite%in)O0&6

      digital0rite%inO0&6

      4erial$println%>,?HT&6

      Q

      void stoprobo%&P

  • 8/16/2019 Robo Presentation arduino

    16/16

      analog0rite%=n(8&6

      digital0rite%in1O0&6

      digital0rite%in2O0&6

      analog0rite%=nB8&6

      digital0rite%in)O0&6

      digital0rite%inO0&6

      4erial$println%4TO+&6

      Q