Tag Archives: neoPixel

AI on the Edge LESSON 45: Adding a NeoPixel Ring To Your Raspberry Pi Project

In Lesson 45 of our AI on the Edge series, we take our Fusion AI Lab Kit to the next level by adding a 12-pixel NeoPixel ring. This lesson bridges the gap between pure AI processing and vibrant physical output, showing how your edge AI projects can communicate visually with the real world in a beautiful and engaging way.
We begin by setting up the NeoPixel ring using the SPI interface on the SunFounder Fusion Hat. After importing the necessary libraries (time, board, neopixel_spi, colorsys, and math), we create a simple and reusable hsv2rgb() function that converts Hue values (0.0 to 1.0) into RGB colors that the NeoPixels can understand. This function becomes the foundation for smooth rainbow effects later in the lesson.The lesson starts with basic pixel control. We manually light up each of the 12 pixels one at a time using different colors (red, green, blue, cyan, magenta, yellow, etc.). This slow, deliberate approach lets you clearly see how individual pixel addressing works and helps students understand the coordinate system of the ring.Next, we explore full-ring control by making the entire ring blink between bright red and blue. We then move into motion with a running green pixel moving across a red background — a great introduction to animation techniques. This is followed by a more advanced chasing effect where a blue pixel chases a green pixel around a dim red background.One of the highlights of this lesson is the gentle pulsating aqua effect. Using a sine wave (math.sin), we create a smooth breathing/pulsing animation where the brightness of the color rises and falls naturally. This technique produces a very professional and visually pleasing result that students can easily adapt for future projects.
Finally, we create a rainbow effect. First, we display a uniform rainbow where all 12 pixels show the same color that cycles smoothly through the entire spectrum.
We finish the lesson by assigning the homework. The homework is for you to create the classic running rainbow (what I like to call a “Runbow”), where the colors flow continuously around the ring — one of the most popular and impressive NeoPixel animations.
This lesson reinforces important programming concepts including loops, functions, color theory (HSV vs RGB), timing control, and animation techniques, while giving students an exciting visual payoff. The skills learned here open the door to creating stunning visual feedback for future AI projects — whether it’s status indicators, emotional displays, or attention-grabbing outputs from your edge AI models.

In this class we are using this as our standard components. You should already have the core circuit built and should already have the OLED connected. Today you will add the NeoPixel array.

Our core circuit is:

Fusion Hat Circuit Diagram
This is the circuit we will use moving forward in the class

Last week we also added the SSD1306 OLED Display.

OLED
SSD1306 OLED Connected to the Fusion AI Hat

And finally today we add the NeoPixel ring from the Fusion AI Lab Kit.

NeoPixel
NeoPixel Schematic

Controlling NeoPixel Array on PIO State Machine on Raspberry Pi Pico

In this video lesson we show how neopixels work at a fundamental level, and show how you can use the Raspberry Pi Pico State Machines to control the neoixels. Neopixels are an excellent example for showing the importance of the pico state machine. The neopixels demand precise timing and sequence of bits to operate properly, and that precision can not be achieved in python. The video explains how the State Machines can be programmed to control the neopixels.

For your convenience, the code is included below.

 

Control NeoPixel Array With Infrared IR Remote Control on Raspberry Pi Pico in MicroPython

In this lesson we show how we can control the neoPixel array using an Infrared IR Remote Control on the Raspberry Pi Pico W in micropython. The video above explains things step-by-step. For your convenience, the code is included below. Enjoy!