Distance + Speed Meter Project.

by DESHBOT in Circuits > Arduino

22 Views, 0 Favorites, 0 Comments

Distance + Speed Meter Project.

dissss.jpeg
diso.jpeg

The objective of this project is to create a multi-function measurement system using an Arduino Nano/UNO, an ultrasonic sensor, an IR sensor, and an OLED display.

The system provides three readings:

  1. 📏 Ultrasonic distance
  2. 🚀 Ultrasonic-based speed
  3. ⚡ IR-based speed

The readings are displayed on a 128×64 OLED display.

Supplies

des 1.jpeg
uno.jpeg
oled.jpeg
ultra.jpeg
WhatsApp Image 2026-09-01 at 10.40.40 AM.jpeg

Deshbot shield

Arduino Nano/UNO

HC-SR04 ultrasonic sensor

IR sensor module

0.96-inch 128×64 OLED display

Jumper wires

Pin Connections

Pin Connections

HC-SR04 Ultrasonic Sensor

HC-SR04Arduino

VCC - 5V

GND - GND

TRIG - A0

ECHO - d13

IR Sensor

IR SensorArduino

VCC - 5V

GND - GND

OUT - D9

OLED Display

OLEDArduino

VCC - 5V

GND - GND

SDA - A4

SCL - A5

Working Principle


1. Ultrasonic Distance

The HC-SR04 sends an ultrasonic pulse toward an object. The pulse reflects from the object and returns to the sensor.

The Arduino measures the time taken by the pulse to return and calculates the distance.

The OLED displays the distance in centimeters.

Example:

ULTRASONIC DISTANCE

125.4 cm

2. Ultrasonic Speed

The Arduino continuously measures the ultrasonic distance.

By comparing the current distance with the previous distance and measuring the time between measurements, the system estimates how quickly the distance is changing.

The estimated speed is displayed in km/h.

Example:

ULTRASONIC SPEED

18.2 km/h

3. IR Speed

The IR sensor detects an object when it passes in front of the sensor.

The Arduino measures the time between IR detections and uses a predefined reference distance to calculate an estimated speed.

Example:

IR SPEED

20.5 km/h

OLED Display

Because the OLED is 128×64 pixels, the system uses three display screens.

Screen 1 – Distance

ULTRASONIC DISTANCE

125.4
cm

Screen 2 – Ultrasonic Speed

ULTRASONIC SPEED

18.2
km/h

Screen 3 – IR Speed

IR SPEED

20.5
km/h

The display automatically changes between the screens every 2 seconds.

Software

The project uses:

  1. Arduino C/C++
  2. Wire library
  3. Adafruit GFX library
  4. Adafruit SSD1306 library

Working Flow

OBJECT
↓
┌─────────────────┐
│ HC-SR04 │
│ Distance Sensor │
└────────┬────────┘
│
↓
Arduino
↑
│
┌────────┴────────┐
│ IR Sensor │
│ Speed Detection │
└─────────────────┘
│
↓
OLED Display
│
┌────────┼────────┐
↓ ↓ ↓
Distance Ultra IR
Speed Speed

Conclusion


This project combines an HC-SR04 ultrasonic sensor, IR sensor, Arduino Nano/UNO, and OLED display to create a multifunction measurement system.

It demonstrates how different sensors can be used together to measure distance and speed and display the results on an OLED screen.