Table of Contents
- 1 Range Finder Using Ultrasonic Sensor & Arduino with OLED Display:
- 2 Components Required:
- 3 Ultrasonic Sensor HC-SR04:
- 4 0.96″ I2C OLED Display:
- 5 Circuit Diagram & Connections:
- 6 Source Code/Programs:
- 7 Video Tutorial & Demonstration:
- 8 Share & Spread Love:
- 9 Related Posts
Range Finder Using Ultrasonic Sensor & Arduino with OLED Display:
In this project we are going to interface Ultrasonic Sensor & Arduino with OLED Display for designing Range Finder. Ultrasonic sensor is used to measure the distance. It acts as a Sonar. It sends an ultrasonic wave of certain frequency which comes back after hitting the object and calculates the time traveled by it. So lets learn about Distance Measurement Using Arduino & HC-SR04 Ultrasonic Sensor.
1. Arduino Uno Board 2. Ultrasonic Sensor HC-SR04 - (Buy Online from Amazon) 3. 0.96" OLED Display - (Buy Online from Amazon) 4. Breadboard 5. Connecting Wires 6. 5V Power Supply
Ultrasonic Sensor HC-SR04:
The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats do. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package.
From 2cm to 400 cm or 1” to 13 feet. Its operation is not affected by sunlight or black material like sharp rangefinders are (although acoustically soft materials like cloth can be difficult to detect). It comes complete with ultrasonic transmitter and receiver module.
The specifications of the ultrasonic distance sensor HC-SR04 are below:
1. Minimum measuring range - 2 cm 2. Maximum measuring range : 400 cm or 4 meter 3. Accuracy : 3 mm 4. Operating Voltage : +5V 5. Operating Current : 15mA 6. Working Frequency : 40 KHz 7. Trigger Input signal : 10us pulse 8. Measuring angle : 15 degree
1. VCC: +5VDC 2. Trig : Trigger (INPUT) 3. Echo: Echo (OUTPUT) 4. GND: GND
How Does it Work?
Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These propagate in the air at the velocity of sound. If they strike an object, then they are reflected back as echo signals to the sensor, which itself computes the distance to the target based on the time-span between emitting the signal and receiving the echo.
We will have to convert this time into cm to calculate the distance traveled. We will use the following equation to calculate the distance.
S = v * t
Ultrasonic wave is basically a sound wave which travels at a speed of 340 m/s (0.034 cm/s). The ultrasonic sensor is measuring the time it takes to hit the object and then come back but we need only time that it takes to hit the object. So, we will divide it by 2.
S = (t * 0.034)/2
0.96″ I2C OLED Display:
This is a 0.96 inch blue OLED display module. The display module can be interfaced with any microcontroller using SPI/IIC protocols. It is having a resolution of 128×64. The package includes display board, display,4 pin male header pre-soldered to board.
OLED (Organic Light-Emitting Diode) is a self light-emitting technology composed of a thin, multi-layered organic film placed between an anode and cathode. In contrast to LCD technology, OLED does not require a backlight. OLED possesses high application potential for virtually all types of displays and is regarded as the ultimate technology for the next generation of flat-panel displays.
Circuit Diagram & Connections:
For project Range Finder Using Ultrasonic Sensor & Arduino with OLED Display, copy this code then compile and upload to your Arduino board. But before that you need to add these libraries. So download from below.