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