How it WORKS |
In the program below, the speed of sound is used to convert the pulse to a distance in metric.
Speed of sound: 340m/s or 29.412 microseconds/cm Pulse length/ (Speed of sound x 2)= Distance in cm As the ping travels to and fro, we need to divide the distance by 2. |
INGREDIENTS
HARDWARE |
|
Software
|
All listed (software) items are available for free via the links provided.
|
Procedure
STEP 1:
|
There are a total of four connections required by the SR04 Ultrasonic Sensor. They are:
Note that the power source for the arduino is not shown here. You may use a battery or the USB port at your pc.
TIP: If it is the first time you are using the breadboard, you can test its connections using the continuity function of a Multimeter.
|
STEP 2:
|
|
STEP 3:
|
Open the file below using the Arduino Software and upload to the Arduino UNO board.
Note that the image above does not show the entire program.
|
Complete!
LINKS |
|