The Ultrasonic Distance Meter 6 PDF

Title The Ultrasonic Distance Meter 6
Author Cindy Yip
Course Sensors And Artificial Perception
Institution Monash University
Pages 22
File Size 1.1 MB
File Type PDF
Total Downloads 593
Total Views 707

Summary

Revised Table of Contents Introduction ..................................................................................................................................................... 3 Objectives .....................................................................................................


Description

Revised 6/3/2019

Table of Contents Introduction ..................................................................................................................................................... 3 Objectives ......................................................................................................................................................... 3 Deliverables ...................................................................................................................................................... 4 Related documents ......................................................................................................................................... 4 Customer’s Requirements .............................................................................................................................. 4 Calibration mode (If required) ...................................................................................................................... 7 Obtaining repeatable results ......................................................................................................................... 8 The Method ...................................................................................................................................................... 9 Tips & Tricks .................................................................................................................................................. 16 Marking Process & Guide ............................................................................................................................. 20 Questions for Malaysia students ................................................................................................................. 22 Questions for Australian students ............................................................................................................... 22 Submission Times.......................................................................................................................................... 22 Student feedback. ......................................................................................................................................... 22 Suggestions and Updates............................................................................................................................. 22 References ...................................................................................................................................................... 22

Introduction The ultrasonic distance meter that you will build is similar in operation to one you might buy at a hardware store. It will enable you to determine a distance using the time of flight (TOF) of reflected sound waves. The distance will be shown on a display.

Objectives After completing this practical you will: 1. Have created a “Distance meter” that will show an ultrasonically measured distance on a display. 2. Know what 7 segment displays are and how to use them. 3. Know what display multiplexing is and how to apply it. 4. Have a better understanding of how an ultrasonic transducer works 5. Know how to design and create some electronics to interface to an ultrasonic transducer 6. Have improved your skills in prototyping circuits

Deliverables This project has two components that will be marked. The first is the distance meter itself which will be marked in the practical class (week 6 - worth 10%) and the second is the report on your project which will be submitted via moodle (week 7 - worth 4%).

Related documents This project will require you to read several other documents which are located in moodle: 1) Word Processing & marking guide (found in "Notes and Guides" Tab) 2) Prototyping Guide (found in "Notes and Guides" Tab) 3) Electrical notes (found in "Notes and Guides" Tab) 4) The PSOC (found in "Microcontroller Documentation and Code" Tab)

Customer’s Requirements You are required to construct a circuit that we will call a distance meter which will be able to measure how far away objects are located. The customer has been consulted and has given us some initial specifications which are as follows: 1) 2)

3) 4) 5) 6)

7)

A microprocessor board will be used to drive the whole circuit. The PSOC (Processor board) will be able to power the whole circuit as it will derive its power from the USB cable. There will be no need to connect any other power supplies to the circuit. You will use an ultrasonic transmitter and receiver The unit will be able to work up to about 35cm’s. The unit should have an accuracy of +/- 3mm on all measured distances. You will receive a four digit, 7 segment LED display to use in your design. This will enable you to display the distance in milli-meters or centi-meters such as 34.4cm. There will also be a LED to indicate cm’s or inches. As the unit may be sold into the United States, there needs to be some form of mechanism to switch between the imperial system (Inches) and the metric system.

8)

When the unit toggles from metric to imperial or vice versa, the unit will need to remember this by storing the information in EEPROM located with-in the PSOC. 9) Each unit will need to be able to store a unique identification number which will be your group number. This will also need to be stored in EEPROM. 10) The display updating will need to be accomplished using software 11) Every time a switch is pushed, a 200mS beep should be heard.

Other requirements While the PSOC microcontroller may have many digital blocks to aid in your design, most microcontrollers do not. It is therefore important to be able to design a system using a standard microcontroller. Description Use Hardware block Software Switch debounce. No Yes 7 segment display update. No Yes Ultrasonic 40kHz Frequency Yes Yes Beeper No Yes

