01.
Step 1: We need to install the Arduino software.
Navigate to the Red Door Launcher and find the Arduino software.
02.
Step 2: Now we need to open the Arduino software.
Locate the Arduino icon in your applications, or press 'Command' + 'Spacebar' and search for Arduino.
Note: You may be prompted to install an update. Please go ahead and update the software.
We will revisit this software later.
03.
Step 3: Now we need to use a male to female cable to connect the GND (ground) pin from the Arduino to the GND pin on the ultrasonic sensor.
04.
Step 4: Now we need to connect the 5V pin to the VCC pin.
05.
Step 5: Now we need to connect the number 13 pin to the TRIG (trigger) pin.
06.
Step 6: Now we need to connect the number 7 pin to the ECHO pin.
07.
Step 7: Now we need to connect the Arduino to the Mac.
Connect the USB B cable to the Arduino.
Connect the USB C dongle to the computer.
Connect the square 9 volt battery to the Arduino.
08.
Step 8: You may be prompted to allow the accessory to connect. Please do so.
09.
Step 9: You may be prompted to install developer tools. Please do so.
10.
Step 10: From the dropdown menu at the top of the window, select the 'Arduino' Uno board.
11.
Step 11: Copy this code by selecting the code and pressing 'Command + C'
Highlight the code in the Arduino software (to be overwritten)
Paste the new code into the software by pressing 'Command + V'.
12.
Step 12: To upload the code to your Arduino, click on the arrow.
Note: you will be notified if there are any issues with the code.
13.
Step 13: To setup the experiment, complete the following steps:
Place the ultrasonic sensor over the image of the sensor.
Use blu-tack to ensure the sensor is carefully aligned.
Place an object on one of the ruler increments to measure the ping rate.
14.
Step 14: To view the ping rate (which is the time taken for the pulse to travel) we need to open the serial monitor window.
To open the serial monitor window press the magnifying glass icon in the top-right of the Arduino software window.
We can see that the distance is the full distance to the object and back again (approximately 60cm).
The most consistent ping rate is 1749
15.
Step 15: To convert the ping rate into the speed of sound we need to use the following equation:
Speed = distance travelled
time taken
Speed is a measure of how fast something is traveling. It is the distance travelled in unit time. Speed is measured in m/s.
Speed, or distance and time can be calculated using the DST triangle.
16.
Distance in metres = distance in centimetres
100
Step 16: To convert the distance from centimeters to meters:
Since 1 meter is equal to 100 centimeters, you can convert the distance in centimeters to meters by dividing the distance in centimeters (cm) by 100.
30 cm is equal to 0.3 m.
17.
Time in seconds = time in microseconds
1,000,000
Step 17: To convert the ping rate time to seconds:
Since 1 second is equal to 1,000,000 microseconds, convert the time from microseconds to seconds by dividing the microsecond time by 1 million.
1749 microseconds is equal to 0.001749 seconds.
18.
Speed ≈ 0.001749 s ≈ 343.09 m/s
0.6 m
Step 18: Performing the calculation:
The calculation is the distance of 0.6 metres divided by the time of 0.001749 seconds.
The ping rate is equal to 343.09 m/s
This result is close to the commonly accepted speed of sound in air at room temperature, which is around 343 m/s.
Troubleshooting
Before you give up, have you tried the following?
Check your connections
Restart your laptop
Switch out your USB B cable (the blue one)
Switch out your USB dongle (the RDC one)
Ask a peer
Accuracy Check
You can check the accuracy of your device through this website.
Note: the speed of sound will vary depending on the altitude and temperature of the space.
Speed of Sound (MPH)
Miles per hour: Copy this code and paste it into the Arduino software to calculate the speed of sound in miles per hour.
Note: this code will complete the calculations
Range Finder
Range finder: You can program your Arduino and ultrasonic sensor to be a range finger using this code.
Note: this device will only measure to a maximum of four meters.
You can use this device to calculate the area of a space, such as a small classroom.