Maker.io main logo

Change Random Colors NeoPixel Shield Adafruit & Arduino - 40 RGB LED Pi

2026-05-12 | By Ron Cutts

License: GNU Lesser General Public License Displays LED Strips Microcontrollers Arduino

In this tutorial, we will learn how to use the Adafruit NeoPixel Shield for Arduino - 40 RGB LED Pixel Matrix by randomly changing each pixel's color.

Watch the 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

The Circuit

Attach the shield to the ArduinoUno.

The Circuit

Start Visuino, and select the Arduino UNO board type.

The Visuino: https://www.visuino.eu also needs to be installed. Download the free version or register for a free trial.

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 "Counter" component

  • Add "Clock Generator" component

  • Add "Random Color" component

  • Add "NeoPixels" 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 "ClockGenerator1" and in the properties window set "Frequency" to 5 <<this will be the speed of changing the color; you can change the frequency if you want

  • Select "Counter1" and in the properties window, set "Max" > "Value" to 40 and "Min" > "Value" to 0

  • Double-click on "NeoPixels1" and in the "Pixel Groups" window Drag ""Color Pixel" window to the left side, and in the properties window, set "Count Pixels" to 40

  • Close "Pixel Groups" window

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 "ClockGenerator1" pin [Out] to "Counter1" pin [In]

  • Connect "Counter1" pin [Out] to "RandomColor1" pin [Clock]

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

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

In Visuino Connect Components

Generate, Compile, and Upload the Code

In Visuino, at the bottom, click on the "Build" tab, make sure the correct port is selected, and then click on the "Compile/Build and Upload" button.

Generate, Compile, and Upload the Code

Play

If you power the Arduino module, the LED Pixel Matrix pixels will start to randomly change color.

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

Downloads

Mfr Part # 1430
BOARD NEOPIXEL SHIELD 40 RGB LED
Adafruit Industries LLC
€23.75
View More Details
Mfr Part # 2866
ADAFRUIT NEOPIXEL SHIELD - 40 RG
Adafruit Industries LLC
€29.70
View More Details
Mfr Part # 2864
ADAFRUIT NEOPIXEL SHIELD - 40 RG
Adafruit Industries LLC
€29.70
View More Details
Mfr Part # 2865
ADAFRUIT NEOPIXEL SHIELD - 40 RG
Adafruit Industries LLC
€29.70
View More Details
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.