Operation talk through: Under normal circumstances, the unit is not operational except for a flashing decimal point located on one of the multiplexed displays (any one of them). This will flash at one hertz. When a measurement is to be taken, the operator points the unit at the object they are wishing to take a measurement from and a switch is then pressed momentarily. When activated (button pushed) the circuitry operates and sends out sound waves to the distant object and waits for an echo. The microcontroller calculates the time from transmission to the time of reception and converts this to cm’s or inches depending on the mode of operation. The result is then displayed on the seven (7) segment displays for two (2) seconds and then the circuit goes back in to sleep mode. Note: When the unit is to be operated, it may happen in one of the two following modes: Type 1: If the switch is pushed and held down, it will do a measurement and display the results for two (2) seconds and then go into sleep mode. The unit will not operate again until the switch is released and pushed again.

Type 2: If the switch is pushed and released (e.g. 1 second), the unit will do a measurement and display this for two (2) seconds and then go back into sleep mode. Sleep mode is defined as: a The display is blank b One of the decimal points on the display is blinking at a rate of one (1) hertz. (Any one of the four decimal points)

Calibration mode (If required) If you find that your unit provides a linear and accurate reading at close distances but then becomes unstable and nonlinear at longer distances, you may need to implement the following calibration procedure.

1) Once the circuit has been completed and the transducers are fixed in place you will need to be able to put the unit in a factory calibrate mode where objects are placed at known distances from the unit and measurements are taken. This should only have to be completed once (1) as the customer will only want to use the product and not calibrate it. These known distance measurements can then be stored in long term memory inside the Microcontroller using EEPROM.

Range test Number 1 2 3 4 5 6

Calibrate Distances Actual Reading Look up table results Distance 5 cm 10 cm 15 cm 20 cm 30 cm 40 cm

5 10 14.5 20.5 30 40

5 10 15 20 30 40

Obtaining repeatable results To obtain the best results from your unit, you may need to take multiple readings when the operate button is pushed. This will produce a more accurate result. As an example: a. The unit is pointed at an object b. The button is pushed c. Six (6) separate transmissions and receptions are done and the results are stored with-in about 1.2 seconds d. Any readings that are not within a reasonable range are discarded and the remaining readings are averaged and the result is displayed.

Calculated Distance readings Reading 1 40 cm Discard Reading 2 11.8 cm Keep Reading 3 11 cm Keep Reading 4 12 cm Keep Reading 5 11.5cm Keep Reading 6 11 cm Keep Total 58 Average 11.46 The display should show (11.6)

The Method ***As this is possibly your first time working with the PSOC or other electronic components, the following construction procedure is strongly suggested.***

Step1: Please make sure you have read the following documents: a. b. c. d.

Word Processing & marking guide (found in "Notes and Guides" Tab) Prototyping Guide (found in "Notes and Guides" Tab) Electrical notes (found in "Notes and Guides" Tab) The PSOC (found in "Microcontroller Documentation and Code" Tab)

Step2: Assemble PSOC board (This may have already been done) Solder pins into PSOC prototyping board. Please see the document titled "The PSOC” for instructions Step3: Design Do an initial design on paper of your circuit and layout showing the following: 1) 2) 3) 4)

The complete circuit. Show all pin numbers of IC’s Show all components including capacitors, resistors, LED’s etc Do a layout of your bread board before starting construction.

Step4: Ultrasonic transducer sub-board (This may be assembled already) For your unit to work reliably, you will need to secure your ultrasonic transducers to a sub-board. This can be pre-made and then plugged into the bread board as shown below. Care should be taken not to over-heat the leads of the transducers as you will damage them. Apply the iron for no more than two (2) seconds at a time. You may be provided with either a small PCB or some Vero board to complete this section. Step5: Create your circuit on the bread board Place the components in the bread board and wire them together being sure to create a neat product. The following diagram gives a rough idea of what your circuit layout should include.

Please note: You may have one of these PCB’s which has the switches and LED’s mounted on it.

