Led strip connected to raspberry changes color without any reason

Hello,

I am new on this forum so don’t hesitate to tell me if I need to be more precise/specific.

I am in the process of building a 7 segments DIY LED scoreboard. I am controlling it with a raspberry pi and using a wireless keyboard as the remote for this scoreboard.

The wiring is the same than the one showed in the core electronics’ youtube video in the chapter “Assembly for Long Led strip”.

The left score is supposed to be red, the right score is supposed to be blue and the two separating dots are supposed to be green as in the first picture.

I noticed an issue, when I change the score (on a key press on the keyboard), sometimes the colors change and some led turn on when they are not supposed to as you can see in the following picture.

By changing the score again, or a few times, it comes back to normal.

What is surprising is that when the raspberry is plugged in through HDMI to a monitor, this very problem stops, I suspect a grounding issue…

With the HDMI plugged in I still have the following issue though:
Sometimes on a score change, all led turn white, on the next score change the problem goes away and the score displays correctly again.

I would like for those two issues to go away since I plan on using the scoreboard without any screen plugged to the raspberry.

Thank you for your help :slight_smile:

1 Like

Hi Robin,

Welcome to the forum and sweet project!!

Not at all, this is all written up very well.

I suspect the HDMI of the Pi is taking up processing power that would otherwise be used to control the LED’s (default Pi settings effectively turns off the HDMI output)

This is odd, do you have a colour fill function in your code somewhere?

If you have microcontrollers like an Arduino or Pico lying around it might be worth swapping over the ‘drawing’ of the pixels to those and the Pi to do higher level tasks like keeping track of times and colours.

If you can paste your code in we can definitely take a look at it!
Liam

2 Likes

First thought that came to mind was power.
How much current and what voltage do those segments need ??

Looks like you are using an external supply, not through the Pi.
GNDs needs to be common for proper referencing of the signal from the Pi.

Second is software, as @Liam said post your code, there might be some quirk in it that is causing the problem.

Cheers
Jim

1 Like

Hi Liam,

Thanks for the welcome and your answer.

Having the HDMI plugged in actually makes the scoreboard work great, it prevents the color change from happening. I suspect the HDMI cable being plugged in to the screen to ground the raspberry in some way.

Let me share my code with you, I have three files accessible through this link

I haven’t defined any other possible colors than red, blue and green in the code, I don’t think it comes from a software issue.
What makes me feel confident saying this is the fact that it works well (except for the led turning all white sometimes) with the HDMI plugged-in to a screen.

Also what could be worth precising is that, the python script is automatically launched on the raspberry start-up to avoid having to plug any screen and to launch the script manually.

Thank you!

Hey James,

Thanks for your answer, here is the reference of the led strip I bought

It says the strip needs a voltage of 5V and a current of 9A for 150 leds.
My external supply is 5V and 3A and my scoreboards consists of 90 leds.
That might be an issue, though since it works with the HDMI plugged in and I have another led strip of 120 leds powered by a 5V, 2.4A supply working well (with WLED) I am having a hard time believing power is the issue…

I am indeed using a external supply, I wired the strip and PI in the exact same way it is done in the video I linked in my post, so I would think my circuit is properly grounded.

As for the software side, you can have a look at my answer to @Liam :slight_smile:

Thank you!

1 Like

That figure allows for some overhead. The usual figure is 1.5A per 30 LEDs. However, that is for all LEDs turned on at full brightness. I assume you have unused LEDS in the space between segments, and you might be running at less than full brightness.

You could determine if the capacity of your supply is the issue by building a test sequence that gradually turns on more and more segments, changing the pattern each time, to check if the problem starts occurring at some point in the sequence. At the same time you can monitor the voltage to see if the supply is being overloaded. Then you can reduce the brightness so you don’t exceed that level. When testing the voltage be sure to test what the LED strip is actually seeing - positive as well as ground. Testing at the supply source or with some other ground may give false results.

1 Like

In the video Tim says LEDs range from 20mA to 60mA, which I agree with.
90 LEDs would range from 1.8A to 5.4A.
The external supply should be ok, as long as all LEDs are not on at the same time and not white light.

The circuit functions as expected proving the wiring, logic and software are basically correct.
In my experience, the symptoms displayed means something is pushing the circuit outside its parameters.
Power supply issue is an obvious one. Monitoring the supply with an oscilloscope would show any power fluctuations. A multimeter may show something but would not show transient spikes of dips.
A transient can cause the data stream to the LEDs to be corrupted possibly causing what you are seeing.

In my experience with RGB LEDs use of a capacitor, close to where the power connects to the strip can help but in some cases it did not. The suggestion from the manufacturer was 100uF or so.

Just another thought.
The Amazon price seems very low compared to the Core Electronics price. Hopefully they are both of the same quality. In my experience sometimes the lower priced item is not as good as it should be.

Hope you can get it solved, because it looks like a really neat project.
Regards
Jim

Hi All
Robin says

It always amazes me how often I see things like this. I can never understand why a lot of makers and hobbyists insist on undercooking their power supply capability then struggle to get the last few mA and try to squeeze the last drop out of a supply which is too small in the first place. This invariably leads to problems and can spend days trying to fix or come to some workable compromise.

One golden rule which has been working for me for some 60 years. When a problem arises start with the power supply. It is surprising how many faults can be attributed to power supply problems.

So why not start with a power supply which is far too large then trim it down if required when all the known figures are known. Doing this will remove one item from the list when trouble shooting during any development stage and save a lot of potential headaches.

Personally I have a 5V supply driving a couple of modest (150 LEDs each) LED strings for Xmas lights plus another string on a separate controller (commercial product). My supply is 14A. A bit of an overkill in practise but I can use this supply if experimenting with anything likely to need a bit of current then change it to something more suitable later.
Cheers Bob

1 Like