Tlc5940 multiplexing code

Hello again,

I have two rows of 4 RGB Led's. The anodes are powered with P-Fet's and go through the TLC5940. I looked at the sample library but it pretty much just confused me. I believe what is suppose to happen is that the Led's are suppose to but turned on and off very quickly so that your eyes cannot detect it and to minimize the amount of power it would take when all of them are on. Can someone point me at a link or just assist me on how I can control this small matrix with the TLC5940 multiplexed. I have searched and came across a few things but all of them are a lot more complex. I prefer to start simple and add up. Please let me know if you can assist me. Thank you in advance.

I'm with you on this one, all I seem to find is some old outdated posts and many of them have very basic documentation.

I'd love to see this too. I'm embarking on a 49 RGB LED matrix and want to power it with TLC5940's.

You've seen Grumpy Mike's example? Mini Monome

In his schematic you'd assumedly be skipping the switch and diode that he has associated with each LED, and also note that all of the R/G/B channels should be connected vertically.

Chagrin:
You've seen Grumpy Mike's example? Mini Monome

In his schematic you'd assumedly be skipping the switch and diode that he has associated with each LED, and also note that all of the R/G/B channels should be connected vertically.

Would P-Channel MOSFET 60V 27A - COM-10349 - SparkFun Electronics be a suitable transistor compared to the recommended TPC6108?

Also, would this scale to 7x7 okay? Would I need to change anything other than the resistors?

Thanks!

Also, would this scale to 7x7 okay?

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

Grumpy_Mike:

Also, would this scale to 7x7 okay?

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.

Should I still use 15k resistors?
Would this through-hole FET work okay instead of the one you used? P-Channel MOSFET 60V 27A - COM-10349 - SparkFun Electronics

Sorry, I'm new to the whole multiplexing thing and electronics in general and want to avoid burning up all those LEDs :slight_smile:

Thanks for the help!

Should I still use 15k resistors?

Where?

The TLC5940 does not required LEDs to have current limiting resistors as there is a current limiting circuit in the chip. Just one resistor is needed to set the current for all the LEDs.

Grumpy_Mike:

Should I still use 15k resistors?

Where?

If I'm reading it correctly, your schematic shows 15k resistors connected to each diode. If I'm not using the diodes, I can eliminate the resistors as well then?

Yes those are pull down resistors for reading the switches. That circuit uses the same matrix scanning that lights the LEDs to scan for key depressions at the same time.

Grumpy_Mike:
Yes those are pull down resistors for reading the switches. That circuit uses the same matrix scanning that lights the LEDs to scan for key depressions at the same time.

Ah I see. And will a 60v 27a FET work okay in lieu of the one you suggest in your schematic?

Thanks for all the help!

That is one heck of an over specification but as long as it turns on fully with 5V (that is a logic level one) it will work.

I've got everything hooked up, but was hoping someone could double-check my work before I blow something up.

In particular I'm worried about a few things:

  1. I'm not sure I wired the decoupling capacitors correctly
  2. Im not sure I wired the FETs correctly
  3. I connected the 5940's together as per the playground article* which seems to differ slightly from Grumpy Mike's schematic †.
  4. I used open digital pins to add in the extra rows of LEDs/fets. The pins in Grumpy Mikes schematic seemed pretty particular and some out of order so I'm worried I'm missing something here.
  5. The Arduinome_4X4_RGB.pde fails to compile (error: 'PD6' was not declared in this scope)

Note: Ignore the IR LEDs and photoresistors since I don't have those hooked up yet. Also ignore the scribbles on the breadboard. They were there when I bought it from a scrap house and won't come off. :slight_smile:

EDIT: Also, I know the LED's aren't connected to the 5940's yet, but will connect up by color (RGB) to the three chips.





*http://students.washington.edu/acleone/codes/tlc5940arduino/img/breadboard-arduino-tlc5940.png
http://www.thebox.myzen.co.uk/Hardware/Mini_Monome_files/4%20X%204%20RGB%20LED%20Matrix.pdf

The Arduinome_4X4_RGB.pde fails to compile (error: 'PD6' was not declared in this scope)

Looks like there has been a change in the latest Arduino distribution that makes this not compile. Take the TLC5940Multiplex_defines.h file and add the following to the end:-

#define PORTB   _SFR_IO8 (0x05)
/* PORTB */
#define PB7     7
#define PB6     6
#define PB5     5
#define PB4     4
#define PB3     3
#define PB2     2
#define PB1     1
#define PB0     0


#define PORTD   _SFR_IO8 (0x0B)
/* PORTD */
#define PD7     7
#define PD6     6
#define PD5     5
#define PD4     4
#define PD3     3
#define PD2     2
#define PD1     1
#define PD0     0

I have now amended this file on my site.

I connected the 5940's together as per the playground article* which seems to differ slightly from Grumpy Mike's schematic

My schematic uses a modified early version of the TLC5940 library which is what I based my code on. The "official" library changed some of the pins, there pins have fixed hardware functions so it is not a simple matter to change them. So you must use my wiring with my code or the other wiring with the other code, you can't mix them.

I'm getting very close! The code complied and some of the LED's are firing, but are very weak. I think it's because there's not enough power. The schematic calls for +5v on pin 19, pin 21 and the FETs. I noticed the schematic says "+5v DC Prog" on pin 19. Does that mean I should be using a separate power supply there?

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

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

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

Grumpy_Mike:
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?

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/