I'm Nicolas and a beginner in electronic.
I'm looking for arduino examples with scheme and wiring diagram as clear as possible to run a TLC and some RGB leds on it.
On playground i find a example but understand nothing.
I installed a library from here : Google Code Archive - Long-term storage for Google Code Project Hosting.
after that I don't know where to find a good and EXTREMLY well explained tutorial to wiring with arduino MEGA.
If anyone can help me, I appreciate to much. I've spend some money to control some RGB led.
Can you propose a simple tutorial for change color of xx RGB leds with TLC chips (one or several)
On playground i find a example but understand nothing.
OK so ask questions about what you don't understand.
Have you got the data sheet for that chip? You need it.
Yes it might be difficult to understand to start with but if you ask about what you don't understand then you can start to learn.
I want to erase all informations of this page from my mind and find someone who can help me with basic example for use TLC to turn on and off several LED (simple blue LED for example).
I want to erase all informations of this page from my mind and find someone who can help me with basic example for use TLC to turn on and off several LED
No you don't.
The TLC5940 is a medium complex chip. That page looks like a good start.
Basically it gives you 16 PWM outputs, just like the PWM outputs on the arduino. However, better than the arduino it has a constant current output, that means you don't have to have resistors in the LEDs.
To get the data into this chip you need to shift it in one bit at a time. If you don't know that concept then look the shift out tutorial. Unlike the arduino which has only 8 bits to control the PWM this chip has 12 bits that control each one. This means to fully load the chip with data you need to feed it with 16 * 12 = 192 bits of information. Once fed in this will then control the brightness of the LEDs by PWM. Do you understand PWM? If not look here http://www.thebox.myzen.co.uk/Tutorial/PWM.html. The PWM signal is produced by a clock signal, the arduino has to supply this clock signal. So it needs feeding with two things, the PWM clock and the data.
Solder one up and get the examples working.
They can be found in the library -> TLC5940 -> Examples
the code :
////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Warning //////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////// You need external power for your Arduino board - USB is not enough!!/////////////
///////////// TLC5940 + 16 LEDs draw over 300 mA at full brightness! ///////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////// #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();
}
void knightrider()
/ 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. /
{
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 daisychained,
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(50);
}
}
void breathe(int qq) // qq is number of times to breathe
// displays all LEDs and alters the brightness
{
Tlc.clear();
for (int q=0; q<qq; q++)
File: Unsaved Document 1 Page 2 of 2
{
for (int p=0; p<4096; p+=10) // increase brightness
{
for (int l=0; l<16; l++)
{
Tlc.set(l, p);
}
Tlc.update();
delay(5);
}
for (int p=4095; p>=0; p-=10) // decrease brightness
{
for (int l=0; l<16; l++)
{
Tlc.set(l, p);
}
Tlc.update();
delay(5);
}
}
}
void randomled(int m)
// displays random LEDs for m times
{
randomSeed(analogRead(0));
for (int qq=0; qq<m; qq++)
{
Tlc.clear();
Tlc.set(random(16), 4095);
Tlc.update();
delay(200);
}
}
void loop()
{
randomled(100);
delay(1000);
breathe(3);
delay(1000);
knightrider();
}
////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Warning //////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////// You need external power for your Arduino board - USB is not enough!!/////////////
///////////// TLC5940 + 16 LEDs draw over 300 mA at full brightness! ///////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
=> But i can't compile, so i can't transfert it in ARDUINO. (just for transfert)
Because this wiring require 5V external supply do to the current who can't provide by ARDUINO BOARD.
I need help to run my 15 LEDs with this TLC.
Thanks for helping
=> But i can't compile, so i can't transfert it in ARDUINO. (just for transfert)
You get error messages so what were they.
Please post the code correctly so people can try it for themselves. Look at what the forum does to code, that is not what you posted. Read the how to use this forum sticky post and modify that last post with the real code you have.
You do not need an external supply for testing just make the maximum current drawn 10mA by doubling the size of that one current setting resistor.
In my application, I have two blocks of LED strips that I would like to have do the same things at the same time... I'll be using a total of 4 TLC5940's, two per block.
All the application stuff I've seen say to wire the chips with the Arduino feeding TLC1's Sin pin (26), and then daisy chain from the Sout pin (17) of each chip to the Sin pin of the next.
Since I want the two blocks to behave the same, is there any reason I can't go from the Arduino to Sin of the first chip in each block, so that they are essentially in parallel rather than in series?
Seems like that would make the code I'll need much simpler as I'd only be dealing with half the channels...
Since I want the two blocks to behave the same, is there any reason I can't go from the Arduino to Sin of the first chip in each block, so that they are essentially in parallel rather than in series?
Yes I think that should work.
Don't forget your decoupling capacitors on each chip.
Anyone can post one basic example or your circuit diagramm, just want to understand how it works, i go to many site buyt don't understand properly.
Thanks