ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530...

21
ECE 4510/5530 Microcontroller Applications Week 11 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences

Transcript of ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530...

Page 1: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

ECE 4510/5530Microcontroller Applications

Week 11

Dr. Bradley J. BazuinAssociate Professor

Department of Electrical and Computer EngineeringCollege of Engineering and Applied Sciences

Page 2: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

ECE 2510 2

Lab 10 Elements

• The Physics of Radar/Sonar Signal Processing

• PING

Page 3: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Physics Based Radar/Sonar Signal Processing

ECE 4510/5530

3

Page 4: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

March 25, 2013

4

Effective Transmitted Power Density

The range of a wireless communications is dependent upon many system, antenna, and environmental factors.

Assuming on omni-directional antenna, the effective power at a radius R from the antenna is:

24 RPS T

avg

where TP is the transmitted (or received) signal power, R is the distance between the transmitter and receiver

AvgS is in W/m^2

Note: the surface area of a sphere is 22 4 RD

Page 5: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

5

Free-Space Loss

• As an RF signal propagates, there is path loss.

tPtG rG

f

RrP

22

cRf4R4L

• As shown above

22

rtt

rttr R4

GGPL

GGPP

fc

Note

Page 6: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

6

1st Order RF Range Estimate• Friis Transmission Formula

– Direct, line-of-sight range-power equation– No real-world effects taken into account

where: rP is the received (or transmitted)

tG is the effective transmitter (or receiver) antenna gain R is the distance between the transmitter and receiver, and is the wavelength f is the frequency

22

rtt2

2rt

tr Rf4cGGP

R4GGPP

Page 7: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

7

System Range

• Maximum Range (Prmin is receiver sensitivity)

dBmPt

dBmGt

dBmGr

dBmPr

m0 mR1

tPtG rG

f

RrP

rtr

t GGPP

fcR

min4

Page 8: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

March 25, 2013

8

Radar Range Equation

The power received by a radar has three components: the transmission, power reflected by the target, and the receiving antenna aperture.

eTT

R ARR

GPP

22 44

where is the radar cross section describing reflected power

424 RAGPP eTT

R

Using 2

4 e

TRAGG

Therefore 4

1

3min

22

4

R

TT

PGPR

Page 9: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Radar/Sonar Design

• Signal Transmission Power• The cross section of the target that reflects energy • Receiver Sensitivity • Antenna efficiency and directionality• In the simplest environment, compensation for path loss is

helpful (an amplifier with gain changing in time to compensation for path loss is desired)

• Reference: Merrill Skolnik, Introduction to Radar Systems, 3rd ed., McGraw-Hill Science/Engineering/Math, 2002.ISBN-13: 978-0072881387

ECE 4510/5530

9

Page 10: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Lab 10: see PING Notes

ECE 4510/5530

10

Page 11: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Distance Measurement UsingTime-of-Flight (TOF)

• Distances are measured based on the round-trip ultrasonic signals time-of-flight.

ECE 4510/5530

11

TofCDist air 2

2TofCDist air

