Arduino Project
Arduino Ultrasonic Distance Meter with LCD V2
Course Introduction
In this project, we use an ultrasonic sensor and three groups of LEDs (green, yellow, red) to simulate a radar-style proximity alert system with the Arduino board.
The system measures the distance to an object and activates different LED groups based on how close the object is: green LEDs indicate a safe distance (≤15 cm), yellow LEDs warn that the object is getting closer (≤10 cm), and red LEDs signal a critical proximity alert (≤5 cm). The LEDs turn on from left to right and turn off from right to left to enhance the visual effect.
Note
If this is your first time working with an Arduino project, we recommend downloading and reviewing the basic materials first.
1.1 Install Arduino IDE(Important)
1.2 Introduction of Arduino IDE
Wiring

Common Connections:
LED
Connect the LEDs cathode to the negative power bus on the breadboard, and the LEDs anode to a 1kΩ resistor then to 4 ~ 12 on the Arduino.
Ultrasonic Sensor Module
Trig: Connect to 3 on the Arduino.
Echo: Connect to 2 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC: Connect to breadboard’s red power bus.
Writing the Code
Note
You can copy this code into Arduino IDE.
Don’t forget to select the board(Arduino UNO R4 WIFI) and the correct port before clicking the Upload button.
