Go Down

Topic: TLC5940 rgb multiplex problem (Read 3982 times) previous topic - next topic

Federico

Hi, I am experimentig multiplexing RGB leds with a TLC5940 but I have a strange problem. I have successfully already done this with a 74hc595 but I am not able to have a result with the TLC.

Basically I have 3 common anode rgb leds. I have connected the RGB pins to pin 0,1,2 of the TLC5940 and the 3 anodes of the led to analog 5,6,7

This is my test code

Code: [Select]

#include "Tlc5940.h"

void setup() {
  Tlc.init();
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
}

void loop()
{
  for (int i = 5; i <=  7; i++) {
    /* 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.). */
   if (i==5) {
     Tlc.set(0, 0); //blue
     Tlc.set(1, 0);  //green
     Tlc.set(2, 4095); //red
   }
   else if (i==6) {
     Tlc.set(0, 0);
     Tlc.set(1, 4095);
     Tlc.set(2, 0);
   }
   else if (i==7){
     Tlc.set(0, 4095);
     Tlc.set(1, 0);
     Tlc.set(2, 0);
   }
   
  Tlc.update();
  digitalWrite(i, HIGH);
  delay(3);
  digitalWrite(i, LOW);
  }

}


I have successuflly the 3 leds lighted at te same time for my eyes without flickering BUT the colors are wrong! I have tried also with just one led and still I get wrong color. I have discovered that if I use just one led switching off the others I have the expected color

Code: [Select]

if (i==5) {
     Tlc.set(0, 0); //blue
     Tlc.set(1, 0);  //green
     Tlc.set(2, 4095); //red
   }
   else if (i==6) {
     Tlc.set(0, 0);
     Tlc.set(1, 0);
     Tlc.set(2, 0);
   }
   else if (i==7){
     Tlc.set(0, 0);
     Tlc.set(1, 0);
     Tlc.set(2, 0);
   }


With this I have a red one and two off. Also if I connect just one RGB led, with the first pasted code, I get it "purple".

I really don't understand.
Please help  =(
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

Grumpy_Mike

Quote
I have 3 common anode rgb leds. I have connected the RGB pins to pin 0,1,2 of the TLC5940 and the 3 anodes of the led to analog 5,6,7

That is not the way to connect them. Can you post a schematic?

A RGB LED has 4 wires, one anode and three cathodes. If you are using the TLC5940 you need to connect the anode to positive and the cathodes to the TLC5940 outputs.
You can't multiplex them like this as you have no synchronization between the TLC PWM and the multiplexing, you are getting beating.
This project shows how I multiplexed using this chip.
http://www.thebox.myzen.co.uk/Hardware/Mini_Monome.html

Federico

Before posting I did a bit of research in the forum and I already read the MiniMonome page (you linked it somewere in the past forum). It was useful!

So I thought that my connection was ok, the three cathodes of each led are connected to the TLC5940 outputs. As I am trying a single column and three rows I have connected all my cathodes together (divised by colour: all the blue cathodes are connected to TLC output pin 0, all the green ones to output pin 1 and the red to 2) and the 3 positive are connected to arduino digital pins.

I am checking again your schematic but the only thing I miss is the mosfet on the positive line that I am not using because, for now, I am driving only a led at once...

I am going to post a picture of my actual connection. Or could it be a software related problem...
(Or the problem it's me :-) )
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

Grumpy_Mike

Quote
could it be a software related problem.

Possibly,

You have put:-
#include "Tlc5940.h"
This is not what I have in my monome project, I used a special multiplexing version of the library which I hacked myself. You need to use this if you are using the same techniques as me.

Federico

Uhm. I am going to rewrite the code tonight, taking a look to your code.
I see that you use a library that you called Tlc5040Mux...
It's the same tlc5940Mux Library that I found http://code.google.com/p/tlc5940arduino/ here?
Thanks again, I am going to re-check everything :-)
Federico - Sideralis
Arduino &C: http://www.sideralis.org
Foto: http://blackman.amicofigo.com

Grumpy_Mike

Quote
It's the same tlc5940Mux Library that I found....

No that one is the "official" one, I don't know what it contains.
It could be that it requires a different circuit, I know the later versions of the normal library changed the pinout from the early ones.
I hacked mine from an early "official" version.

Go Up