Pages: 1 [2] 3   Go Down
Author Topic: Tlc5940 multiplexing code  (Read 3788 times)
0 Members and 1 Guest are viewing this topic.
Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31384
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No, that is the pin you put an extra high voltage on if you want to programme the grey scale correction rom.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, that is the pin you put an extra high voltage on if you want to programme the grey scale correction rom.

It turns out I had read 4K7 as "47k". I replaced all the FET resistors with 4.7k and now the brightness is good.

When I power it up or run any of the Processing examples individual rows are different colors, but not individual LED's. To reduce complexity I removed the other two 5940's and reduced the matrix to 4x4, figuring I'll scale it once I get the basics working. Any ideas?

Overall board: http://i.imgur.com/YwVGY.jpg
Closeup of FETs: http://i.imgur.com/cnJ6Q.jpg
Closeup of 5940: http://i.imgur.com/H6hmn.jpg
5940/Arduino: http://i.imgur.com/2XZMT.jpg

Video of the issue: http://dl.dropbox.com/u/6253968/rows.mov
Logged

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

You need to post a schematic not a photo of a jumble of wires.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to post a schematic not a photo of a jumble of wires.

Sorry, I'm trying to follow your schematic exactly, but was only able to get whole rows to light up. I'm really new to reading schematics and think I might have messed something up which is why I posted the pics. I've been tying to get it going all day, but I must be missing something.

Is there anything else I can do to make troubleshooting any easier?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've created a Fritzing file which mirrors my breadboard setup at the moment. I've left out the RGB cathode wires for better readability. I hope this helps. I really appreciate all of your help getting me this far!

http://fritzing.org/projects/4x4-arduino-rgb-led-multiplex/
Logged

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

I haven't got fritzing and due to my limited internet connection at the weekends it will have to be tomorrow before I can look at it.
However in the mean time you can do some tests.
First off do you get the default rows with no other input?
Next change the numbers that initialises the ledBuffer, are these change reflected in what you see on the LEDs?
Now change the wiring so that only one cathode is connected into the TLC5940, that is only have one LED per column on one of the rows. Can you change those numbers in that one row and see the effect?

I looks like you have not wired up something correctly, what type of FET have you used, it should be logic level P-type, and check that you have identified the drain and source correctly.

It could be that all the rows are being powered at the same time if the above is not right.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First off do you get the default rows with no other input?
Next change the numbers that initialises the ledBuffer, are these change reflected in what you see on the LEDs?
Yes and yes. When I first turn it on I get a row of red, blue, green and a kind of light pink. When I change the values in the sketch and re-upload the changes are reflected on their respective rows.

Now change the wiring so that only one cathode is connected into the TLC5940, that is only have one LED per column on one of the rows. Can you change those numbers in that one row and see the effect?
I'm not sure if I totally follow this one. I removed three of the LEDs from the first column and the color of the remaining LED changes just as the whole row did prior to removing the other LEDs.

I looks like you have not wired up something correctly, what type of FET have you used, it should be logic level P-type, and check that you have identified the drain and source correctly.
I'm using a p-channel FET from sparkfun. Datasheet: http://www.sparkfun.com/datasheets/Components/General/FQP27P06.pdf
I think I've got it hooked up according to your schematic but it's entirely possible I misunderstood something.

I've hooked up like so:
  • 1 wire going from D to a row of the LEDs' common anode.
  • A 4.7k resistor going from S to G
  • 1 wire going  from S to 5v (after the resistor)
  • 1 wire going from G to Pin XX on Arduino (after the resistor)

Here's a screen shot from Fritzing:
Logged

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

Those FETs require 10V to switch on the gates. Don't be fooled by the gate threshold voltage that is just where it starts to cinduct. I am not sure if that would cause your reported problem because it seems they are on all the time rather than not on.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Those FETs require 10V to switch on the gates. Don't be fooled by the gate threshold voltage that is just where it starts to cinduct. I am not sure if that would cause your reported problem because it seems they are on all the time rather than not on.

I'm glad you mentioned that as the data sheet did confuse me quite a bit. The gate threshold voltage shows a min-max of -2.0 to -4V and the following was in the comments on the product page:



The product description also says:
The FQP27P06 is a very common MOSFET with very low on-resistance and a control voltage (aka gate voltage) that is compatible with most 5V microcontroller or mechanical switches. This allows you to control high-power devices with very low-power control mechanisms.

But again, I'm so ignorant with this stuff. Earlier you indicated that this looks like it would work, but was just over spec. But is it now looking like it won't work at all without 10v and the product page just has some mis-information?
Logged

Palermo
Offline Offline
God Member
*****
Karma: 2
Posts: 745
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had a very hard experience with 5940mux library, for this reason I tried to
improve the basic TLC5940 library.

My goal is drive a lot of rgb led using tlc5940 and plex all with UDN2981.

Initially, using the basic tlc5940 library, trying a multiplex, the problems were the interferences between leds.

I solved perfectly the problem using

Code:
while (tlc_needXLAT);

after the call of

Code:
Tlc.update();

This permit to wait the completing of PWM cicle, in this way I solved the problem!

This is the engine of my multiplex code:

Code:
void ligthLedMux() {   
  for (byte j=0; j<digMax; j++) {
    for (byte k=0; k <= nLedMax; k++) {
      if (ListaTransistor[k] == dig[j]) {
        ligthLed(k,ValoriRGB[k][0],ValoriRGB[k][1],ValoriRGB[k][2]);
      }
    }
   
    Tlc.update();
    while (tlc_needXLAT);  //wait for PWM cicle

    for (byte l=0; l<digMax; l++) {      // change multiplex channel
      digitalWrite(dig[l],HIGH);
    }
    digitalWrite(dig[j],LOW);
  }

}
Logged

Gianfranco

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had a very hard experience with 5940mux library, for this reason I tried to
improve the basic TLC5940 library.

I greatly appreciate the reply, but if I understand correctly, the library and setup from Grumpy Mike which I'm trying to get working is different from the Tlc5940Mux library and setup from Alex Leone. It seems like I'm really close to getting this working so I'd rather try to figure this out before trying a whole different setup. Besides, his setup seems less documented so I think my chances of getting it working would be smaller.

As for additional troubleshooting:

I tried looking at the serial monitor to see if there was any obvious problems there, but nothing displayed. I did set the speed to 57600.

I've checked the hardware over and over, but can't figure out what/if I screwed up. I still just get solid rows of unique colors, but not individual LEDs. I'm still hunting for FETs more like what Grumpy Mike used, but am still unclear if the FETs I'm using now are definitely a problem.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I figured it out!!

Of course it was something really dumb on my part. I had wired up the cathodes incorrectly. Now I'm going to try to scale this puppy up and wire in some photoresistors to make it interactive!

Here's what I had before:


Here's the correct hookup:


Bigger versions:
http://i.imgur.com/C43Wy.jpg
http://i.imgur.com/ZYYWm.jpg
Logged

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

Quote
I figured it out!!

Well done. I bet that mixed feeling of triumph and what an idiot I was, is good.

It is still what I feel when I solve a problem. It's a bit addictive.   smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Care to fax each other apple juice?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I scaled it to 8X8 in my Hexome
With one TLC5940 per colour so that you can have separate current control allowing you to balance the colours.

With your default 4x4 setup I'm left with D5 and D13 pins open. Can I use one of the analog pins to get the 7th row going or do I have to do something else?
« Last Edit: June 18, 2011, 03:59:25 pm by elemeno » Logged

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

Quote
'm left with D5 and D13 pins open
Not quite follow what you are saying, sorry.
Logged

Pages: 1 [2] 3   Go Up
Jump to: