Pulling my hair out.

Pulling my hair out. I had an issue where my RGB strip (standard strip, non addressable LEDs) was flickering when brightness was reduced. I was led to believe this was an interrupt issue with my ESP8266.

So I purchased a 2560 Mega and have the same issue :frowning: Iā€™m using a P9813 RGB controller and the shortest piece of code to test with. The Mega being powered over USB and the P9813 powered from a mains 12v adaptor.

#include ā€œFastLED.hā€

#define NUM_LEDS 100
#define CLOCK_PIN 8
#define DATA_PIN 9

CRGB leds[NUM_LEDS];

void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);

FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
leds[0].setRGB( 0, 0, 50);
FastLED.show();
}

void loop() {
Serial.println(ā€œPowered onā€);
delay(1000);
}

missing/deleted image from Google+

Are your grounds all connected?
To each other I meanā€¦

1 common ground

Looks like thereā€™s a + and - connection (along with Data and Clock) from the Mega to the strip controller board so that should mean everything has a common ground.

Two thoughts:
Not that I would think I would make any difference, but shouldnā€™t NUM_LEDS be 1 in this case? The whole strip would just be considered a single ā€œpixelā€, yes?

How many pixels does that strip have? Iā€™m wondering if your 12V power supply is providing enough Amps?

Thanks for the quick replies. I believe the grounds are connected yes as Marc has said. Saying that though I can seemingly unplug and plugin the ground wire while the strip is on with no change in functionality, this is bugging me.

I have also tried running the Arduino from a wall socket rather than the USB port and no change there either.

I thought I had it when I realised the mega has hardware SPI on different pins, so I have switched to CLOCK_PIN 53, DATA_PIN 51 and its still the same :frowning:

The strip is 5m with 300 LEDs, they are 5050 LEDs, the power supply is 5A. I have tried NUM_LEDS as 1 as well, no change.

Everything works perfectly at full brightness down to about 50% brightness, its when it start dimming very low that the flashing/pulsing starts.

If your numleds is 1 and theyā€™re all lighting then thereā€™s an issue there somewhereā€¦

Do a small section of pixels, static and drop the brightness and see if that helps.

Unless I could see a direct (or test) for a direct gnd link from the 12v to the arduino gnd, I would have them linked.

Also, try a short 5 pixel animation and see if the pixels are responding normally (apart from the brightness)

If the small section works fine, at low brightness I would start to think about amperage.

@Kelvin_Mead itā€™s not an addressable LED strip. Itā€™s a ā€œdumbā€ strip, ie the entire strip changes to whatever color is set.

Kelvin, its a dumb strip, and it does not work at low brightness, only full brightness. Its at low brightness that the problem exists!

Ahh, ok. Can you cut a small section off, or test with a higher amped supply?

You can inject power at different points on the strip as long as there is common ground

@Kelvin_Mead I donā€™t have a higher amp supply to hand but Iā€™ll dig through the parts box and see what I can find. I donā€™t understand why amps would be an issue if the strip works correctly at full brightness, I would assume that is using more amps than dimmed?

Yeah, itā€™s just a thing to test. Ive seen strips before act fine on Full / pattern and then fail on low brightness and its been a power issue.

Ive never used the strips you have though :-/

This is 12V power supply you are using, right? Iā€™d suggest giving a different one a try (there are a lot of 12V power supplies, such as from older notebooks ā€“ if you donā€™t have any, go to a thrift store like Goodwill and dig their electronics section).

Another quick way to check the theory of power supply being the culprit is to test your circuit using 12V from your car (or car battery). Just open the hood and connect the terminals to the battery; no need to start the car.

Also, If you have a decent electrolytic capacitor (such as 15V (or more) 1000 uF (or more) ā€“ the more the better, something like 25Volts 4700uF will be great), try connecting it to 12V input (mind the polarity! or it will blow).

My theory is, power supply output is dirty, and its frequency collides with the P9813 frequency so you see this effect. Should be fixed by changing the PWM frequency ā€“ alas no way to do so with P9813, so change the power supply (or add a capacitor).

Hi @Simon_Hill1 ā€‹ā€‹ do you have an oscilloscope or logic analyser you could use to see the output of the rgb module?

@Kirill_Kolyshkin nailed it, its the power supply! I donā€™t have anything to measure the supply but I switched to a PC PSU as a test and its working perfectly. So what is it about my 12v adaptor that isnā€™t good enough so I can find a replacement as the PC PSU isnā€™t a suitable solution long term.

missing/deleted image from Google+

As someone else suggested probably noise on the DC output.

@Stuart_Taylor ā€‹ so do I need a new power supply, or will a capacitor on the +ve wire be enough?

@Simon_Hill1 ā€‹ itā€™s hard to say without being able to measure the noise. Given itā€™s affecting the LEDs when they are dim and not drawing a lot of power, you may need an LC filter. But itā€™s worth trying a few different values close to the power input of the module (accross the terminal). Do you have capacitors to try?