Go Down

Topic: 2 TLC5940 problem, possible overload? (Read 3807 times) previous topic - next topic

funkyguy4000

Hello!

I have a very big project that needs to be done soon and i have encountered a massive issue and I need help!
I am using 2 TLC5940's to drive 32 LED's and it is wired up like this except the resistors.
I have a 470 ohm resistor on the IREF instead of the 2.2k pull up like i'm supposed to, those are still on order.
the other resistor i don't have.
http://tlc5940arduino.googlecode.com/svn/wiki/images/breadboard-arduino-tlc5940.png

Next is the link to my video
MUTE YOUR SPEAKERS!! (I didn't know my camera recorded audio, yay!)
http://www.youtube.com/watch?v=xLJF4VMVK9A&feature=youtu.be

That was a more stable run, although sometimes they'll blink a few times on the off right away, then stop. 

So here is my code, I don't think that the code is making it do it, I think it is something to do with how its setup.

Code: [Select]
#include "Tlc5940.h"
#include "tlc_fades.h"

TLC_CHANNEL_TYPE channel;

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

void loop()
{
  int channelOne = random(15);
  int channelTwo = random(15);
  int channelThree = random(15);
  int channel = 0;
  int maxValue = 4095;
  if (channelOne == channelTwo || channelThree)
  {
    channelTwo = random(15);
    channelThree = random(15);
  }
 
  if(channelTwo == channelThree)
  {
    channelThree = random(15);
  } 
 
  if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2) {
    if (!tlc_isFading(channel)) {
      uint32_t startMillisOne = millis();
      uint32_t endMillisOne = millis() + 10000;
      uint32_t startMillisTwo = millis() + 5000;
      uint32_t endMillisTwo = millis() + 15000;
      uint32_t startMillisThree = millis() + 7500;
      uint32_t endMillisThree = millis() + 17500;
      tlc_addFade(channelOne, 0, maxValue, startMillisOne, endMillisOne);
      tlc_addFade(channelOne, maxValue, 0, endMillisOne, startMillisOne);
      tlc_addFade(channelTwo, 0, maxValue, startMillisTwo, endMillisTwo);
      tlc_addFade(channelTwo, maxValue, 0, endMillisTwo, startMillisTwo);
      tlc_addFade(channelThree, 0, maxValue, startMillisThree, endMillisThree);
      tlc_addFade(channelThree, maxValue, 0, endMillisThree, startMillisThree);
    }
  }
  tlc_updateFades();
}
Accelerate to 88 miles per hour.

Brad Burleson

#1
Feb 29, 2012, 04:05 am Last Edit: Feb 29, 2012, 04:08 am by Brad Burleson Reason: 1

I have a 470 ohm resistor on the IREF instead of the 2.2k pull up like i'm supposed to, those are still on order.


I don't think you want to do that really.  According to the page you linked too, you're pushing 80mA's to each channel (39.06/470=0.083) vs (39.06/2200=0.017).

I'd think that's a really bad thing.  

Not sure 100% that's the problem but there is a huge difference between the IREF value you're using and the one you wanted to use.

I hope this helps,

Brad.

EDIT: Perhaps you've got more than a single 470 Ohm resistor?  You can add several in series to get closer to your desired output (see http://www.learnabout-electronics.org/resistors_20.php)

unhappyelf

Also your power supply may not be supplying enough power.

Brad Burleson

Code: [Select]

  if (channelOne == channelTwo || channelThree)


Actually you want something like

Code: [Select]

  if (channelOne == channelTwo) || (channelOne == channelThree)


Should work better as well.

Brad.

Demonic69

