BS2, LEDs and op-amps
jknox
Posts: 9
Hello everybody. I have a real beginner question here.
I have an LED lighting project I have been wanting to work on. (Yes I know PWM has been done to death here, but in my travels I have now found new walls to surmount.) I picked up the BS2 dev kit and a BS2P40. My thinking was that I need seven zones of RGB color so that's 21 pins to control if I don't use multiplexing. The BasicStamp even has PWM built in. Well, needless to say, I have found out that I won't be controlling 21 pins through PWM at any rate that will be acceptable.
OK, so now I find this nifty LED controller (TLC5940). It looks like two of them will fit the bill nicely so I have some on order. Now my serious lack of knowledge bites me...
What I understand is that the TLC5940 sinks to ground. The problem I have encountered is that the LED modules I have are tied together on the common and it is the voltage side that is driven so I would need to invert the signal. Is this something that I would use an op-amp for? The LEDs also run at 12V but I see the TLC5940 can handle up to 17V on the outputs.
From what I can tell the TLC5940 would work perfectly if the LEDs were not designed like they are. Sorry for the question not directly dealing with the BS2. So far programming the BS2 has been a piece of cake. [noparse]:)[/noparse]
I have an LED lighting project I have been wanting to work on. (Yes I know PWM has been done to death here, but in my travels I have now found new walls to surmount.) I picked up the BS2 dev kit and a BS2P40. My thinking was that I need seven zones of RGB color so that's 21 pins to control if I don't use multiplexing. The BasicStamp even has PWM built in. Well, needless to say, I have found out that I won't be controlling 21 pins through PWM at any rate that will be acceptable.
OK, so now I find this nifty LED controller (TLC5940). It looks like two of them will fit the bill nicely so I have some on order. Now my serious lack of knowledge bites me...
What I understand is that the TLC5940 sinks to ground. The problem I have encountered is that the LED modules I have are tied together on the common and it is the voltage side that is driven so I would need to invert the signal. Is this something that I would use an op-amp for? The LEDs also run at 12V but I see the TLC5940 can handle up to 17V on the outputs.
From what I can tell the TLC5940 would work perfectly if the LEDs were not designed like they are. Sorry for the question not directly dealing with the BS2. So far programming the BS2 has been a piece of cake. [noparse]:)[/noparse]
Comments
That is not to say that it can't be done. You would need a circuit called a current mirror. That transfers the sink current to be an equal but opposite source current. It would take a couple of well-matched transistors for each LED. It can be done with op-amps+transistors, but for this, a monolithic transistor array would probably be the best bet. If you want to pursue it, I could draw up a quick circuit for you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Here's my dilema: I have an existing·lighting system on my motorcycle that uses RBG modules. The controller that came with it only allows for the selection of seven static colors. I desire to do color fades and wipes, as well as other special effects. (Once a lighting designer, always a lighting designer. ) So I picked up the Stamp to control everything and soon found that it didn't fit the bill alone. The TI LED drivers look awesome but since the modules are tied together I'm stuck there.
So I have been digging around since my original post. Somebody at the office suggested something like a 7404 inverter but I have been unable to track down one that will handle 12V. I have also found various diagrams such as this one:
Which has this description.
Does this seem to fit the bill? Certainly it is more components than I was looking for, but it is not unmanagable.
I guess my main concern is will it be able to handle PWM duty cycle? Otherwise it seems to be one solution. [noparse]:)[/noparse]
But I have questions for you. You say the LEDs run at 12 volts. Does that mean that there are several LEDs and a current limiter in series for each color? And what sort of current do they need in order to look good? Do you simply apply 12 volts to each one, or will you have to adjust the voltage or current to balance the intensities?
Note that the TLC5940 needs an external clock that sets the grain of the PWM. If you want the PWM cycle to occur at, say, 100 Hz, that means that the minimum grayscale clock will be around 1/2 megahertz. That means that your circuit will have to be pretty fast (~1 microsecond). The circuit in figure 1 is a saturated switch, and those are not noted for being fast. It might get hot due to inefficiency. It might take some additional parts to make it work. Don't commit to it without some experimentation! The maximum grayscale clock for the TLC5940 is 30 MHz, but that would be way too fast.
The TLC5940 has two control mechanisms. One regulates the current to each individual output, in what they call "dot correction". That is used to balance the intensities as they appear to the eye at 100% PWM. There are 64 levels of dot correction for each output. Then, the PWM control is used to modulate the intensities from full on down to 0, in 4096 steps (linear).
The circuit of figure 1 cannot take advantage of the dot correction feature. But that would not matter so much if the LEDs are pre-balanced, or if you can do it manually by adjusting resistor values, or if you are willing to do it in code by scaling the PWM multiplier for each LED.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
It uses two PNP transistors in parallel, and one would be connected to a TLC5940 output, and the other to an LED. The current mirror faithfully transfers the sink current at the input into a source current at the output. That would allow it to use both the dot correction and the PWM features of the TLC5940. The circuit can be quite fast, because the transistors do not have to saturate. But they will get warm due to simple IV dissapation.
The transistors have to be well matched for this to work. In fact, if you use 2N3906 transistors, they should all come from the same batch. Both in each pair have to be at the same temperature, so they should be glued together with JB-weld as suggested by the second diagram. The Zetex e-line transistor is a better alternative, because it has far better heat transfer. Use the version of the circuit that includes the ~10 ohm resistors. The version without requires much better matching of the transistors, such as one would find on a monolithic array or an integrated circuit.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 2/8/2008 7:15:42 PM GMT
The dot correction isn't an issue for this project. The LEDs are prepackaged (water resistant) and the brightness is consistent. And that's part of the problem - I didn't have a choice on how they are wired so I am trying to make due. (Also trying to learn a few things in the process.) Just for reference, this is the package:
I know that I'll find some sort of solution. It may not be as elegant as if I designed the LED packages from the ground up, but as long as I can keep it to a manageable size I'll be happy.
Sometimes this old brain of mine just gets stubborn.
Thanks for the new information. I'll take a look at the ZTX1151s. (Or anything else for that matter if you think it's better.)