Problem with multiple tlc5940

Ok, I bought some 47uF´s... Put them between 5v and gnd, but I guess I´ve put them wrong(picture below), because that didn´t change anything.

Uploaded with ImageShack.us

Help please

They are in the right place but you seem to have taken off the 0.1uF ceramic caps you had on earlier, why?
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Dcoupling might not fix a wiring problem, but it still is needed. The layout is a bit messy but then I never did like solderless bread boards anyway.

Try as a temporary measure reducing the TLCs drive current to see if you have a power supply issue.

I added the 0.1uFs, and still no change. Hmm...

How do I reduce the drive current on the tlc?

Im not sure by your picture, but I think you may have the 47 cap on it wrong. I think you want positive lead on the chip, and the negative lead on the ground of of chip, or the ground rail.

by reducing the load, I think what he means is change the resistor that sets the current level for the LEDs. I think its 2k in the demo for 20ma, If you change that to 4k, it I think that will set if for about 10ma.

Bigger Bigger Smaller Smaller Reset Reset Reply with quoteQuote
Im not sure by your picture, but I think you may have the 47 cap on it wrong. I think you want positive lead on the chip, and the negative lead on the ground of of chip, or the ground rail.

No you have the cap on pin 22 which is where it should be.

think its 2k in the demo for 20ma, If you change that to 4k, it I think that will set if for about 10ma.

Yes that is right.

I cant seem to find a 4k resistor anywhere... Does it have to be 4Kohm?

It is the resistor on pin 20 of the chip.
What value do you have?
Double it.

ok... put two 2k in series then = 4k. Still no change though. Other suggestions?

In case I can´t fix this issue with the TLC5940's, is there another way to get 30 LEDs to breathe smoothly in different duration/speed?

quizz_kid:
In case I can´t fix this issue with the TLC5940's, is there another way to get 30 LEDs to breathe smoothly in different duration/speed?

Nearest that i can tell, about a million ways. seriously there are a lot of ways to control leds.

So time for some fault finding.
Use the code that just lights up one device, I think you said that still worked, chech it still does.
Then switch over the input to the other chip by changing the input wire only. If that now works it is your software that is wrong. If not then it is wired wrong.

Hippynerd:
Nearest that i can tell, about a million ways. seriously there are a lot of ways to control leds.

I understand that, but I´d need a simple and cheap solution... Any specific ideas?

Grumpy, by device you mean chip or LED? And which code are you talking about, something in the library? And whitch one is the input wire?

Once again you have to excuse my lack of knowledge in this field.

Ok, I checked both chips separately. They have the same issues, same as before, which is this:

When I use my fading code for 11 LEDs, everything works fine

When I change the code to a 12-13 LED setup, the first 11 starts simultaneously, while the 12 and 13 starts with a 1 sec delay.

As I then add more LEDs to the code, some LEDs starts to flicker, individually, and it seems sort of randomly.

As I then add more LEDs to the code,

Post what gives you trouble.

quizz_kid:

Hippynerd:
Nearest that i can tell, about a million ways. seriously there are a lot of ways to control leds.

I understand that, but I´d need a simple and cheap solution... Any specific ideas?

Grumpy, by device you mean chip or LED? And which code are you talking about, something in the library? And whitch one is the input wire?

Once again you have to excuse my lack of knowledge in this field.

At this point, fixing what you have is probably the quickest easiest solution.

If you had kept it simple just using multiplexing or charlieplexing, you would have something working by now, but that may not be as nice as you would have liked. I just checked, and you have been at this since the end of november!

Grumpy, here is when they start to flicker some, with 14 LEDs:

#include "Tlc5940.h"
#include "tlc_fades.h"

TLC_CHANNEL_TYPE channel;

void setup()
{
  Tlc.init();
}

