Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out
Get this document free

Experiment 10 Ultrasonic Radar

VIEWS: 345 PAGES: 4

Experiment 10 Ultrasonic Radar

More Info
									EP-07-010: Experiment 10



                           Experiment 10: Ultrasonic Radar
Estimated Time:            8 hours

Prescribed Reading
       Code of Conduct for use of Laboratory Equipment            (PM-07-001.PDF)
       Policy on Academic Misconduct                              (PM-07-002.PDF)
       Introduction to ...                                        (PM-07-003.PDF)
       Getting to know the Adapt9S12X Development Board           (AM-07-001.PDF)
       The Freescale (HS12) Assembler                             (AM-07-002.PDF)

Essential Video Topics
       Topic01B: Introduction to Microprocessors and Microcontrollers
       Topic02: Introduction to Programming (Flowcharts)
       Topic03A-D: Introduction to Assembly Language Programming
       Topic04: Introduction to Input and Output (GPIO)
       Topic09: Timers: Father Time in a uP (PWM)

Familiarity With
       Full Assembly Instruction Set for the MC9S12XDP512 (RU-07-001.PDF)
       MC9S12XDP512 Memory Map                            (RU-07-002.PDF)
       MC9S12XDP512: On Chip Peripherals:GPIO             (RU-07-005A.PDF)

Aim

         To become familiar with the basics of Robotics, the humble servo motor, in an exciting application
         involving ultrasonic range finding.

Introduction

          Servo Motors
          The servo motor differs from a standard DC motor. The shaft of a standard DC motor spins at a fixed
          angular velocity defined either by the input voltage or the PWM duty cycle. However, in a servo motor
          the angular position of the output shaft is defined by the width of an input pulse.

          The servo motor used in this experiment is the YM-2763 servo, capable of lifting 13kgs. In its current
          configuration it is capable of approximately 120 degrees of movement. The servo has three wires that
          connect to it, these are 5V (red), ground (brown) and a control line (orange). The control line is used to
          set the angular position of the output shaft by providing a pulse of a particular width. A pulse width of
          1.4us will set the output shaft to an angular position of 0 degrees. A pulse width of 0.8ms will set the
          angular position of the output shaft to -60 degrees and a pulse width of 2.0ms to + 60 degrees.




                                               YM-2763 Servo Motor.


Revised: 15/09/2007
EP-07-010: Experiment 10


          Ultrasonic Sensor
          The ultrasonic senor used in this experiment is the SRF05 – Ultra-sonic ranger. The SRF05 contains a
          PIC processor and a matched pair of ultrasonic transceivers, one configured for output (transmitter) and
          the other for input (receiver).

          Ultrasonic sensor systems calculate distance from an object using the time of flight (TOF) equation,

                                                    c×t
                                               d=
                                                     2
          where d is the distance, c is the speed of sound and t is the total time of flight.

          The ultrasonic transmitter broadcasts a directional square pulse train at a frequency of 40kHz. The pulse
          train propagates in a straight line until it collides with a distant object. Upon hitting the object the signal is
          reflected back towards the ultrasonic receiver. When the signal is received by the SFR05, the on board
          PIC outputs a square wave who's width is proportional to the total time of flight.




            Input
            Trigger
                  Echo
                  Output




          The SRF05 has been configure to work in mode 1 operation and therefore has a four wire interface: 5v
          (yellow), GND (purple), Trigger Input (blue), Echo Output (green).




                                             The SRF05 Ultrasonic Ranger from [1].




Revised: 15/09/2007
EP-07-010: Experiment 10




                                 The radiation pattern of the SRF05 is almost directional.

          The SRF05 is controlled by sending a minimum of a 10us pulse to the trigger input, the SRF05 will then
          transmit the ultrasonic pulse train and also set the output echo to be high. When the return pulse is
          received the output echo line is cleared.




                                         SRF05 Mode 1 Timing Diagram from [1].

          Radar System
          The radar system used in the experiment consists of the two components mentioned previously, namely
          the YM-2763 servo motor and the SRF05 Ultrasonic ranger. The aim is to move the ultrasonic sensor to
          different positions so that a map of distances can be created.




Revised: 15/09/2007
EP-07-010: Experiment 10


Part A: Using the SRF05
        Connect the yellow and purple wire of the SRF05 to the 5V and GND of the bench top power supply.
        Ensure the voltage is set to 5V and the ground is connect to both the SRF05 and Apadt9S12X. For the
        time being leave the servo unconnected. Next connect the trigger input and echo output of the SRF05 to
        the Adapt9S12X using PORTT.

          Create a program in Code warrior to drive the SRF05 so that it takes a single distance measurement.
          Write the SRF05 code in a subroutine that can be reused later. Your subroutine should pulse the trigger
          input as outlined in the timing diagram on the previous page. Once the SRF05 has been triggered your
          program should wait until the echo output goes high and then count unitl the echo output goes low.
          Once the echo goes low the program should stop counting and display the value in hyper terminal (use
          OUT2HEX). Your program should then continuously call this subroutine, repeating the process over and
          over again.

          Hint: Include a very small delay (1 or 2 NOPS) between pulsing the of the trigger input and reading the
          echo output.

Part B: Calibrating the SRF05
        In order to use the SRF05 properly it firstly needs to be calibrated. Using a ruler, place an object 1cm
        from the SRF05 transceivers and note the counter value that is printed in hyperterminal. Shift the object
        by 1cm and note the value once more. Repeat this process until the object is 30cms away from the
        SRF05. Draw a table of the values in your laboratory work book.

          Develop an equation that can convert the counter value into distance. Add this equation into your
          assembly code. Your program should be able to display the distance in centimeters to the screen. Using
          a ruler, confirm that the program is working. Show the working system to your demonstrator.

Part C: Using the YM-2763 Servo

          Connect the YM-2763 to the 5V port of the bench top power supply and connect the control line to PP0
          (PWM0) on H1. For the time being comment out the subroutine written in Part B and modify the program
          to enable the pulse width modulation channel 0 of the timer subsystem. You must configure the PWM0
          channel to enable the servo to position the ultrasonic sensor between -60ºand +60º. Therefore setup the
          PWM system so it can produce a pulse with a duration ranging from 0.8ms to 2.0ms. The configuration
          you chose must also ensure at least 120 possible pulse widths between the two extremities (-60º and
          +60º). Include the full working used to calculate your values in your lab workbook. Initialize the
          subsystem and range the pulse width on PWM0 from 0.8ms to 2.0ms, ensuring a delay of 200ms
          between each PWM change. Show the working system to your demonstrator.

Part D: Complete System

          Modify the system in Part C to incorporate the SRF05 subroutine developed in Part B. Remove the
          200ms delay from part C and replace it with the SRF05 subroutine. Next modify your code to enable the
          servo to continuously sweep backwards and forwards from -60 degrees to +60 degrees. The distance
          should be printed to the screen after each angular position change of the servo. Show the final working
          system to your demonstrator.

References

          [1] SRF05 – Ultrasonic Ranger Technical information,
                 http://www.robot-electronics.co.uk/htm/srf05tech.htmm




Revised: 15/09/2007

								
To top