Hi Friends, Today In This Article, i Will Show You How To Make DISTANCE METER WITH ARDUINO.
as we know the Ultrasonic sensors are great tools for measure distance and detect objects , In this project, we have used the HC-SR04 Ultrasonic Sensor with Arduino and Oled Display to determine the distance of an obstacle from the sensor.
WHAT IS AN ULTRASONIC SENSOR?
An ultra sound sensor is a device for measuring distances . Its operation is based on the sending of a high frequency pulse, not audible by the human being. This pulse bounces off nearby objects and is reflected back to the sensor, which has a suitable microphone for that frequency.
By measuring the time between pulses , knowing the speed of sound, we can estimate the distance of the object against whose surface the ultrasound pulse hit
Ultrasonic sensors are cheap sensors, and easy to use . The theoretical measurement range of the HC-SR04 sensor is 2cm to 400cm, with a resolution of 0.3cm. In practice, however, the actual measurement range is much more limited, around 20cm to 2 meters.
HOW DOES AN ULTRASONIC SENSOR WORK?
The sensor is simply based on measuring the time between sending and receiving a sound pulse . We know that the speed of sound is 343 m / s in conditions of temperature 20 ºC, 50% humidity, atmospheric pressure at sea level. Transforming units results
Distance= (Time x Speed of Sound in Air (340 m/s))/2
Components for DISTANCE METER USING ARDUINO
- Arduino Uno or Nano
- Ultrasonic sensor Module
- Bread board
- Connecting wires
- OLED Display
DISTANCE METER USING ARDUINO Circuit Diagram
While mounting on a breadboard would be the following.
Arduino Nano Ultrasonic Sensor Arduino Nano OLED Display
D8 Echo pin A5 SCL
D9 Trig pin A4 SDA
GND GND GND GND
5V VCC 5v vCC
Code for Distance Measurement
The complete code for this distance measurement project is given at the bottom of this page. In the code we read time by using pulseIn(pin). And then perform calculations and displayed result on the OLED display .
CODE For Arduino distance meter
Click here for free code
Video which shows how to make DISTANCE METER USING ARDUINO