Arduino Nano with Ultrasonic Sensor & OLED Display | KitKraft Distance Measuring Project

Arduino Nano with Ultrasonic Sensor & OLED Display | KitKraft Distance Measuring Project

In this project, we’ll explore how to build a simple distance measuring device using an Arduino Nano, an HC-SR04 ultrasonic sensor, and a 0.96-inch OLED display. This setup can be applied to various DIY applications such as obstacle detection, object measurement, or even smart parking systems. It's a great project for beginners looking to learn more about sensors and data visualization on displays.

Components Required

To get started, you’ll need the following components:

  • Arduino Nano: The brain of the project, controlling the sensor and display.
  • HC-SR04 Ultrasonic Sensor: Measures the distance between the sensor and an object.
  • 0.96-inch OLED Display: Displays the measured distance in real-time.
  • Jumper Wires: For connecting components.
  • Breadboard: To prototype your connections.
  • USB Cable: To upload the code to the Arduino and power it.

How Does It Work?

The HC-SR04 ultrasonic sensor works by sending out an ultrasonic pulse and waiting for the pulse to reflect back from an object. By measuring the time it takes for the pulse to return, the Arduino calculates the distance using the speed of sound formula. The calculated distance is then displayed on the OLED display in centimeters (cm).

Circuit Diagram

The wiring for this project is straightforward:

  • VCC of the ultrasonic sensor to 5V on the Arduino Nano.
  • GND to GND.
  • TRIG to D2 and ECHO to D3 on the Arduino Nano.
  • OLED Display connected via I2C interface:
    • VCC to 5V,
    • GND to GND,
    • SDA to A4, and
    • SCL to A5

Key Features:

  • Accurate Distance Measurement: The HC-SR04 ultrasonic sensor provides accurate distance readings.
  • OLED Display: The compact 0.96-inch display shows real-time data, making the device portable and easy to read.
  • Easy to Build: This project is beginner-friendly, requiring only basic wiring and a simple code.

Applications

This project can be expanded to a wide variety of applications:

  • Obstacle Detection for Robots: Integrate the distance sensor into a robot to detect nearby obstacles and avoid collisions.
  • Smart Parking System: Use the sensor to help drivers park by measuring the distance between the vehicle and obstacles.
  • Object Measurement: Use this device to measure the distance of various objects in workshops, laboratories, or classrooms.

Conclusion

This project is a great introduction to working with sensors and displays. It’s simple to set up, and the results are displayed instantly. As you get comfortable with this project, you can enhance it by adding more features like sound alarms or integrating it with a smart home system.

Watch the Project in Action: Watch here on YouTube Shorts

For Code & Schematics: Click Here

Frequently Asked Questions

Does this kit require soldering?
No — KitKraft's DIY kits are designed as plug-and-play breadboard builds. Header pins may need to be attached on some advanced/maker-level components, but no soldering is required for the core build.
Is the code pre-loaded, or do I need to upload it myself?
Code is provided (linked in this guide, or included with the kit) and needs to be uploaded to the board yourself using the free Arduino IDE — that's part of the learning experience. Step-by-step upload instructions are included in this guide.
What skill level or age is this project suitable for?
This project is beginner-friendly and works well for school students, engineering students, and hobbyists getting started with electronics — no prior coding or circuit experience is required.
What if I get stuck while building it?
KitKraft offers WhatsApp tech support with every kit purchase, and the wiring diagram, code, and video walkthrough are all included in this guide.