Maximum LEDs with NeoPixel library

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
glawson6
 
Posts: 3
Joined: Tue Apr 13, 2021 2:57 pm

Maximum LEDs with NeoPixel library

Post by glawson6 »

I recently purchased some lights individually addressable WS2811 LEDs. The strip has 50 lights. When setting the number of pixels to 50 the lights did not work. As a matter of fact, it maxed out at 36. Is there an internal setting in the library that this can be increased or am I facing a resource constraint here? I am using raspberry pi zero W. I did not get any out-of-memory errors. Any help in this matter is greatly appreciated.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Maximum LEDs with NeoPixel library

Post by dastels »

That *should* be fine. The only constraint I've seen is memory.

What language and library are you using? Can you post your code?

Dave

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Maximum LEDs with NeoPixel library

Post by danhalbert »

Also how are you powering the strip? You could be exceeding the current capability of the power supply when trying to illuminate more than 36 pixels.

User avatar
glawson6
 
Posts: 3
Joined: Tue Apr 13, 2021 2:57 pm

Re: Maximum LEDs with NeoPixel library

Post by glawson6 »

I have an external 5V power supply for the strip and a 5V for the pi.

User avatar
glawson6
 
Posts: 3
Joined: Tue Apr 13, 2021 2:57 pm

Re: Maximum LEDs with NeoPixel library

Post by glawson6 »

Here is an example. I can change num_pixels to size of strip.

Code: Select all

import board
import neopixel
import time
import threading

num_pixels = 36
SETUP_DELAY = 0.5
DELAY = 0.25
SHORT_DELAY = 0.0625
white = (255,255,255)
black = (0,0,0)
purple = (120, 81, 169)
old_gold = (207,181,59)
metallic_gold = (212,175,55)
green = (124,252,0)
pixels = neopixel.NeoPixel(board.D12, num_pixels)

def blink_leds_color(numBlink,color):
    for x in range(numBlink):
        pixels.fill(color)
        time.sleep(SETUP_DELAY)
        pixels.fill(black)
        time.sleep(SETUP_DELAY)

blink_leds_color(3,green)

User avatar
blakebr
 
Posts: 942
Joined: Tue Apr 17, 2012 6:23 pm

Re: Maximum LEDs with NeoPixel library

Post by blakebr »

You may wish to fully define your neopixel string like...

Code: Select all

LEDsPerBlock = 1
BlocksOfLEDs = 100
ledCount = (LEDsPerBlock * BlocksOfLEDs) # 1 * 100 = 100
stripBrightness = 0.25
pin = board.D18 # D10, D12, D18, D21 Only
pixels = neopixel.NeoPixel(pin, ledCount, bpp=LEDsPerBlock, auto_write=False, brightness=stripBrightness, pixel_order=neopixel.GRB)
brightness may be your Achilles Heal, reduce to 0.10 and see what happens.
pixel_order may need to be changed to match your LED string

As you can see I am driving 100 LEDs, I use a separate power supply, with no problem.

Bruce
Last edited by blakebr on Tue Dec 07, 2021 12:39 pm, edited 4 times in total.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Maximum LEDs with NeoPixel library

Post by dastels »

glawson6 wrote:I have an external 5V power supply for the strip and a 5V for the pi.
I's the current capacity that's the limiting factor. What's the Amperage spec of the strip power supply?

Are you using a level shifter? on the NeoPixel data line?

Dave

User avatar
blakebr
 
Posts: 942
Joined: Tue Apr 17, 2012 6:23 pm

Re: Maximum LEDs with NeoPixel library

Post by blakebr »

Dave,

Thank you for fixing my post.
Taking L a s i x. ;-) I was in a hurry.

Bruce

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”