Go Down

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

funkyguy4000

Okay so i tried the 2nd code you submitted and here is the result

http://youtu.be/aEZmlAXeBYA

In response to the wiring, i have it wired up exactly as how it was before.
Accelerate to 88 miles per hour.

funkyguy4000

Accelerate to 88 miles per hour.

Brad Burleson

#17
Mar 02, 2012, 04:55 am Last Edit: Mar 02, 2012, 05:21 am by Brad Burleson Reason: 1

In response to the wiring, i have it wired up exactly as how it was before.


So that means no 10k on VBLANK then?  Sorry, I was just asking.

This is closer to what I had in mind... can you see the differences from the code I posted before?

Code: [Select]
void loop()
{
 int maxValue;

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

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

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

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


A problem in your code that I missed is you have an error with the 2nd tlc_addFade (you need to make sure the fade is set to end after it starts).

I finally added more LEDs to my TLC5940 board so I could see exactly what the code was doing.

Brad.

EDIT: Removed bogus error comment here... note the other code is much more visually interesting once you correct the errors - that 50 millis delay before the fade starts allows the fade buffer fill up a bit and is probably more along the lines of what you want.  I do wonder if you should be checking to make sure you don't have multiple fades on the same channel (since random could return a dupe).

EDIT2: You should use 31 not 15 in the code fragment - I've only got one TLC5940 wired in to my board.

funkyguy4000

I don't understand why my 2nd tlc5940 won't work. 

So the code seems to work fine although i still don't have any communication through the 2nd tlc5940(the daisychained one).  and every once in a while an led will flicker a bit, seems like i would need a .1 micro farad cap although i dont have enough room for that.

Here is the video

http://youtu.be/Us1wQ3DXCvk

I changed the
Code: [Select]
channelOne = random(15);            // pick any one LED from 0 to 31

to
Code: [Select]
channelOne = random(31);            // pick any one LED from 0 to 31

so that it would encompass all the leds avaliable
Accelerate to 88 miles per hour.

Brad Burleson


I don't understand why my 2nd tlc5940 won't work. 


Have you ran the BasicUse example against your hardware?  Either make sure you modify NUM_TLCS (which I think you've done) OR change the example code itself.

This example will do a "night rider" sort of fade along all the LEDs available.

If that doesn't work you need to double-check your wiring.

(the code you're running will have an extra delay with no-LEDs lit every so often - I assume because there isn't actually 512 levels of brightness for LEDs - but your video has too many "holes" where I think it's trying to fade LEDs on the 2nd TLC5940).

Brad.

funkyguy4000

#20
Mar 02, 2012, 06:05 am Last Edit: Mar 02, 2012, 06:13 am by funkyguy4000 Reason: 1
so i double checked the wiring and i had forgotten to wire up the same glsck and all that good stuff from the first tlc to the second. 
After I did that, i did the basic use example and it did the ghost rider but only till the end of the 2nd and then ti would blink in the middle and then at the end of the first and then jump to the end of the 2nd and repeat the wierd blinking sequence.
So I then uploaded the 1st code segment from earlier that you put up and now the led on the board is like dimmed.  I don't know why.  its dimmed for a long time and then every once in a while an led will fade in then out...
Accelerate to 88 miles per hour.

funkyguy4000

I'm headin to bed, I'll be able to talk to you about this tomorrow night. but for a few hours at the most. 

from like 4-6:30 central...

I really really appreciate your help, I mean wow, I didn't think it would be this complex.  I would still like some help finishing it out though.

Talk to you tomorrow brad!
Accelerate to 88 miles per hour.

Demonic69

Try replacing tlc.clear() with tlc.setAll(4000). This will set all the channels to 4000. I, personally, think your Arduino is struggling to supply all of the voltage to the TLCs and LEDs. I'd give them their own 5v supply and stick on some decoupling caps.
Are you just wanting to light one LED at a time, random LED and random brightness? I have a function that does that but doesn't use fades.

funkyguy4000

naw its not the voltage, i know for a fact people have done this like this with a 3.7 LiPo, its just the code is freaking out.
Besides i dont have the board space or the time to mess with caps now, i have 2 .1 micro farad caps and thats it.
Accelerate to 88 miles per hour.

Demonic69

Whereas I know for a fact that the basic use code works perfectly. If you can't get that working then you're never gonna get some custom code working.
A Lipo would also be fine, as you'd be giving the LEDs their own voltage, not pulling the 5v from the Arduino pin.

funkyguy4000

The whole circuit runs on a 3.7v LiPo.  All wired in parallel.  I just don't understand why its freakin out
Accelerate to 88 miles per hour.

Demonic69


The whole circuit runs on a 3.7v LiPo.  All wired in parallel.  I just don't understand why its freakin out

Exactly, in parallel. Yours in running in serial, pulling down the 5v that goes into, then out of the Arduino and into the TLCs and the LEDs. Try putting another 5v, or 3v or whatever they can take, to the LEDs, linking the grounds together

funkyguy4000

could i put the 5v from the arduino to the tlcs and then the 3v3 from the arduino to the leds?
Accelerate to 88 miles per hour.

Brad Burleson


The whole circuit runs on a 3.7v LiPo.  All wired in parallel. 


Well that's what was discussed but as Demonic69 noted if you're wiring up your board to match the diagram in the first post, you're not wired in parallel.

Simply drop the 5v line from the Arduino to the breadboard and then power both boards from the same 5v source (or same LiPo, just don't power only the Arduino and run it's 5v to the TLC5940s).  Start there, and if you still have issues you might want to try another power supply as mentioned (assuming fairly mundane LEDs, a decent 5v source should at least run BasicUse without any problems).

And again keep with the BasicUse example until all the LEDs work.  Then you can move on to playing with the code.

Quote
could i put the 5v from the arduino to the tlcs and then the 3v3 from the arduino to the leds?


No.  Typically the Arduino doesn't provide much 3.3v and you really don't want to power anything extra from your Arduino.

BTW I also missed an error in the use of random().  If you call random(15) you get a value returned between 0-14.  That means one LED won't be lit.  So you need to adjust your values by one (later of course, after everything is working).

This is a picture of my test rig.  Granted it's only a single TLC5940 right now, but I'll connect 2 more tonight and show the results.

I hope I'm not making things worse,

Brad.

funkyguy4000

Okay i'll work that out.

It may be just that there isn't enough voltage.  I'll keep on working things out.

Thank you guys so much for your help,  If i have any further questions, ill post them here
Accelerate to 88 miles per hour.

Go Up