Skip to main content

How to make your own DIY Ultrasonic Range Finder?

Hello viewers,

Today we are gonna build a Ultrasonic Range Finder. This is basically an essential part of our Interstellar Rovers. Let's Start of by learning to connect the components.

Step-1: Click on Tinkercad in your web browser.



Step-2: Create an account or sign in if you have an existing Autodesk account.




Step-3: Click on Circuits in your Dashboard.




Step-4: You'll need to Drag and drop an Arduino UNO R3 as well as an Distance sensor from the components Menu on the right.



Step-5: Click on Arduino GND port and drag the wire to the Sensor GND port. Similarly. click on 5V Arduino port and drag the wire to the sensor port.




Step-6: Connect the digital pin to the SIG pin on the sensor.


It's Time to Code! 


/*
  Ping))) Sensor

  This sketch reads a PING))) ultrasonic
  rangefinder and returns the distance to the
  closest object in range. To do this, it sends a
  pulse to the sensor to initiate a reading, then
  listens for a pulse to return.  The length of
  the returning pulse is proportional to the
  distance of the object from the sensor.

  The circuit:
   * +V connection of the PING))) attached to +5V
   * GND connection attached to ground
   * SIG connection attached to digital pin 7

  http://www.arduino.cc/en/Tutorial/Ping

  This example code is in the public domain.
*/

int inches = 0;

int cm = 0;

long readUltrasonicDistance(int triggerPin, int echoPin)
{
  pinMode(triggerPin, OUTPUT);  // Clear the trigger
  digitalWrite(triggerPin, LOW);
  delayMicroseconds(2);
  // Sets the trigger pin to HIGH state for 10 microseconds
  digitalWrite(triggerPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin, LOW);
  pinMode(echoPin, INPUT);
  // Reads the echo pin, and returns the sound wave travel time in microseconds
  return pulseIn(echoPin, HIGH);
}

void setup()
{
  Serial.begin(9600);

}

void loop()
{
  // measure the ping time in cm
  cm = 0.01723 * readUltrasonicDistance(7, 7);
  // convert to inches by dividing by 2.54
  inches = (cm / 2.54);
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.println("cm");
  delay(100); // Wait for 100 millisecond(s)
}

I hope the content is helpful!



Comments

Popular posts from this blog

Tech 2019

I work on projects that would be helpful for everybody and I prefer to work on analytical models. Just wanna share my recent projects that i worked on. This second one is a Micro Controllers based Smart Energy Monitoring system. This mini circuit board helps us to save electricity by adding capacitor banks to the load side in decreasing reactive power loss. In this way, electricity can be consumed as well as use efficiently. We know that Fossil fuels are getting exhausted and its important to find the other conventional sources of energy.So, this is a picture of a Solar lamp I made, learnt in a workshop.  Apart from finding an alternate source of energy, its important to use the energy efficiently. So, this is solar tracker. If we connect a solar panel to a solar tracker, this will be great way to use energy wisely. Advantage of a solar tracker is to tilt the panels depending on the intensity of light.            ...

Introduction to Tinkercad: How to build and Simulate?

Hello Viewers! I know we miss attending arduino workshops, buying our gadgets, purchasing arduino's and building stuff with them due to COVID-19. I have a surprise for you guys. It absolutely costs 0$, why don't you simulate your stuff online. This is a Introduction Video on how to build your arduino circuits online. We are using Autodesk Tinkercad website for simulating our circuits. Tinkercad is a user-friendly website where you can drag and drop your components and connect them easily. This is something which you guys should look into. I recommend this website to all the tech lovers. You'll absolutely love its ease while working. Apart from building circuits online, you can learn, teach, as well blog on Tinkercad. I wish you best of luck for your Learning! Check my video below, and comment if you have any doubts.

Arduino Temperature Sensor

Everybody has a point in life which turns entirely different than what they thought they would like. Sometimes, we eagerly look for hobbies, something techy and geeky and end up getting into nothing. But, one day, there comes this, amazing hobby from nowhere which interests us a lot. That's how arduino came into my life.  In my opinion, it is a wonderful and interesting open source to work with. This was my first project i worked on Arduino.  Here's a brief Note on what you would be Needing. Components Required: 1. Arduino Nano x 1  2. Breadboard Mini x 1  3. LCD x 1  4. Temperature sensor x 1  5. Wires That's all you'll need. I would like to share more information in my upcoming blogs.