Go Down

Topic: LEDs flickering... Help! (Read 2139 times) previous topic - next topic

yapxls

Dec 28, 2011, 10:17 am Last Edit: Dec 28, 2011, 10:31 am by yapxls Reason: 1
Hi there,

I just got my Arduino Mega 2560, MAX7219 and 8x8 LED dual color matrix. I tried connecting them up (only red colour led i.e. using only one MAX7219) based on the schematic diagram shown in http://arduino.cc/playground/Main/MultiplexMAX72xx

I run a simple program that will switch on the red colour leds (i got it from a website):

Code: [Select]
#include "LedControl.h" //  need the library

LedControl lc=LedControl(12,11,10,1); // lc is our object

// pin 12 is connected to the MAX7219 pin 1
// pin 11 is connected to the CLK pin 13
// pin 10 is connected to LOAD pin 12
// 1 as we are only using 1 MAX7219
void setup()
{
// the zero refers to the MAX7219 number, it is zero for 1 chip
  lc.shutdown(0,false);// turn off power saving, enables display
  lc.setIntensity(0,15);// sets brightness (0~15 possible values)
  lc.clearDisplay(0);// clear screen
}
void loop()
{
  for (int row=0; row<8; row++)
  {
    for (int col=0; col<8; col++)
    { 
      lc.setLed(0,col,row,true); // turns on LED at col, row
      delay(0.01);
      //lc.setLed(0,col,row,false); // turns off LED at col, row
    }
  }
}

The Leds are flickering! Is there any ways to eliminate it or did I make any mistake?

yapxls

Another issue is I tried to set the intensity of the LEDs (to max i.e. 15), but it still looks rather dim to me. Any ways to increase the intensity? I used a resistor of 27K ohms in the circuit.

Grumpy_Mike

First off modify that post so the code is in a box. Select the code and hit the #icon then save.

It looks like you are constantly writing to the LEDs and that is asynchronously to the scan.
To see if this is the case stick a 2 second delay at the end of your loop.

yapxls

I would like to know if a delay of 2 sec is written as "delay(2000)" or "delay(2)". I tends to saw some codes wrote "4" and the arduino's langauge reference shows it is in terms of milliseconds.

Grumpy_Mike


yapxls

I had included the delay at the end of the loop.

Each row lights up at a time at a very fast rate. this performance continues after a short period of time (probably less than 1.5 mins) and all LEDs switch off. 

yapxls

adding on to the previous post, the lights are lik fading off sometimes and it will become bright again... I upload the code second time and the leds do not switch off anymore.

Grumpy_Mike

Quote
this performance continues after a short period of time (probably less than 1.5 mins) and all LEDs switch off. 

So was the chip hot when this happened?

Quote
the lights are lik fading off sometimes and it will become bright again

Are the connections ok, solderless bread board is rubbish you know.

Quote
the leds do not switch off anymore.

What in you code makes you think that the LEDs should switch off?

yapxls

#8
Dec 28, 2011, 12:26 pm Last Edit: Dec 28, 2011, 01:55 pm by yapxls Reason: 1

Quote
this performance continues after a short period of time (probably less than 1.5 mins) and all LEDs switch off.  

So was the chip hot when this happened?

No.

Quote
the lights are lik fading off sometimes and it will become bright again

Are the connections ok, solderless bread board is rubbish you know.

I am using breadboard. I also suspect that there could be some problems with connection.

Quote
the leds do not switch off anymore.

What in you code makes you think that the LEDs should switch off?


For the first time, the lights went off. But for the second time, the lights never went off.

Grumpy_Mike

I am not sure what part of
What in you code makes you think that the LEDs should switch off?
you don't understand so let me spell it out:-

Your code only ever turns on LEDs it never turns them off. If you want them off then write some code to do it.

Quote
For the first time, the lights went off.

And that was due to your code was it or the errors you made in wiring and writing and refreshing too fast.

yapxls

I removed the capacitors and now, my leds are working fine without flickering.

Grumpy_Mike

What capacitors? Normally decoupling capacitors are a good idea and should not be removed.

Go Up