Go Down

Topic: Flickering leds problem (Read 4279 times) previous topic - next topic


Feb 03, 2011, 05:46 pm Last Edit: Feb 03, 2011, 05:48 pm by orbitrek Reason: 1

I made a Philips Ambilight clone using BobLight (google it if interested) and Arduino Mega.
The system is now up and works nicely. I have only one problem:
The leds are flickering a bit. They are controlled with ULN2003 ic and the ics are feeded with arduinos pwms.
I know that the analog write values that I write in the loop are stable but for some reason leds are flickering noticably.

My questions are:
Do you have an idea  what is causing this?
Is there an easy solution to somehow even out / filter the current to the leds with some electronic component (capacitor, resistor, etc..)?

Thanks in advance


There are many reasons that might cause flickering. However without a schematic drawing and posting your code it's nearly impossible to try and guess at what might be the cause(s).



Feb 06, 2011, 10:20 pm Last Edit: Feb 06, 2011, 10:24 pm by orbitrek Reason: 1
Thanks for the reply.
My schematic is dead simple. It is nicely described in the picture in this thread (see a post by "Makkan").

This is the code: (which is also quite simple)
Code: [Select]
// Declare variables for pin numbering
int r1Pin = 9;
int r2Pin = 2;
int r3Pin = 5;

int g1Pin = 10;
int g2Pin = 3;
int g3Pin = 6;

int b1Pin = 11;
int b2Pin = 4;
int b3Pin = 7;

// Declare variables for serial data read
// R1R2R3G1G2G3B1B2B3
int RR1 = 50;
int RR2 = 50;
int RR3 = 50;
int GG1 = 50;
int GG2 = 50;
int GG3 = 50;
int BB1 = 50;
int BB2 = 50;
int BB3 = 50;

void setup()
 // Set pins for data output
 pinMode(r1Pin, OUTPUT);  
 pinMode(r2Pin, OUTPUT);
 pinMode(r3Pin, OUTPUT);  

 pinMode(g1Pin, OUTPUT);  
 pinMode(g2Pin, OUTPUT);
 pinMode(g3Pin, OUTPUT);

 pinMode(b1Pin, OUTPUT);  
 pinMode(b2Pin, OUTPUT);
 pinMode(b3Pin, OUTPUT);

 // open serial port

void loop()
   // read data from serial (MoMoLight-"protocol")
     if (Serial.available() > 8) {
RR1 = Serial.read();
RR2 = Serial.read();    
RR3 = Serial.read();
GG1 = Serial.read();
GG2 = Serial.read();
GG3 = Serial.read();
BB1 = Serial.read();
BB2 = Serial.read();
BB3 = Serial.read();
   // Write values to PWM ports (values = 0...255)
   analogWrite(r1Pin, RR1);
   analogWrite(r2Pin, RR2);
   analogWrite(r3Pin, RR3);
   analogWrite(g1Pin, GG1);
   analogWrite(g2Pin, GG2);
   analogWrite(g3Pin, GG3);
   analogWrite(b1Pin, BB1);
   analogWrite(b2Pin, BB2);
   analogWrite(b3Pin, BB3);

If you have any ideas, I'd be glad to hear them. Thank you.

EDIT: And I noticed it is more clearly visible with some specific shades.

James C4S

The thread you reference doesn't so a schematic with ULN2003s in it.  You'll need to provide an actual schematic of your circuit.

Probably not related to the flickering you are seeing, but there is no need for the "while(true)" loop.  loop() already does this for you.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


Is it this one?

If so the first thing to note is that you are over driving that chip. You can't have 1.2A being switched on at the same time due to the thermal dissipation limit of the chip. See :- http://www.thebox.myzen.co.uk/Tutorial/Power_Examples.html

Next flickering covers a wide variety of behavior, can you be more specific?

To eliminate a software problem, write a sketch that doesn't read anything from the input and just changes the intensity of each lamp on an algorithm of some sort. Like incrementing one light every 100mS, it's OK to use delay for testing.


Yep, That's the one. Thanks for the heat dissapation link.
The led strip is driving 180 mAmps per channel at max and it is rarely reached. There's max 5 channels per chip. So 0,9 amps is the max.

How would I explain the flickering. It is some (high frequency) changes in the intensity of the light. So that light is not stable and calm and steady. It is actually doing it really little, but enough to catch the eye.

I need to do some testing without serial reading.


Feb 10, 2011, 07:05 pm Last Edit: Feb 10, 2011, 07:08 pm by Grumpy_Mike Reason: 1
There's max 5 channels per chip. So 0,9 amps is the max.

So too much then.

It is some (high frequency) changes in the intensity of the light

It is the high frequency that is the important factor. When you switch a lot of current you can get instability in a circuit, try a bit of decoupling:- http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

I need to do some testing without serial reading.

Yes you need to see if you are telling the software to make it flicker first.

Go Up