Presentation is loading. Please wait.

Presentation is loading. Please wait.

PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and.

Similar presentations


Presentation on theme: "PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and."— Presentation transcript:

1 PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and listens for this sound to echo off of nearby objects. The frequency of the sound is too high for humans to hear (it is ultrasonic). The PING))) sensor measures the time of flight of the sound burst. A user then computes the distance to an object using this time of flight and the speed of sound (1,126 ft/s). sound wave reflects off object and returns to PING))) “microphone”

2 living with the lab 2 Computing Distance

3 living with the lab 3 measurement range: 0.8 in to 120 inches supply voltage: 5V supply current: 30mA Specifications www.parallax.com/Portals/0/Downloads/docs/prod/acc/28015-PING-v1.6.pdf sensing distance (feet) as a function of angle

4 living with the lab 4 Connection to an Arduino

5 living with the lab 5 Arduino Sketch void setup() { Serial.begin(9600); pinMode(12, OUTPUT); pinMode(11, INPUT); } void loop() { long duration, inches; digitalWrite(12, LOW); delayMicroseconds(2); digitalWrite(12, HIGH); delayMicroseconds(5); digitalWrite(12, LOW); duration = pulseIn(11, HIGH); // measure the time of flight of sound wave inches = duration / 74 / 2; // 1130 ft/s * 12in/ft * 1s/1,000,000us = 74 // factor of 2 since sound travels out and back Serial.print(inches); // display distance in inches Serial.print("in "); Serial.println(); } The Arduino triggers the PING))) by sending a 5ms pulse to the sensor through pin 12, which is configured as an Arduino OUTPUT. When the PING))) receives the 5ms pulse from the Arduino, it sends a 40kHz (ultrasonic) burst of sound out its “speaker” and sets pin 12 to HIGH. The PING))) then waits for the sound burst to reflect off of something and return to the “microphone” where it is detected; the PING))) then sets pin 12 to LOW. The Arduino uses the pulseIn command to measure the time of flight of the sound wave in microseconds (the time that pin 11, when configured as an input, is HIGH).

6 living with the lab 6 Example Application void setup() { pinMode(12, OUTPUT); pinMode(11, INPUT); int tone_freq; } void loop() { long duration, inches; digitalWrite(12, LOW); delayMicroseconds(2); digitalWrite(12, HIGH); delayMicroseconds(5); digitalWrite(12, LOW); duration = pulseIn(11, HIGH); // measure the time of flight of sound wave inches = duration / 74 / 2; // 1130 ft/s * 12in/ft * 1s/1,000,000us = 74 // factor of 2 since sound travels out and back tone_freq = inches*100; // a freq of 100*inches is good tone(8,tone_freq); // send a tone out of pin 8 } The picture shows how stiff wire (such as a coat hanger) can be used to mount the PING))) to an aluminum plate. An Arduino and breadboard are also mounted to the plate, and a piezospeaker is installed on the breadboard to allow the device to output an irritating noise whose frequency is proportional to the distance from the PING))) to a target.

7 living with the lab 7 Conclusion What are some objects the ultrasonic range sensor would NOT be appropriate to measure due to the nature of sound waves? _____________________________________________________________________________________________________ What are some benefits to using the LCD over using the “serial out” function and displaying the results on a computer screen? _____________________________________________________________________________________________________ How could the ultrasonic sensor be used in a machine that you already use every day? _____________________________________________________________________________________________________


Download ppt "PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and."

Similar presentations


Ads by Google