PING)))™ Ultrasonic Distance Sensor (#28015), Parallax Inc., v1.5 2/15/2008, see www.parallax.com.

Page 12: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Speed of Ultrasound in Air

• The speed of sound in air is defined and is dependent upon a number of physical parameters. Temperature is the dominant factor, measured in °C.– See also http://en.wikipedia.org/wiki/Speed_of_sound

– Or PING)))™ Ultrasonic Distance Sensor (#28015)

ECE 4510/5530

12PING)))™ Ultrasonic Distance Sensor (#28015), Parallax Inc.,

v1.5 2/15/2008, see www.parallax.com.

sec/6.05.331 mTC cair

sec/606.03.331 mTC cair

Page 13: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Specifications

• Trigger pulse width (min and max)

• Delay from trigger to ultrasonic burst

• Return pulse width (min and max)

• Time before it can be retriggered

ECE 4510/5530

13PING)))™ Ultrasonic Distance Sensor (#28015), Parallax Inc., v1.5 2/15/2008, see www.parallax.com.

Page 14: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Design Considerations

• One pin input and output– Must trigger and measure the same pin– Design a “one-bit” bidirectional bus with a pull-down resistor.

The signal is expected to stay low.

• Measure the TOF pulse width– Use the ECT to measure rising and falling edge triggered times– If there is no “reflection” does the device time-out or should the

software?

ECE 4510/5530

14

Page 15: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Bi-Directional Bus

• Output to bus under the control of an enable signal• Input from bus whenever a read is desired• Bus at known high or low level when not “driven”

ECE 4510/5530

15

Busses are typically pulled-up

Page 16: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Generate the Bus Enable Timing

• Drive output low 165 nsec D to Q• Enable output buffer 240 nsec Z to Q• Make the pulse 15 usec• Disable the output buffer 240 nsec Q to Z

ECE 4510/5530

16PING)))™ Ultrasonic Distance Sensor (#28015),

Parallax Inc., v1.5 2/15/2008, see www.parallax.com.

‘540 data sheet worst case timing.

Complete Tristate operation before

tHOLDOFF = 750 usec

Page 17: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Determine the Max TOF

• Trigger the PING– Make sure nothing is in front of it

• See when the pulse returns to zero

• Note: a long delay between successive triggers should be used (10-100 msec period)

• Verify the pulse width versus distance relationship before proceeding (is it 18.5 msec ?)

ECE 4510/5530

17

Page 18: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Measure the TOF

• Use an ECT channel to measure the pulse width

• Floating point computations:– Use the time count time scaled by the clock rate to determine the

TOF. – Determine the DISTance from the TOF

• Perform the computations in mm or inches, not meters• That is: express C in terms of mm or in for the math

– Take the rounded integer value for the 3-BCD digit output

ECE 4510/5530

18

Page 19: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Temperature Compensation

• Measure the temperature periodically and recompute the speed of sound (in floating point)– Temperature at 1 Hz is sufficient. – Use one ATD sample or 4 and average ?– Compute the coefficient based on the DIP switch input

ECE 4510/5530

19

Page 20: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Expected Results (Dist.)

• Velocity of sound variation with temperature• Distance based on known time-of-flight

ECE 4510/5530

20

Min Time (msec) Time (msec) Time (msec) Time (msec) Time (msec) Max Time (msec)0.115 1.000 2.000 4.000 8.000 18.500

Temp (deg C) C (m/sec) Dist (in) Dist (in) Dist (in) Dist (in) Dist (in) Dist (in)0 331.30 0.750 6.522 13.043 26.087 52.173 120.6505 334.33 0.757 6.581 13.163 26.325 52.650 121.75410 337.36 0.764 6.641 13.282 26.564 53.127 122.85715 340.39 0.771 6.701 13.401 26.802 53.605 123.96120 343.42 0.777 6.760 13.520 27.041 54.082 125.06425 346.45 0.784 6.820 13.640 27.279 54.559 126.16830 349.48 0.791 6.880 13.759 27.518 55.036 127.27135 352.51 0.798 6.939 13.878 27.757 55.513 128.37440 355.54 0.805 6.999 13.998 27.995 55.990 129.47845 358.57 0.812 7.058 14.117 28.234 56.468 130.58150 361.60 0.819 7.118 14.236 28.472 56.945 131.685

Page 21: ECE 4510/5530 Microcontroller Applications Week 11bazuinb/ECE4510/Week11_1.pdf · ECE 4510/5530 Microcontroller Applications Week 11 ... – Use the ECT to measure rising and falling

Expected Results (TOF)

• Velocity of sound @ 25 °C• Time-of-flight for Known

Distances

• Note: is the object large enough to reflect a valid return signal?

ECE 4510/5530

21

Dist (in) C (m/sec) TOF (sec)@ 25 deg C

0.75 346.45 109.973E‐61 346.45 146.630E‐62 346.45 293.261E‐63 346.45 439.891E‐64 346.45 586.522E‐65 346.45 733.152E‐66 346.45 879.782E‐68 346.45 1.173E‐310 346.45 1.466E‐312 346.45 1.760E‐316 346.45 2.346E‐320 346.45 2.933E‐324 346.45 3.519E‐330 346.45 4.399E‐336 346.45 5.279E‐342 346.45 6.158E‐348 346.45 7.038E‐354 346.45 7.918E‐360 346.45 8.798E‐3