Go Down

Topic: Shiftregister,PWM and RGB LED I need help (Read 8135 times) previous topic - next topic

Uptown

#15
Jul 28, 2012, 12:00 pm Last Edit: Jul 28, 2012, 12:45 pm by Uptown Reason: 1
To be honest I'm not sure about the right IC. On the one hand the TLC5940 seems to be a good one,but on the other hand it has it's own "illness"

look here
http://effluviaofascatteredmind.blogspot.de/2012/05/tlc5940-tlc5941-and-arduino.html
http://e2e.ti.com/support/power_management/led_driverslcd_bias/f/192/t/85711.aspx

Also a negative aspect is, you can't use SPI library, tlc5940 needs it's own. Additionally the current limitation goes only up to 130mA is not enough.

If I devide 130mA by 16 outputs, I receive 8,125mA per each output. Normally if you just write at only one channel while the other are still off you can consume more current. But I want have some free space for mistakes, because I'm not perfect in C++. (Note I use RGB LED with common anode which need up to 60mA (20mA for each color) ). If turn on all RGB LED accidentally it becomes damaged.


I saw a modification of 74HC595. It's current limitation goes up to 500mA. But the problem is
Quote
They [the chip] cannot source current so they should be connected to LED cathodes. This makes them ideal for use with LED matrices where you end up sinking 8 or more LEDs at once.


http://www.adafruit.com/products/457
http://www.adafruit.com/datasheets/tpic6b595.pdf

Are there other alternative ICs?


P.S. I'm not sure about the wiring of tlc5940
http://tlc5940arduino.googlecode.com/svn/wiki/images/breadboard-arduino-tlc5940_close.png

I read that some people used decoupling caps. Do they have any sense?

funkyguy4000

The wiring is straight-forward, you put this wire there.  Since there is even a picture on google code, it makes it way easier than many other IC's.  The current isn't quite an issue if you are getting the desired brightness out of your LEDs now with your setup.  The TLC5940 has current supply of 120 mA for each channel when the supply voltage is above 3.6v.  I've run it at 5v, i've set the Iref so that it only puts out 20mA and that is blinding for LEDs. 

in reference to the "illness", why would you run it without a load in the first place.  The argument doesn't make sense at all.  Why would you hook up and IC entirely, turn it on, when there is no load.  If there is no load, there isn't a need for the component. 

The 74HC595 doesn't output any more mA than a TLC5940 can. 
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1256359254

If you need some help with calculations and general topics, check out Grumpy_Mikes site
http://www.thebox.myzen.co.uk/Tutorial/Power.html


If you really really really actually do need a lot of current for your project, check out this video
http://www.youtube.com/watch?v=wXvs0CrRPIw

It explains how you can up the current when using 74HC595's.
Accelerate to 88 miles per hour.

Uptown

thank you very much for the links and the video, which is really helpful. I 'm sorry, I didn't mention that I used for 74HC595 additionally some transistors.

This brings me to a new question. this guy used for the columns a ULN... IC, which works as an "amplifier". I would also buy some, that can work finally with 60 mA per pin.  I know that it consumes a lot of current, but in case of wrong coding, I would have some free space for mistakes. Any advice?

And finally an additional question. I already connected my arduino with TLC5940. I took a look on my arduino uno and I noticed that this connection left only 2 pwm pins over. I need 3 pwm pins to control 3 trasistors. (every transistor controls only one color).

There are two options. 1) Buy an arduino mega. (I don't need it know, mayne a bit later)
                                   2) Redefine the pins which TLC5940 library needs. is it possible?
do you have any other options?



funkyguy4000

I'm sorry, I dont understand your programming question, could you please be a bit more clear as to what you mean?

As for your pin issue, I would recommend putting the transistors on the analog pins. The analog pins can do the same thing as a PWM pin. Hence why when you want to do PWM through a digital pin, you type analogWrite(). You would do the same command I believe.

I would google "pwm on analog pins arduino". I'm not at my computer or I would do this for you.  The code may be a bit different when doing it through an analog pin over a digital one, I'm not sure.
Accelerate to 88 miles per hour.

Uptown

