WS2812B Neopixel - not lighting up as expected

Hi, so I’ve decided to venture into the world of neopixels

My current setup is very basic as I’m just attempting to get strandtest.py to light up as expected through my RPi


(rpi_ws281x/strandtest.py at master · jgarff/rpi_ws281x · GitHub)

Difficult to see in the image, but only 2 LEDs closest to Din light up, this occurs during the Rainbow animation part of the test. During rainbow animation, they may change colours a few times.Other phases (colourwipe and theatre) don’t reliably produce any lights.

The goal was to recreate this GitHub - naztronaut/dancyPi-audio-reactive-led: Real-time WS2812b LED strip music visualization using Python and the ESP8266 or Raspberry Pi.
and if you want to read the long version of what I have tried so far it is here
LEDs laggy FPS normal · Issue #37 · naztronaut/dancyPi-audio-reactive-led · GitHub

In this I had tried to recreate this build as well How to use WS2812B RGB LEDs with Raspberry Pi - Video Tutorial Australia (no photo) but still ended up with flickering and unsuccessful strandtest.py

I’ve run out of ideas except for that there is an issue with the LED Strip perhaps damaged in my careless attempts to get things working.

The reason I have power going out one end and data the other is because 3 years ago, I pulled out one of the ground wires on the Din side - not sure how much this matters, maybe I have the ground cables wrong but I also tried using both grounds on the Dout side without any difference

Hey Alex,

Looks like an awesome project, I love seeing reactive projects and integrating music and technology!

How were you powering the strip? The NeoPixels require quite a bit of power so you will need an additional power supply for the strip (not just powering from the Pi). (Check out this 2A and 4A supply)

Just note you will also need a logic level converter to bring the logic voltage up to 5V, which is what the WS2812B’s use.

Let us know how you go!
Liam.

I’ve tried powering through RPi as you can see in the image. But have also tried using a Powerbank that is 5V 2.0A, also tried a surge protector that has USB outlets rated as 2.4A. All performed very similarly.

I feel like power probably wouldnt be an issue because in my setups for the Audio Reactive LEDs, if I set N.Pixels = 10 and FPS = 80, I can actually get all pixels to light up (although erratic). This in itself is confusing because only 10 Pixels should light up. However what I find most confusing is if my RPi is just idle, the lights display very laggy (like old christmas lights), but If I increase load on the RPi eg. playing 2 x youtube videoes, then I get rapid flickering similar to the FPS rate

I did also used one of these
https://www.jaycar.com.au/arduino-compatible-logic-level-converter-module/p/XC4486

with 5V (from PS) as HP, Ground from PS, 3.3V from RPi and Ground from RPi
and then GPIO18 > TXI (3.3V) > TXO (5V) > Din

Result was exactly the same

EDIT: Here is a picture of the full setup when running Audio Reactive LEDs with N.Pixels =54 and playing youtube video. Only the first ~8 LEDs flicker but do not follow the pattern that it is supposed to. If I stop playing the youtube video. Lights go back to being like christmas lights. For some reason, this was not working with a 300ohm resistor for the Data In cable so I removed it.

Hey Alex,

Thanks for following up, we’ll see if we can troubleshoot some issues.

Just to start with, I’d suggest having a read of this tutorial for getting up and running with the NeoPixels when using the Pi and putting together the setup shown there, it looks like you have all the components (the video is also super helpful too!). It’d be good just to get the most basic example going to test the strip before attempting a more difficult approach.

I think you may have a few wiring issues in that photo you just sent us, I believe the NeoPixel strips can be powered from either side, but data can only be passed in on one side which is highlighted on the strip by Din->Dout (you can see it in the Fritzing Diagram we have in that tutorial). if you don’t have the Data wire on the Din side, you can just solder directly to the copper contacts on the strip.

Not that it should matter, as you have it grounded on the other side, but in the photo it also appears you have the grounding wire for your strip on one side plugged into nothing. It could just be the angle of the photo though!

You will also need a grounding connection between the Power Supply and the Pi, I have drawn a wire in for an easy fix for this below!

I’d definitely look into trying to put together the basic circuit first though. Hope this helps!

Hi Owen,

  1. Yes it was just a bad angle but the grounding wire was plugged into the blue rail
    also yes I am using Data In for the TxO > White > Red > Black cable

  2. I added the connecting ground wire but still behaved very similarly. Perhaps the only change was in Christmas lights mode there were more lights lighting up

  3. The basic circuit is not too different to my existing circuit as far as I can see, but I rearranged the wires to fit the diagram closer, removed the capacitor (just in case) and strandtest.py still only lit up 2 LEDs during Rainbow animation. The only thing I am missing is a Barrel Jack which I dont think matters too much?

strandtest.py was run using sudo python3 strandtest.py
I’ve already added the two /boot/config.text settings without any effect

Hey Alex,

Sorry to hear those troubleshooting steps didn’t resolve the issue. If possible, are you able to upload a video showing us the output of the LED’s when running different modes? Also are you editing the code at all other than the couple of alterations mentioned above? If so, shoot us through the code you are using!

Sounds like there’s multiple layers of issues going on. Can you just get the LEDs working first?

You might just have a broken data line. Are they definitely rgb ws2812b Leds?