Shown below is the way in which you need to wire up the 4 digit multiplexed display. Note that a different microcontroller has been used here but the display wiring concept is the same. There are 4 transistors with four Rb resistors and 8 Rs resistors used to limit the current. Only pin RB7 is not connected as the dP is not connected in this circuit. You cannot connect the display directly to the PSOC Please see the document titled “Electrical notes” for further details

RX

PSOC

TP”A”

Led’s

TX

TP”B” Inverse of TP”A” Switches

For the TX module: You can wire the TX module directly to the PSOC. For the RX module: The RX module requires that one of the pins be wired to ground and the other can go directly to the PSOC. NOTE: The ultrasonic modules are not polarised

Step6: Creating the 40 KHz. Plug in the PSOC board to the bread board and connect the USB cable. Start the PSOC creator software on the PC and connect to the board. You need to create a 40 KHz square wave on two (2) of the PSOC’s port pins. This can be achieved in several ways: 1) Software loop that turns the port pins on and off. 2) Interrupt driven loop (Better) 3) Internal hardware inside the PSOC Note: When one of the Tx pins is high, the other must be low! Use an oscilloscope to verify that you have 40 KHz being produced on the port pins. Use an oscilloscope on TPA and TPB (Shown above) to make sure the signals are correct. Step7: Detecting echoed signals. Connect an oscilloscope directly across the RX transducer. Select a number of objects and use them to reflect the ultrasonic waves. Observe the range and size of the signals received and write them down for your guidance.

PSOC driving this transducer with 40kHz Object

Oscilloscope

Reflected measurements Distance Voltage (Peak to Peak) 1cm 5cm 10cm 20cm 25cm 30cm 35cm

Step8: Create the reception circuitry You will need to create all of the reception part of the circuit which may contain an amplifier and filtering. The PSOC has all of this on board.

PSOC 1. Op-AMP? 2. Filter? 3. A to D ? 3. Software? 4. More…

Out put 1. 7 segment LED’s 2. CM / Inch LED 3. Status

RX Transducer

Step9: Writing the report The report should include the following sections: a) b) c) d) e) f) g)

A screen grab from the PSOC creator of the schematic circuit. A4 Page A description of how you’re TopDesign.cysch works. A detailed description of how your software works. A description of the unit’s accuracy and repeatability. If any filtering was used, explain it via calculations and discussion. If any amplification was used, explain it via calculations and discussion. You are to include in your description any formulas, screen grabs and measured voltages that you deem necessary.

h) You need to include three clear and reasonably sized photos of your bread board circuit. One from the top, one from the side and one from the end. i) Tell me what you have learnt.

Your description of each section may need to include the terms, gain, frequency response, dB, cut-off frequency, single supply, input impedance, output impedance of power supply, etc. For each of the sections your description in your report should be about 60 - 100 words. ***You need to convince me you know your work! ***

Tips & Tricks Here are some tips you may wish to implement. What   

we know. The required frequency to drive the Tx module is 40kHz 1/40,000 = 25uS per cycle We should send a burst of about 10 cycles in one measurement Thus 10 x 25uS =250uS  The object under test should not be able to move around and so use something like a block of wood. (Do not hold it) 

A typical measurement happens in this way. 1. User locates object at a distance from unit. 2. User pushes a button 3. A timer is started and a burst of 10 cycles each 25uS long is sent to the Tx module where they are converted to sound wave pulses. 4. Sound waves travel out and bounce off target and return. 5. Microcontroller detects returned sound waves and stops timer. 6. Travel time of sound = (Start time – Stop time = result) 7. Result is stored To guarantee accuracy, steps 3 to 7 may happen 6 times and then the average is taken.

Creating the 40 kHz There are: 1. 2. 3.

are three (3) ways in which we can create the 40kHz signal and these Software Software/hardware Hardware

Type 1 Software Use software and a delay routine to toggle pins. Note that you still need to see if a returned signal has been detected. During the Wait(12.5uS) delay routine, you could be checking for this signal. As this is time sensitive, you may need to write this in assembly code. For (i=0;i...


Similar Free PDFs