Go Down

Topic: TLC5940 & 16 LED's (Read 2337 times) previous topic - next topic


Feb 09, 2011, 08:02 pm Last Edit: Feb 09, 2011, 10:35 pm by dfigravity Reason: 1
So I am wanting to build a very small, very simple 4x4 RGB LED matrix.  I know that each column should consist of one Red, Green and Blue Cathode (the 4 LED's connected in series) and each row should consist of the one common Anode (the 4 LED's common anodes soldered in series).

Since the TLC5940 is a 16 bit driver, I should be able to use one chip to drive all LED's correct?

O0 - O3       =  Red cathode from columns 1-4
O4 - O7       =  Green cathode from columns 1-4
O8 - O11      =  Blue cathode from columns 1-4
O12 - O15    =  Common Anode's from ROW's 1-4

Am I correct so far?

Also...since I am only driving a total of 16 LED's, do I need to add a transistor/transistors to the circuit?  I read the datasheet on the 5940 and see that the drive capability  (Constant-Current Sink) is either 60mA or 120mA depending on the input voltage and external resistor.  However I am not sure how constant-current sinking works and I don't want to burn anything up.

 Any help would be appreciated...thanks guys!


Sorry you can't use a TLC like this.
See this project for how to do this


Feb 10, 2011, 12:59 am Last Edit: Feb 10, 2011, 02:32 am by dfigravity Reason: 1
Great project...nice schematic too! that's a bummer though...do I really need to use FET's for this?  I have seen other projects using TLC5940 and common anode RGB LED's without using FET's.  

EDIT:  I found this page...

Which states you can use regular NPN transistors...and I happen to have a handful of 2N3904 NPN Transistors lying around...


I have seen other projects using TLC5940 and common anode RGB LED's without using FET's. 

And they multiplex them? Could you provide a link, I would be interested in how they do that. You need some sort of high side current switch to my mind.

EDIT:  I found this page...

Which states you can use regular NPN transistors

Yes but that application note is not about multiplexing is it? It is about running LEDs in seriese from a high voltage supply. As an RGB LED has a common anode you can't connect them together in series.

You can use PNP transistors in place of p-channel FETs but NPN transistors are not really suitable.

Note there is another multiplexing library at http://code.google.com/p/tlc5940arduino/ I have not looked into this but it will almost certainly involve a different sort of circuit than mine.


I am, too, still playing with that library without results. I am trying to get rid of this code
http://arduino.cc/forum/index.php/topic,8551.0.html (discovered from a link of a 7x7x7 rgb cube in exhibition section)
because I think that gosthing is my problem.
Hope you can multiplex your leds!
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com


@Grumpy_Mike  - You're right...the other projects I have seen were not multiplexing the LED's...oops

@Federico  - Good luck with your code...I'll start hammering away at that this weekend...with a little luck we'll both be multiplexing our LED's soon!


I don't know if this can be useful but I am starting to have some result with this setup, also if still I don't get exactly why. I have 3 leds lighted up in orange, green and violet

Code: [Select]

#define NUM_ROWS  18
#define XLAT 14
#define BLANK 15

#include "Tlc5940Mux.h"

volatile uint8_t isShifting;
uint8_t shiftRow;

  if (!isShifting) {
    isShifting = 1;
    // This activates pins to facilitate multiplexed power
    //PORTC = shiftPower[shiftRow];
    PORTC = shiftRow++;
    // -- THE IMPORTANT BIT -- //
    digitalWrite(BLANK, HIGH);
    // 3 x 62.5ns = 187.5ns  (Blank needs to exceed 300ns to avoid shortening the GS cycle)
    digitalWrite(XLAT, HIGH);
    // XLAT for 62.5 ns
    digitalWrite(XLAT, LOW);
    // Another 187.5 ns safely exceeding the minimum 300ns BLANK requirement
    digitalWrite(BLANK, LOW);
    // -- End THE IMPORTANT BIT -- //
    if (++shiftRow == NUM_ROWS){
      shiftRow = 0;
    isShifting = 0;

void setup()
  pinMode(14, OUTPUT);
  pinMode(15, OUTPUT);
  DDRC |= _BV(PC2) | _BV(PC3) | _BV(PC4);

uint8_t color;

void loop()
  TlcMux_set(_BV(PC3), 0 , 4095); //violet
  TlcMux_set(_BV(PC3), 2 , 4095);
  TlcMux_set(_BV(PC4), 1 , 4095); //green
  TlcMux_set(_BV(PC2), 2 , 4095); //orange
  TlcMux_set(_BV(PC2), 1 , 4095);

This is based on the library  linked by mike, with the mod liked by me on the post above.
I have 3 rgb leds cathodes connected to the first 3 pin of the TLC (0, 1, 3). The 3 anodes are connected to pin 16,17,18.

First, if I use the arduino pin 19 (A5), the connected led is not working. (I have not tested all the pins)
Second, I have only 3 rows but if I put "#define NUM_ROWS 3" all the TLC pins are flashing without logic. Found that also #define NUM_ROWS  22 works. Don't know why.
Last if I set  "TlcMux_set(16, 1 , 4095);" instead of " TlcMux_set(_BV(PC2), 1 , 4095);" nothing works. Still don't know why :-)

Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131