Maker.io main logo

Arduino LED Ring Ultrasonic Distance Sensor

46

2026-08-06 | By Ron Cutts

License: GNU Lesser General Public License Distance LED Strips Arduino

In this tutorial, we will learn how to use an LED ring and an ultrasonic module to measure the distance.

Watch the demonstration video.

Learn more about Visuino: What is Visuino

What You Will Need

What You Will Need

What You Will Need photo 2

What You Will Need photo 3

What You Will Need photo 4

What You Will Need photo 5

What You Will Need photo 6

The Circuit

  • Connect LED Ring pin [VCC] to Arduino pin [+5V]

  • Connect LED Ring pin [GND] to Arduino pin [GND]

  • Connect LED Ring pin [IN] or (DI) to Arduino digital pin [6]

  • Connect Ultrasonic module pin (VCC) to Arduino pin [+5V]

  • Connect Ultrasonic module pin (GND) to Arduino pin [GND]

  • Connect Ultrasonic module pin (ECHO) to Arduino digital pin [3]

  • Connect Ultrasonic module pin (TRIG) to Arduino digital pin (2)

The Circuit

Start Visuino, and Select the Arduino UNO Board Type

To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher; otherwise, this will not work! If you have not done so, follow the steps to set up the Arduino IDE to program Arduino UNO! The Visuino: https://www.visuino.eu also needs to be installed. Start Visuino as shown in the first picture. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino. When the dialog appears, select "Arduino UNO" as shown in Picture 2

Start Visuino, and Select the Arduino UNO Board Type

Start Visuino, and Select the Arduino UNO Board Type photo 2

In Visuino, Add Components

  • Add "Ultrasonic Ranger(Ping)" component

  • Add "NeoPixels" component

  • Add "Ramp To Analog Value" component

  • Add "Analog To Unsigned" component

  • Add 2X "Compare Analog Value" component

  • Add 2X "Color Value" component

  • Add "RGBW Color Multi-Source Merger" component

In Visuino Add Components

In Visuino Add Components photo 2

In Visuino Add Components photo 3

In Visuino Add Components photo 4

In Visuino, Set Components

  • Select "RampToValue1" and in the properties window set "Slope (S)" to 1000

  • Select "CompareValue1" and in the properties window set "Compare Type" to ctBigger and "Value" to 10
    -Select the "Value" field and click on the pin icon and select "Float SinkPin"

  • Select "CompareValue2" and in the properties window set "Compare Type" to ctSmaller
    -Select the "Value" field and click on the pin icon and select "Float SinkPin"

  • Select "ColorValue1" and in the properties window set "Value" to clRed

  • Select "ColorValue2" and in the properties window set "Value" to clLime

  • Double-click on the "NeoPixels1" and in the "PixelGroups" window, drag "Color Pixel" to the left
    On the left side of the "PixelGroups" window, then select "Color Pixel1" and in the properties window set "Count Pixels" to 12 or 16 (Depends on how many LEDs your LED ring has)
    -You can change the LED brightness if you want by changing the value in the "Brightness" field

In Visuino Set Components

In Visuino Set Components photo 2

In Visuino Set Components photo 3

In Visuino Set Components photo 4

In Visuino Connect Components

  • Connect "UltrasonicRanger1" pin [Ping(Trigger)] to Arduino digital pin[2]

  • Connect "Arduino" digital pin[3] Out to "UltrasonicRanger1" pin [Echo]

  • Connect "NeoPixels1" pin [Out] to Arduino digital pin[6]

  • Connect "UltrasonicRanger1" pin [Out] to "RampToValue1" pin[In] and "CompareValue1" pin[Value] and "CompareValue2" pin[Value]

  • Connect "RampToValue1" pin[Out] to "AnalogToUnsigned1" pin [In] and "CompareValue1" pin[In] and "CompareValue2" pin[In]

  • Connect "CompareValue1" pin[Out] to "ColorValue1" pin[clock]

  • Connect "CompareValue2" pin[Out] to "ColorValue2" pin[clock]

  • Connect "ColorValue1" pin[Out] to "RGBWColorMultiMerger1" Pin[0]

  • Connect "ColorValue2" pin[Out] to "RGBWColorMultiMerger1" Pin[1]

  • Connect "RGBWColorMultiMerger1" pin [Out] to "NeoPixels1">Color Pixel1 pin[Color]

  • Connect "AnalogToUnsigned1" to "NeoPixels1">Color Pixel1 pin[U32 Index]

In Visuino Connect Components

Generate, Compile, and Upload the Arduino Code

In Visuino, Press F9 or click on the button shown in Picture 1 to generate the Arduino code, and open the Arduino IDE

In the Arduino IDE, click on the Upload button to compile and upload the code (Picture 2)

Generate, Compile, and Upload the Arduino Code

Generate, Compile, and Upload the Arduino Code photo 2

Play

If you power the Arduino UNO module, the LED ring should start showing the range distance, and if you add an obstacle in front of the range finder module, the LED ring should change its color.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project that I created for this; you can download it here and open it in Visuino: https://www.visuino.eu

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.