Hi all,
I've done a lot of searching and researching (ha, puns) regarding my problem and hope that the community can help me and point out what I'm doing wrong/stupidly.
I'm using, as the subject says, 6 TLC5940s daisy chained from a stand-alone atmega328p (with arduino bootloader and using the arduino IDE/TLC5940 library). When I run the BasicUse sketch, all seems good, but I find if I turn on more than a few LEDs simultaneously the setup does one of: lock-up, get flakey (twitchy, reset like behaviour) or starts flashing LEDs very rapidly.
Some notes on my setup:
-
Circuit is faithfully based on: http://tlc5940arduino.googlecode.com/svn/wiki/images/breadboard-arduino-tlc5940.png
-
The atmega328p has a 20Mhz crystal on it and additions from the multiple TLC5940 diagram in "Demystifying the TLC5940" - not the pinouts, but the additional components (diodes, resistors, capacitors and the aforementioned crystal).
-
I was afraid that my amp draw might be too much and am currently (ha, another pun) using an ATX power supply (20A max at 5V) rather than the 1200mA @ 5V switching supply I used originally - no change.
-
If I do Tlc.setAll(4095) (or even 1024 for that matter) the LEDs all turn on and flicker rapidly until the whole thing goes dark.
I did a quick and dirty random lighting sketch along these lines:
#include "Tlc5940.h"
void setup()
{
Tlc.init();
randomSeed(analogRead(0));
}
void loop()
{
Tlc.clear();
for (int i=0; i<32; i++)
{
Tlc.set(random(0,95),random(2047,4095));
}
Tlc.update();
delay(500);
}
...the setup will work at first, but generally drifts into unstable land as described above.
Other things I've thought about and need guidance on:
-
Looking at tlc_config.h, I have set the NUM_TLCS to 6 but I'm concerned about TLC_PWM_PERIOD (default 8192) and TLC_GSCLK_PERIOD (default 3) as they seem to be set for a microcontroller clock of 16Mhz. Should I change this? Could this be part of my issue? More often than not, when things get flaky, I see the results coming from the latter TLC5940s in the chain.
-
I'm using and arduino uno to program the atmega328p using this shield: Standalone AVR ISP Programmer Shield Kit - includes blank chip! : ID 462 : $17.50 : Adafruit Industries, Unique & fun DIY electronics and kits ...and setting the board as an arduino uno, should I be setting it to something different (as I'm using a stand alone chip at 20MHz)? For details on the settings, see: http://www.smacula.co.uk/2011/10/adjusting-tlc5940-libraries-to-run.html
-
I read one posting that talked about putting a capacitor across GSCLK/SCLK to cut down on noise, but that strikes me a little odd, no?
-
The length of wire from the board to the LEDs is about 18" right now - but that doesn't seem too long to me, based on reading what other people have done (read: many feet long).
Any thoughts or guidance would be appreciated, I'm building a disco dance floor for my wife's 40th birthday party (this Saturday) and while I could hook up something that regularly resets the boards, I'd rather do things right.
Thanks in advance.