Have you tried the examples that come with the library? Do they work? If they do, it's a code issue, if not, it's a setup issue.
You don't need the Blank resistor, it's just handy if you want the LEDs to go off when the Arduino resets. The other is quite important! Normal LEDs will run at 20Ma, so giving them 80 will cause them to blow, eventually.
You don't have any decoupling capacitors, the tutorial should really include those.
Have you tried disconnecting DCPRG from +5v? It causes issues for me.
Are you powering this all directly from the Arduino? That wont work as it can't output enough power and the drain will cause it to lockup and occasionally reset. You'll need a proper 5v supply for the LEDs.
I have the same setup so, if you want, post some pics and I'll compare it against mine.

Cheers

funkyguy4000

Wow thanks for all the replies!
I will try these tonight since i'm in classes right now until 5:30 pm (central). 

Wow i feel stupid that I didn't think about linking them up in series. to get the higher resistance.  I know it isn't good for what i'm pushing through, the chip was getting a little hot.

Also i realized the example code thing to check if it was a code issue while i was taking a shower not 15 minutes ago, haha.

Thank you! i'll be sure to let you know how it all goes.
Accelerate to 88 miles per hour.

funkyguy4000

#6
Mar 01, 2012, 03:19 am Last Edit: Mar 01, 2012, 03:21 am by funkyguy4000 Reason: 1
Okay! so I wired them up with the proper resistors and now it lasts longer, although there is still lotsa flickering, i'm very confused. I'm using the same code as the code at the beginning of this thread.
I took another video

The lights still turn off eventually but it isn't captured in this.  They just turn off, like BLANK was activated or something?

Turn off your speakers if you are under 18 please.
http://www.youtube.com/watch?v=_yfqW1RUGIY&feature=youtu.be

I don't really have much room for capacitors on this build, does anybody have any sort of code solution?
Accelerate to 88 miles per hour.

unhappyelf

I had a very similar problem with my TLC's. Unfortunately I fixed my issues with a 101 cap between the SCLK and GSCLK pins. My thread is here http://arduino.cc/forum/index.php/topic,66126.0.html. There are quite e few youtube videos there describing my problems. They were all fixed with the simple placement of the cap.

Brad Burleson


They were all fixed with the simple placement of the cap.


While I wouldn't rule out this being the problem, the OP never did say how the example code ran (there are several threads with the same code) and there are several issues with the code as shown that could cause problems.

I'd suspect the problem is that the OP isn't calling tlc_updateFades enough... note the last if statement is adding new fades even if the current fades are still in progress (due to the "if" statement not checking the correct variables - 'channel' vs 'channelOne', 'channelTwo', and 'channelThree').


Brad.

unhappyelf



They were all fixed with the simple placement of the cap.


While I wouldn't rule out this being the problem, the OP never did say how the example code ran (there are several threads with the same code) and there are several issues with the code as shown that could cause problems.

I'd suspect the problem is that the OP isn't calling tlc_updateFades enough... note the last if statement is adding new fades even if the current fades are still in progress (due to the "if" statement not checking the correct variables - 'channel' vs 'channelOne', 'channelTwo', and 'channelThree').


Brad.


True my bad......I have never used the Fades library for the TLC5940 so I would have no idea.

funkyguy4000

Well the example code seemed fine although no LEDs ran from the 2nd TLC5940 that was daisychained.
Accelerate to 88 miles per hour.

Brad Burleson


Well the example code seemed fine although no LEDs ran from the 2nd TLC5940 that was daisychained.


