I am in the process of testing 3 TI TLC5940 16 Channel LED Drivers recommended to me in the Project Guidance section for a Kaleidoscope Digital Clock I'm trying to build. I am using the BasicUse sketch from the TLC5940 examples file with the following connections:
+5V from Arduino -> TLC pin 21 and 19 (VCC and DCPRG)
GND from Arduino -> TLC pin 22 and 27 (GND and VPRG)
digital 3 -> TLC pin 18 (GSCLK)
digital 9 -> TLC pin 24 (XLAT)
digital 10 -> TLC pin 23 (BLANK)
digital 11 -> TLC pin 26 (SIN)
digital 13 -> TLC pin 25 (SCLK)
(Optional): put a pull-up resistor (~10k) between +5V and BLANK so that
all the LEDs will turn off when the Arduino is reset.
The sketch compiles and uploads, but absolutely nothing happens when I reset. I have checked the continuity of all the connections, and tested the Common Anode RGB pins across a resistor to ground, and everything checks o.k. I have a 0.1uf capacitor between pin 21 (VCC) and pin 22(GND) and a 2K2 resistor on pin20(IREF). I have set the NUM_TLCS to 1 in the tlc_config.h file. I have included the Tlc5940 and Wiring_Library_SoftPMW_v0005 in the Arduino libraries file. Do I have the correct libraries? I get no joy on any of the TLCs. This is making me crazy. Thanks for any help.
Yes, there are 4 leads per LED. I have 5 LEDs and have the anodes connected to+ 5V and each of the RGB pins to separate TLC channels (0-14) for a total of 15. I have pictures but don't know how to attach them to a post.
Here are images of the BB and Uno, the link to the TLC5940 library and the BasicUse code from the examples file in the TLC library and an image of how I tested each LED cathode lead. Thanks again for your time and effort.
/*
Basic Pin setup:
------------ ---u----
ARDUINO 13|-> SCLK (pin 25) OUT1 |1 28| OUT channel 0
12| OUT2 |2 27|-> GND (VPRG)
11|-> SIN (pin 26) OUT3 |3 26|-> SIN (pin 11)
10|-> BLANK (pin 23) OUT4 |4 25|-> SCLK (pin 13)
9|-> XLAT (pin 24) . |5 24|-> XLAT (pin 9)
8| . |6 23|-> BLANK (pin 10)
7| . |7 22|-> GND
6| . |8 21|-> VCC (+5V)
5| . |9 20|-> 2K Resistor -> GND
4| . |10 19|-> +5V (DCPRG)
3|-> GSCLK (pin 18) . |11 18|-> GSCLK (pin 3)
2| . |12 17|-> SOUT
1| . |13 16|-> XERR
0| OUT14|14 15| OUT channel 15
------------ --------
- Put the longer leg (anode) of the LEDs in the +5V and the shorter leg
(cathode) in OUT(0-15).
- +5V from Arduino -> TLC pin 21 and 19 (VCC and DCPRG)
- GND from Arduino -> TLC pin 22 and 27 (GND and VPRG)
- digital 3 -> TLC pin 18 (GSCLK)
- digital 9 -> TLC pin 24 (XLAT)
- digital 10 -> TLC pin 23 (BLANK)
- digital 11 -> TLC pin 26 (SIN)
- digital 13 -> TLC pin 25 (SCLK)
- The 2K resistor between TLC pin 20 and GND will let ~20mA through each
LED. To be precise, it's I = 39.06 / R (in ohms). This doesn't depend
on the LED driving voltage.
- (Optional): put a pull-up resistor (~10k) between +5V and BLANK so that
all the LEDs will turn off when the Arduino is reset.
If you are daisy-chaining more than one TLC, connect the SOUT of the first
TLC to the SIN of the next. All the other pins should just be connected
together:
BLANK on Arduino -> BLANK of TLC1 -> BLANK of TLC2 -> ...
XLAT on Arduino -> XLAT of TLC1 -> XLAT of TLC2 -> ...
The one exception is that each TLC needs it's own resistor between pin 20
and GND.
This library uses the PWM output ability of digital pins 3, 9, 10, and 11.
Do not use analogWrite(...) on these pins.
This sketch does the Knight Rider strobe across a line of LEDs.
Alex Leone <acleone ~AT~ gmail.com>, 2009-02-03 */
#include "Tlc5940.h"
void setup()
{
/* Call Tlc.init() to setup the tlc.
You can optionally pass an initial PWM value (0 - 4095) for all channels.*/
Tlc.init();
}
/* This loop will create a Knight Rider-like effect if you have LEDs plugged
into all the TLC outputs. NUM_TLCS is defined in "tlc_config.h" in the
library folder. After editing tlc_config.h for your setup, delete the
Tlc5940.o file to save the changes. */
void loop()
{
int direction = 1;
for (int channel = 0; channel < NUM_TLCS * 16; channel += direction) {
/* Tlc.clear() sets all the grayscale values to zero, but does not send
them to the TLCs. To actually send the data, call Tlc.update() */
Tlc.clear();
/* Tlc.set(channel (0-15), value (0-4095)) sets the grayscale value for
one channel (15 is OUT15 on the first TLC, if multiple TLCs are daisy-
chained, then channel = 16 would be OUT0 of the second TLC, etc.).
value goes from off (0) to always on (4095).
Like Tlc.clear(), this function only sets up the data, Tlc.update()
will send the data. */
if (channel == 0) {
direction = 1;
} else {
Tlc.set(channel - 1, 1000);
}
Tlc.set(channel, 4095);
if (channel != NUM_TLCS * 16 - 1) {
Tlc.set(channel + 1, 1000);
} else {
direction = -1;
}
/* Tlc.update() sends the data to the TLCs. This is when the LEDs will
actually change. */
Tlc.update();
delay(75);
}
}
No, the +5v jumper was pulled inadvertently before I took the picture. I plugged it back in, but it is still not working. I am coming off of the Uno and jumping the +5v and GND to the top power buss, and then jumping from that buss (+5v ) to the bottom buss and GND off the GND pin next to pin 13 on the Uno. Is this a problem?
My advice to you is take the circuit completely apart and start over. Also , next time order a spare chip. I don't know what else to tell you. If I were there I could tell you if the chip was bad (I have one here running that sketch) (I ordered 5 chips because I already
fried one by mis-wiring it. If you're sketch compiles I think that means the library is installed. How many times have you checked the wiring ?
Thanks for coming back. I've have just checked the wiring again. Every wire is where it should be, and the continuity is there. I have tried 3 different TLC5940s and two Unos, still with no joy.I'm really stymied. I might try a different tack, the Mega2560 with the appropriate resistors and transistors on the RGBs. Thanks again for your patience and help.
I'm still not seeing the connection from Arduino GND & +5v to the power bus. Can you take a better photo so I can see all of the arduino to breadboard wires ? My TLC5940 worked the first time. It wasn't until I took the circuit apart and then rewired again later that I miswired it and fried one.
Here are new images. I'm going to take your advice and tear everything down tomorrow and re-wire it with different jumper wires. I'll post how it goes. Thanks again.
you know what ? I think I know what the problem is ? Did you actually put a meter on pin 21 to verify +5V ?
You might have one of those breadboards that don't have continuity all the way across the bus. You have to put little jumpers in the spaces between the gourps on the bus. I would get a meter an take measurements in different places, starting with pin-21.
Put a meter ground where the arduino ground connects to the bus and move the positive meter lead to various points to measure the voltage. It's a long shot but it's worth checking. If you've tried more than one chip then there is something wrong with your setup because it can't be software. When you wired it up did you use a checklist to check off each connection ? Do you have any other leds (ordinary red ) that you can substitute before you tear down the circuit just to rule out the RGB leds ?
Well, it wasn't the board, it was about how I had misused the board. I had checked and quadruple checked the board wiring and overlooked my mistake each time. I had the 2K2 resistor on pin 19 going to +5V. It should have gone to GND, thus, I think I fried all three TLC5940s. I really appreciate all your time and effort. I'm sure I will need guidance when I get into the coding. Thanks again.
My mistake. I should have said that I had pin 20 (IREF) going to +5V instead of GND as it should. Wouldn't the reverse polarity damage the op amp. Pin 19 is to +5V correctly. The board checked out correctly with 4.98V to all the proper points.