Strange Piicodev RGB module behaviour

I’m trying to integrate the PiicoDev RGB module into a small project, but I’m having difficulty getting it to “behave.” What I want is simply for it to “pulse” from dim to bright and dim again. To achieve this I simply set all the pixels to the same colour, then change the brightness value in a loop. Expected behaviour is that it will start dim at the given colour, then gradually get brighter, then get dimmer again (all on the same colour). The actual behaviour I’m getting is that randomly during the loop, the pixels will “flash” to a very different colour or brightness than expected. I’ve tested each pixel so I know the individual leds in each one are all functional.
Has anyone else experienced this?
Am I using the functions correctly?

There doesn’t appear to be any ‘official’ documentation for it so I cannot check the library implementation: for testing and demonstration I used the one provided on the product page.
While testing with the Python code below, various pixels changed bright green and dim blue or turn completely off in the middle of the loop (they should remain red the whole time):

from machine import Pin
from PiicoDev_RGB import PiicoDev_RGB
from PiicoDev_Unified import sleep_ms # cross-platform compatible sleep function

rgb = PiicoDev_RGB()

rgb.setPixel(0, [255, 0, 0])
rgb.setPixel(1, [255, 0, 0])
rgb.setPixel(2, [255, 0, 0])

brightness = 0
direction = 1

while True:
    brightness += 5*direction
    if brightness > 255:
        brightness = 255
        direction = -1
    if brightness < 0:
        brightness = 0
        direction = 1

(for reference, I’m using a Raspberry Pi Pico. I tried swapping the cables and Pico with no change in behaviour).

1 Like

Hi @Tony102051, we cover a use case like this in the tutorial (Section: Remix - Fade LEDs)
What is the behaviour if you try this example?

Aside, I agree that documentation-by-example isn’t the best, and so we’ll work to update the readme with a full API spec as per other PiicoDev modules.
Thanks for your feedback!

1 Like

Hi Tony,

I’ve run your code on the bench with a Pico and Piicodev LED module, and it works as expected (smooth pulsing of red channel, no artifacts).

If you could attach/link a video of the issue, that’d be very helpful in pinpointing your problem. Have you tried reseating the connections just in case it’s just a bad wire?

Rarely a faulty board makes it through our testing process, but it’s possible! A video will help a lot.

Keen to get to the bottom of this one!


Thanks for everyone’s input so far - I took a video but the artifacts are difficult to see because the camera is obviously staring directly into the leds (something I could probably clean up with filters and a pro setup, but my smartphone is all I have at hand).
@James if you’ve run my code successfully on an identical board then I suspect I’m just chasing a red led-herring and this is just a bodgy module.


Hi @Tony102051,

Did you happen to have another RGB module and does the fault occur with it?


I’ve just received a big shipment of the PiicoDev RGB modules, and I can confirm that it was indeed just the one board that was dodgy, my random sampling of the other boards confirms they all perform beautifully, well done to the Core Electronics team.

I did discover that I’m better off setting the brightness only once as a “max value”, and then scaling the RGB values down from that for effect. Using the brightness register alone (after setting the colour) results in pixel 0 drifting “off colour” consistently in all the boards I tested. This indicate that the behaviour is either by design, or a gap in my (limited) understanding of the board so I’ll just wait for more documentation to come out and investigate again later.


Hi Tony - when developing the firmware for the RGB module I can confirm I didn’t expect it to be used in this way. Your approach for fading LEDs is an intuitive one so we’ll make sure it works as expected in the future.
I’ve opened an issue on your behalf so we can track this update.