void loop()
{
  if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2) {
    
     if (!tlc_isFading(0)){
      uint16_t duration = 4000 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(0, 28, maxValue, startMillis, endMillis );
      tlc_addFade(0, maxValue, 28, endMillis, endMillis + duration);}
     
     if (!tlc_isFading(1)){
      uint16_t duration = 4200 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(1, 28, maxValue, startMillis, endMillis );
      tlc_addFade(1, maxValue, 28, endMillis, endMillis + duration);}
     
     if (!tlc_isFading(2)){
      uint16_t duration = 4400 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(2, 28, maxValue, startMillis, endMillis );
      tlc_addFade(2, maxValue, 28, endMillis, endMillis + duration);}
      
     if (!tlc_isFading(3)){
      uint16_t duration = 4600 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(3, 28, maxValue, startMillis, endMillis );
      tlc_addFade(3, maxValue, 28, endMillis, endMillis + duration);}
      
     if (!tlc_isFading(4)){
      uint16_t duration = 4800 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(4, 28, maxValue, startMillis, endMillis );
      tlc_addFade(4, maxValue, 28, endMillis, endMillis + duration);}
   
     if (!tlc_isFading(5)){
      uint16_t duration = 5000 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(5, 28, maxValue, startMillis, endMillis );
      tlc_addFade(5, maxValue, 28, endMillis, endMillis + duration);}
      
     if (!tlc_isFading(6)){
      uint16_t duration = 3000 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(6, 28, maxValue, startMillis, endMillis );
      tlc_addFade(6, maxValue, 28, endMillis, endMillis + duration);}
      
     if (!tlc_isFading(7)){
      uint16_t duration = 3200 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(7, 28, maxValue, startMillis, endMillis );
      tlc_addFade(7, maxValue, 28, endMillis, endMillis + duration);}
      
     if (!tlc_isFading(8)){
      uint16_t duration = 3400 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(8, 28, maxValue, startMillis, endMillis );
      tlc_addFade(8, maxValue, 28, endMillis, endMillis + duration);}
    
     if (!tlc_isFading(9)){
      uint16_t duration = 3600 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(9, 28, maxValue, startMillis, endMillis );
      tlc_addFade(9, maxValue, 28, endMillis, endMillis + duration);}
    
     if (!tlc_isFading(10)){
      uint16_t duration = 3800 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(10, 28, maxValue, startMillis, endMillis );
      tlc_addFade(10, maxValue, 28, endMillis, endMillis + duration);}
      
     if (!tlc_isFading(11)){
      uint16_t duration = 5200 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(11, 28, maxValue, startMillis, endMillis );
      tlc_addFade(11, maxValue, 28, endMillis, endMillis + duration);}
      
       if (!tlc_isFading(12)){
      uint16_t duration = 3350 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(12, 28, maxValue, startMillis, endMillis );
      tlc_addFade(12, maxValue, 28, endMillis, endMillis + duration);}
      
       if (!tlc_isFading(13)){
      uint16_t duration = 3750 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(13, 28, maxValue, startMillis, endMillis );
      tlc_addFade(13, maxValue, 28, endMillis, endMillis + duration);}
      
        
    
    
    if (channel++ == NUM_TLCS * 16) {
      channel = 0;
    }
  }
  tlc_updateFades();
}

Hippynerd:

Yeah, but quick and easy doesn´t seem to be the right words in this situation =(

Assuming that things will do what you want once you over come this one hurdle, it seems like a huge waste of time to not see it through, and it looks like you are close to getting it going.

I dont really know enough about what and how and where this is being used to give any specific advice, but in general when things are complicated and beyond control, you need to simplify things until you get things in order.

You could control 30 LEDs with multiplexing or charliplexing, but it will come at some cost, usually speed and brightness, which may or may not be a problem. It will also mean more complex wiring, but less complex circuitry.

If you have a second set of LEDs, you could experiment with multiplexing while you are working this out.

I understand that you must be frustrated, I have a cube that is very similar, and its been put on the back burner because its been difficult. I will return to it again, after I finish some documentation.

Yes, it´s all very frustrating indeed. It´s nice to hear I´m getting closer though, because I can´t really see any improvements here, exept the exclusions so far.

The idea is to have 30 LEDs "breathing"(fading) smoothly in different durations. Kind of like the organic diode pulse effect you´ll get when you turn on you Macbook. I´m going to use it for some different projects later, that´s IF I can get to work of course.

But I´m up for trying other alternatives, and I´ve got another set of LEDs for experimenting. Never done any multiplexing though, so I´d need some help there I guess.

Thanks for helping me out here, also good luck with your own frustrating project.

Thanks for posting the code.
Can you post a link to the tlc_fades.h libary you used because I can find lots of them on line and I don't know which one you used.

The code is very wrong in many places. The problem is that a lot of the things that are wrong with it are obscuring seeing what the problem in what you see is.
When you declare a variable, that is put a variable type followed by the variable name the computer creates a variable of that name. So you have this line

int maxValue = 400;

many times in the loop. Each one creates a new instance of the variable with the same name and it would seem the same value.
You do this with many variables thought the code.
You do the same with

uint32_t startMillis = millis();

but what is worst you want this variable to persist through many loops.

So just one section of the code:-

if (!tlc_isFading(13)){
      uint16_t duration = 3750 - (analogRead(0) * 2);
      int maxValue = 400;
      uint32_t startMillis = millis();
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(13, 28, maxValue, startMillis, endMillis );
      tlc_addFade(13, maxValue, 28, endMillis, endMillis + duration);}

could be rewritten:-

if (!tlc_isFading(13)){
      duration = 3750 - (analogValue * 2);
      tlc_addFade(13, 28, maxValue, millis(), millis()+ duration );
      tlc_addFade(13, 400, 28, endMillis, endMillis + duration);}

with

analogValue = analogRead(0);

done at the start of the loop and analogValue defined outside of any function to make it a global variable.

While that might not solve your problem you need to clean up the code at least so far before you can have a chance of writing it correctly.
So make those changes, see what you get and post the resulting code and say what it does.

Heres an arduino tutorial that pretty well explains multiplexing, charlieplexing is the same thing, only it adds complexity, so learn multiplexing first, then charlieplexing if you want to know more.

The above example uses an 8x8 matrix, but since you are using sinle LEDs you can make the matrix whatever size you like, 5x6 will do 30 LEDs and require only 11 microcontroller pins and you will also want 5 or 6 resistors.

The other thing you will need to understand is called PWM, Pulse Width Modulation. its how you make the LEDs "breath" (Im assuming you mean increase and decrease in brightness). The arduino has several PWM pins that you can use, or software PWM to do this, the TLC chip, has this built in, so its nice for your uses.

Heres a tutorial on PWM and fading: