How To: Sonar Sensor

1,011

23

1

Posted in TechnologyArduino

Introduction: How To: Sonar Sensor

Here is where you will learn how to connect you Arduino and Sonar Sensor in just a few easy steps!

Step 1: Materials

The materials you will need to have are:

1. Arduino Set (the connecting wires, board, and USB cord)

2. Computer with the Arduino Program downloaded onit

3. A target object (we're using a phone but you can use anything.. like, literally)

4. A meter stick or a ruler

5. Sonar Sensor

6. Graphing Calculator (optionsl)

Step 2: Connecting

Here is where we'll be using the the Sonar Sensor and Arduino set!

The sonar sensor has four metal tabs named "VCC", "Trig", "Echo", and "GND." Using four separate wires, we'll connecting the Sonar Sensor to the Arduino by using wires to connect the four previously stated tabs to the holes next to the names "5V", "~6", "~7", and "GND." Once everything is connected through the wires (VCC-5V, Echo-6, Trig-7, GND-GND), connect the Arduino board to the compute using the USB cord that came in the Arduino set.**Make sure that the Arduino program is open on the computer before you plug in the USB cord to make sure that everything flows smooth.. like good ice cream (lol)!

Step 3: Code

We want the sonar sensor to read out the time values in micro seconds so we have to make sure our code is asking for that. (Image above) You don't even need to know how to code, you can just use our code!

Step 4: Finding the Duration

We are going to create a data table with the duration values for five exact locations. (**Make sure the points are equidistant) Using the meter stick/ruler, we are going measure 10 inches from the sonar sensor and place our target object (we are using the phone) wherever the 10 inches mark is and wrote down the duration time. We are going to repeat these same steps for 20 and 30 inches. After writing down our results, we got our equation by graphing the results on a graphing calculator. You can also just use a computer for this step if you want.

**The x value in the equation is the duration, which is what will be used by the sonar sensor to convert the numbers read into inches.

Step 5: Final Code

This new code will ensure that the computer will spit the numbers out in inches! We're done!

Share

    Recommendations

    • Make it Move Contest

      Make it Move Contest
    • Woodworking Contest

      Woodworking Contest
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments

    Good simple guide, thanks for sharing :)