Hi Owen, I have not modified any of the code.

This is an older video, but currently circuit + strandtest performs very similar, I have run strandtest multiple times, and cut about 5 LEDs thus far. With each removal of 1 LED, at best, I could only get 3 LEDs to light up during Rainbow animation

Christmas lights mode - it’s not actually a mode, just the audio reactive LEDs code performs similar to christmas lights
This is running any of the three Audio Reactive LEDs python codes (Scroll, Spectrum, Energy) without any other processes going on with the RPi. There may be slight variations between the 3 codes but essesntially is laggy and rainbow coloured without any specific pattern. I cant remember what N.PIXEL was set to in this case

This last video is whilst playing a youtube video / anything that uses processing power. This would have been with N.PIXEL as fairly low eg.= 10

If N.PIXEL= 54 the lights concentrate on the first 8 LEDs and are able to achieve white, but the rest of the LEDs very rarely light up.

Oliver - There are times where all LEDs can light up (although a rainbow of colours)
The LED strip is the one I bought from CE a few years ago.
Added link in case you cant see my order history

Do you have any suggestions on how I could diagnose a broken data line issue? Ta

Hi Guys
I am probably wrong but did I read somewhere in the past that these LEDs in this sort of thing are individually addressable or at least addressable in blocks?
Would it be possible that only the first few are being addressed?
Does the power source have enough grunt?
I have learned over the past 50 years that when one has a problem it is always good policy to check the power supply first as without this properly functioning nothing works. At Xmas I purchased a 5M RGB LED string with a small controller and at 5V it needs over 2.5A and that is without white. I can’t see too many microcontrollers supplying this. I would have thought an external supply would be required to supply the LED current.
Cheers Bob

1 Like

Hi Alex

You could try time domain reflectometry.
Seriously if you have access to both ends a simple continuity check should do. If you can see it along the string a visual check may reveal something. Don’t forget the ground connection is part of both the LED current and data circuits.
Cheers Bob

For those still playing at home.

Tried 4A power supply on existing build (from post #4) - results are exactly the same
Tried a different LED strip and performance is very similar
Tried switching new build to 2nd RPi - results very similar.

@Robert93820 - could not see anything out of the ordinary but what do I know…given a second LED strip performs the same I think I have ruled out the LED strip as the issue

I’m confused as to how two RPis purchased at different times have the same issue perhaps the issue is software / speaker issue. To add to the confusion I incidentally found that even if I dont change the GPIO setting in the python code for audio reactive LEDs, the LEDs still light up regardless of whether I plug into GPIO 12 or 18. Yet it is still responsive to music and not entirely random. Going to try another fresh install of OS and perhaps a different code.

Hi Alex.
I have only been reading and responding to this forum for a relatively short time and I have formed a few impressions about these RPi things. None of them very good.
I personally would not be surprised if someone posted saying they purchased 2 units at the same time from the same shop and came up with entirely separate problems with each. I know there are probably millions of these things out there and the percentage on this forum itiny but they don’t seem to be very backward compatible. People seem to buy a new one and start again. Good practise I suppose if you have the time and I take my hat off to the people sorting out the problems. Somebody said on this forum some time ago that the marketing people should start talking with the design people. Aint that the truth.
I stress these are only my opinion and is coming from someone who has never used one. And at my stage in life not likely to do so but you never know!!!

Getting back to your original problem I did a quick check and found these NeoPixels are individually addressable You might check and make sure you are addressing all the pixels. I think you have to tell each individual pixel (LED) what to do. I would personally get the LEDs to work properly before worrying too much about speakers and music. Sort out one thing at a time or you will finish up going around in circles. Oh and write everything down, you will be surprised how useful that can be if you have to back track.

Cheers Bob

Thanks, yes I just processed things in my head to realise the speaker is not the issue due to strandtest.py not working. They are definitely supposed to be individually addressable, I just figure since other people seem to be able to get this working without significant changes to the python code, that my issue is probably outside of the python code. Will look at some more basic LED codes to see what I can try

Fresh install was no use.

1 Like

Got it working! I’m lucky no one saw my reaction but needless to say I was over the moon.

Other things I had tried this weekend included

  • removing the logic shifter and having data cable straight from RPi to WS2812. I had read some forums saying certain logic shifters could not operate at the desired frequency? required for the neopixels. Along the lines of being too slow and that the advised part to use was a 74AHCT125. Since this did not change anything, I thought it possibly would not be this as an issue
  • looked up info on running gpiotest. Result were 0 failed items, so this gave me confidence that GPIO pins were working fine. I already thought this was unlikely as two RPis had same issue.
  • i started looking up the different specs of Strandtest.py and config.py for audio reactive leds. Whilst reading up on LED_DMA - found this pypi.org/project/rpi-ws281x/

Going to the section ‘Limitations’ for PWM tried blacklisting snd_bcm2835, rebooted and ran audio reactive LEDs
Interestingly there are comments about using DMA = 5 conflicting with OS, I noticed audio reactive LEDs config.py specifies 5 and that DMA = 10 is safer. However did not have to change this for it to work

Thank you all for your support.

3 Likes

Congratulations and thanks for letting us know the result.
Cheers Bob

2 Likes