Distance Measuring Device Without LCD or LED Display

Introduction: Distance Measuring Device Without LCD or LED Display

About: I work as an engineer , researcher, and student . I wanted to be an astrophysicist in the future. I like to make robots, rockets, and amazing gadgets.

I had made a distance measuring device without an LED or LCD display.

You can also make it by doing the following steps.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Gathering Materials

We need only some material to make it and it will cost only about $10 to $15.

And the materials are as follow:-

1.Arduino Uno with connecting Cable

2.Ultrasonic Sensor

3.Jumper Wires (male to female)

4.PC or Laptop

Step 2: Making the Circuit

For making the circuit we need to do the following connections correctly:-

1. Connect the VCC pin of the sensor 5v+ to the Arduino power pin and GND to GND.

2. Connect the Echo pin to digital pin 10. And Trig to digital pin 9.

Step 3: Uploading the Code

Connect the Arduino cable to Arduino and then to Your PC or Laptop.

Copy the code given below and paste in Arduino software and upload it to Arduino.

// defines pins numbers

const int trigPin = 9;

const int echoPin = 10;

// defines variables

long duration;

int distance;

void setup() {

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output

pinMode(echoPin, INPUT); // Sets the echoPin as an Input

Serial.begin(9600); // Starts the serial communication

}

void loop() {

// Clears the trigPin

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance= duration*0.034/2;

// Prints the distance on the Serial Monitor

Serial.print("Distance: ");

Serial.println(distance);

}

Step 4: Using the Device

For using the device click on the serial monitor and you will see that the device is showing exactly the correct distance. You can find the serial monitor on the corner side of the window with the icon like a magnifying glass.

WRITTEN BY:-

SCIENTIST ANSH MISHRA

Be the First to Share

    Recommendations

    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest
    • Fix It Contest

      Fix It Contest

    Discussions