CSE477 Laboratory Assignment #2


Digital compass, sonar range finder, and interfacing to EVB

Assigned: 13 January
Due: 26 January


Objectives:

  • When you have completed this lab, you should know how to:Integrate a digital compass, sonar range finder, and microcontroller (EVB).
  • Learn the electronic compoents used to for the compass and sonar range finder.
  • Learn the encoding of the compass.
  • Measure the time of the sonar pulse with the EVB.


  •  

    Reading:

    Chapters 4 and 5 of the Jones/Flynn text.

    Chapters 7, and 9, and 10 of the M68HC11 Reference Manual.


    Part 1: Setting Up the Motors and Optical Speed Sensors Seting up the digital compass and sonar range finder


    Digital compass.
    The digital compass has 8 degrees of accurracy ( N, NE, E, SE, S, SW, W, NW). The compass has four terminals that work identically. The output voltage of the terminal that is pointing south, will always be low and the other terminals will be high. All other compass directions can be determined based the one low terminal (W, N, E). The compass can also identify 45 degree directions (SE, SW ...); in this case two consequtive terminals give 0V. An LED can be connected to each terminal to help in the debugging. When one terminal points south, the corresponding LED will be on. When the compass points in a 45 degree direction, two leds will be on.

    Each of the four terminals consistest of 3 leads. The output lead is an open collector. The following circuit in the diagram is needed for the output signal to go to 0 and 5 volts. In adition the LED is used for debuging.
     
     

    [Diagram of compass (wire resitors, LED, and power)].

    To know when it works answer the following questions.
    Which way is South?
    Rotate the compass. In what order to the leds go on?

    More documentation
    Dinsmore digital compass
    Additional data sheets in the lab.
     

    Sonar Range Finder
    The sonar range finder will be used to determine twice the distance to the object infront of the sonar transducer (black disk). The sonar device sends out 16 pulses at 49.5 kHz that travel to the object in front of the sonar and back. The range finder is started by making INIT 5V.  When the pulses are recieved the ECHO out goes high. INIT has to stay high at least until ECHO goes high. The sonar board operates this way when BINH and BLNK are 0V. See the documentation for the other uses of the board. Sonar doc

    Be care about touching the circuit board. The device needs 200-400V to works. Touching the sonar circuit board might give you an uncomfortable burn.

    The interconnect to the sonar range finder board is:
     
    purpose gnd BLNK INIT ECHO BINH Vdd
    pin / voltage 1 / 0V 2 / 0V  4 / Input  7 / Output  8 / 0V 9 / 5V

    The connections to sonar transducer (see transducer documentation):

    E1 --> (+) brass tap
    E2 --> (-) black tap


    The ECHO output is an open collector output like the terminals of the compass.

    [Diagram for ECHO output]
     
     
     
     

    To know when it works answer the following questions.
    Connecting INIT to 5V will start the sonar range finder. You should hear a scratching, which is the transducer sending off the 16 pulses. In addition, ECHO goes high imidatly. Reset the sonar range finder by making INIT 0V and ECHO should go low too.

    More documentation
    Polaroid 6500 boardtransducer
    Wirz (same as above)
    Additional data sheets in the lab.
     
     

    Part 2: Connecting compass and sonar range finder to the EVB

    Decide which ports to use on the EVB for the compass and sonar range finder. Wire up the output connections to input pins. Use a volt meter to find which output connections work best. The compass can be tested with hyperterminal using MD <Input port memory address> (MD is explained in the User Manual). When the compass is rotated, the value stored at that memory address can be changed.

    You have to write a C program to test the sonar range finder. The program should time the difference between when INIT signal goes and when the ECHO signal goes high. Make several measurements to see if the readings make sense.

    Part 3: Integrate the compass and sonar range finder in one C program

    The EVB board should print the direction and distance to nearest object that the disk is facing. The idea is that a change in direction will automatically make the sonar rangefinder take a new reading. You can choose the units of distance, such as feet or meters. Here is an example of the output in the hyperterminal for NorthWest 3  meters:

    NW 3 m

    You might have to use some logic to help determine when the state of the compass changes.

    What to Turn In

    Demonstrate Part 3 to the TAs and explain the final C program.

    Note:
    A transducer is a devicce that converts electrical signals to a different form. The sonar transducer converts the electrical signal into sound waves.

    Comments to: cse477-webmaster@cs.washington.edu (Last Update: 01/27/98 )