Pages: [1]   Go Down
Author Topic: TLC5940 & 16 LED's  (Read 1640 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: February 09, 2011, 04:35:37 pm by dfigravity » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34724
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry you can't use a TLC like this.
See this project for how to do this
http://www.thebox.myzen.co.uk/Hardware/Mini_Monome.html
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
http://www.datasheetarchive.com/datasheet-pdf/080/DASF005195.html

Which states you can use regular NPN transistors...and I happen to have a handful of 2N3904 NPN Transistors lying around...
« Last Edit: February 09, 2011, 08:32:14 pm by dfigravity » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34724
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
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.
Logged

Milano, Italy
Offline Offline
Faraday Member
**
Karma: 11
Posts: 3091
Sideralis Arduino!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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!
Logged

Milano, Italy
Offline Offline
Faraday Member
**
Karma: 11
Posts: 3091
Sideralis Arduino!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#define NUM_ROWS  18
#define XLAT 14
#define BLANK 15

#include "Tlc5940Mux.h"


volatile uint8_t isShifting;
uint8_t shiftRow;

ISR(TIMER1_OVF_vect)
{
  if (!isShifting) {
    isShifting = 1;
    TlcMux_shiftRow(shiftRow);
    // 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)
    __asm__("nop\n\t""nop\n\t""nop\n\t");
    digitalWrite(XLAT, HIGH);
    // XLAT for 62.5 ns
    __asm__("nop\n\t");
    digitalWrite(XLAT, LOW);
    // Another 187.5 ns safely exceeding the minimum 300ns BLANK requirement
    __asm__("nop\n\t""nop\n\t""nop\n\t");
    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);
  TlcMux_init();
}

uint8_t color;

void loop()
{
  TlcMux_clear();
 
  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);
 
  delay(100);
}

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 :-)

Well.......
Logged

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

Pages: [1]   Go Up
Jump to: