Introduction: Distance Measuring Device Without LCD or LED Display

About: I'm a Young Inventor. 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.

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