You need to modify NUM_TLCS in tlc_config.h in the library folder (read the text at http://tlc5940arduino.googlecode.com/svn/wiki/images/breadboard-arduino-tlc5940.png)

I hope this helps,

Brad.

funkyguy4000

Ok so i changed up the code
Here it is:
Code: [Select]
#include "Tlc5940.h"
#include "tlc_fades.h"

TLC_CHANNEL_TYPE channelOne, channelTwo, channelThree;

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

void loop()
{
  int maxValue = 4095;
  if (channelOne == channelTwo || channelOne == channelThree)
  {
    channelTwo = random(15);
    channelThree = random(15);
  }
 
  if(channelTwo == channelThree)
  {
    channelThree = random(15);
  } 
 
  if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2) {
    if (!tlc_isFading(channelOne) && !tlc_isFading(channelTwo) && !tlc_isFading(channelThree)) {
      uint32_t startMillisOne = millis();
      uint32_t endMillisOne = millis() + 10000;
      uint32_t startMillisTwo = millis() + 5000;
      uint32_t endMillisTwo = millis() + 15000;
      uint32_t startMillisThree = millis() + 7500;
      uint32_t endMillisThree = millis() + 17500;
      tlc_addFade(channelOne, 0, maxValue, startMillisOne, endMillisOne);
      tlc_addFade(channelOne, maxValue, 0, endMillisOne, startMillisOne);
      tlc_addFade(channelTwo, 0, maxValue, startMillisTwo, endMillisTwo);
      tlc_addFade(channelTwo, maxValue, 0, endMillisTwo, startMillisTwo);
      tlc_addFade(channelThree, 0, maxValue, startMillisThree, endMillisThree);
      tlc_addFade(channelThree, maxValue, 0, endMillisThree, startMillisThree);
    }
  }
  tlc_updateFades();
}



Here is the link to the video of it"

http://youtu.be/RT-WPZFul2U

and here is another of it a few minutes later, started doing some funky thing.

http://youtu.be/lCpJkjvY_nI
Accelerate to 88 miles per hour.

Brad Burleson

Code: [Select]

...
  if (channelOne == channelTwo || channelOne == channelThree)
  {
    channelTwo = random(15);
    channelThree = random(15);
  }
 
  if(channelTwo == channelThree)
  {
    channelThree = random(15);
  } 


So are you using one TLC5940 or two?  By setting your channel values to between 0-15 you're only picking LEDs from the first TLC5940.  LEDs on the second TLC5940 will have channel values between 16-31.

Just so you know :-)

I assume you didn't add VBLANK resistors?

You've also got some LONG fades... as written, the code will setup 3 LEDs from the first TLC5940 to fade, then wait until all the fades are done before going on.  It looks like you've got some long delays in there.

What effect are you trying for?  Have you considered just trying one fade at a time and see if you can make that work first?

Something like this:

Code: [Select]
...

void loop()
{
  int maxValue;

  channelOne = random(31);            // pick any one LED from 0 to 31
  maxValue   = 3584 + random(512);    // don't always use the same brightness

  if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2) {
    if (!tlc_isFading(channelOne))  {
      uint32_t startMillisOne = millis();
      uint32_t endMillisOne = millis() + 1000;
      tlc_addFade(channelOne, 0, maxValue, startMillisOne, endMillisOne);
      tlc_addFade(channelOne, maxValue, 0, endMillisOne, startMillisOne);
    }
  }
  tlc_updateFades();
}


This will give you a 1 second fade from a random LED, and with a little variation in brightness (you might want to tweak the values used a bit).  I didn't test this, but it might work :-)

Or maybe better is something like this (I think it's easier to understand):

Code: [Select]
...

void loop()
{
  int maxValue;

  channelTwo = random(31);            // pick any one LED from 0 to 31
  maxValue   = 3584 + random(512);    // don't always use the same brightness

  uint32_t startMillisOne = millis();
  uint32_t endMillisOne = millis() + 1000;

  tlc_addFade(channelOne, 0, maxValue, startMillisOne, endMillisOne);
  tlc_addFade(channelOne, maxValue, 0, endMillisOne, startMillisOne);

  // now run the fade until it completes
  while (tlc_isFading(channelOne))
    tlc_updateFades();
}


Maybe this helps?

Brad.

funkyguy4000

I'll try those out, i'm using two tlc5940s and i went into the config file and changed the NUM_TLCS from 1 to 2, it was at 1 already for some reason and so i changed it to two.  I couldn't find the Tlc5940.o file so yea.  I assumed it wasn't there and yea. 

I'll upload the code and report back in a few
Accelerate to 88 miles per hour.

Go Up