#19
Jul 28, 2012, 10:23 pm Last Edit: Jul 28, 2012, 10:25 pm by Uptown Reason: 1
First of all lets talk about the pins. Well,  driving transistors thru the analog pins is a good idea. I read in the documentation of the TLC5940 that I only need 3 pins SIN, SCLK and XLAT. TLC 5940 library use 5 pins. Can I reduce it. I don't need the pwm stuff on my tlc IC.

http://www.ti.com/lit/ds/symlink/tlc5940.pdf (Page 12)

funkyguy4000 what I meant with the first question is: do you know a good "amplification" IC (sorry I don't know how they are called)?
Which I can attach in addition to my tlc5940? ULN... I don't know which one. The one criteria is: it should output current more than 60 mA per pin. Is it possible ?

thanks



p.s. funkyguy I found what you meant
http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM

funkyguy4000

If you really don't need the PWM signals at all, then you can use the WS2801 IC.  Keep in mind, if you want to delegate different colors by mixing the Red, Green, and Blue to achieve, say, purple or brown, you will need PWM to modulate the signal to that specific part of the RGB LED.  PWM isn't just for fading.
https://www.sparkfun.com/products/10444

It runs off of I2C or "two-wire" interface.  Those pins are on A4 and A5, unless you have an Leonardo, in which they are  broken out next to the AREF pin.  Its a simple protocol that is governed by the Wire library that is included in the Arduino IDE, so you don't need to download anything.  I'm sure that there is a library for the WS2801 since its pretty common and would probably make interfacing with it much easier.

If you want an amplification circuit, then you shouldn't use something that sinks current.  It would be a better choice to source it, although you will have to use some math, mainly figuring out resistances and setting the proper current so that you don't burn out your circuit.  You can use that current sourcing IC from the video, the UDN2981A.  Although I've never done this, I see no reason for it to be hazardous.  You can use the UDN2981A in conjuction with the MAX7219, which is very common.  The MAX7219 is like the TLC5940 but rather than sinking current (connected to the ground of leds), the 7219 sources current, so you connect it to the anodes of your LEDs.  Since it sources current, you may be able to put the UDN2981A right in between the MAX7219 and the LEDs. 

If you need a large current, then I don't think the WS2801 is the right choice since it sinks current.  The issue with sinking high current is that it can damage an IC very quickly.  The IC has to be designed to sink large amounts if you want to sink the current.  Sourcing current brings little risk to the IC that is sourcing the current because it isn't receiving any current from its channels, its outputting it. 

You may notice in the video that I posted earlier, he has the shift register send out the data, and then it goes through the UDN2981A and then goes through a load that brinks the current level back down to safe levels for the receiving shift registers. 


I do need to know one thing before I can help you further with finding the proper solution.  How much current do you need to go through your leds?
Accelerate to 88 miles per hour.

Uptown

I have RGB LEDs with common anode. Every color needs max. 20mA. Thats totally 60mA.

My though was I use 5 TLC5940. They just switch on or off the connection to the common anode of a RGB LED. Then I connect all the pins which stands for the same color at collector pin of my trasistor. So it's totally 3 transistors.

The idea seems to be good. But unfortunatelly TLC 5940 is designed for current sink. I fully understand you.

MAX7219 seems to be a good solution. It has only 8 bit and they are expensive 11€ or 9$ (sparksfun) too.They are more expensive than TLC :( .  As result I need 10 of them ->90 $, thats hurts really. Do you have something alternative?

UDN2981A seems to match as well, but it needs 15 Vin.
http://www.datasheetcatalog.org/datasheet/allegromicrosystems/2981.pdf

I am starting to doubt about the whole project.




funkyguy4000

You can easily get 20mA out of each channel for the TLC5940.  You wont need the transistors if you use the TLC5940 since it is a PWM driver.
I don't think you quite understand you wire the leds up to the 5940.  Since they are common anode, you connect the anode pin to your Vcc and then you connect the cathode pins to the tlc5940.  You wouldn't be breaking the connection to the anode by means of the tlc5940, that's not how it works.  You can get a sample of them from Texas Instruments if you aren't sure they are what you need.

If you go to electrodragon, they can make a special order for the WS2801's.  35 of them for $7, each one can drive an RGB led so you'd be golden there.  Although I'm unsure about their PWM capability.  On top of that, I don't think that they come in a DIP package.

If your RGB LEDS are common anode, then the tlc would work.  The max7219 is only for common cathode displays. 
Accelerate to 88 miles per hour.

Go Up