Cut power to TLC5940 => LEDs turn on

Have questions about a SparkFun product or board? This is the place to be.

Moderators: phalanx, TS-Tim

Post Reply
the_julle
Posts: 15
Joined: Mon May 15, 2017 2:43 am

Cut power to TLC5940 => LEDs turn on

Post by the_julle » Thu Oct 04, 2018 12:31 pm

Hi.


I'm using the TLC5940 breakout board to supply some LEDs.

But at times, I need to turn off the LEDs to use as little power as possible. This includes cutting off the power to the TLC5940. However, that is not as easy as it may sounds.

When cutting the power to the TLC5940, the LEDs will actually light up (not as bright as when actually turned on). How can I cut the power to the TLC5940, and make sure the LEDs are off?

This is my setup:
20181004_211922.jpg
I'm using an external 9V power source, connected to the on-board regulator of the Pro Micro board, which then feeds the TLC5940 chip with a regulated 5V supply.

When I want to use as little power as possible, I do this:

Code: Select all

Tlc.clear();
Tlc.update();
But I also want to remove power (i.e. set 0V to the TLC5940 Vcc pin). But when I do this, the LEDs are turning on.... I guess I need a pull up/down? I have tried a 10k between +5V and BLANK, but they still turn on when I remove Vcc.

Any help is much appreciated.

the_julle
Posts: 15
Joined: Mon May 15, 2017 2:43 am

Re: Cut power to TLC5940 => LEDs turn on

Post by the_julle » Thu Oct 11, 2018 1:41 pm

Okay, so an idea is to use a transistor on the 9V wire between the source and the first diode. Then connect an Arudio I/O to the base of the transistor. Would this work? Then I can cut the Vcc voltage to the TLC5940 chip, and then cut the LED voltage. This should cut the power to the chip and make sure the LEDs are off? Which transistor to use for that?

paulvha
Posts: 253
Joined: Sat Nov 11, 2017 2:39 am

Re: Cut power to TLC5940 => LEDs turn on

Post by paulvha » Fri Oct 12, 2018 12:50 am

why don you put a single switch on the +9V from the battery?

Piquan
Posts: 6
Joined: Sun Sep 30, 2018 5:41 pm

Re: Cut power to TLC5940 => LEDs turn on

Post by Piquan » Sat Oct 13, 2018 9:58 pm

To turn on an LED, the TLC5940 pretends to be a ground connection. When you have Vcc connected, the logic can decide whether or not it wants to behave that way. When you have Vcc disconnected, it can't control what it does (because the logic isn't working right), but it can still pretend to be a ground, because your ground pin is connected.

Even if your ground pin wasn't connected, the chip can get its Vcc and ground connections through the other pins! (There's a great video about that at https://youtu.be/2yFh7Vv0Paw.) So cutting Vcc isn't really the best way to shut off a chip.

When BLANK is turned on, the TLC5940 draws about 1mA. You talked about using an Arduino for this project: an Arduino typically will use about 25mA. So if you're already going to spend 25mA to keep the Arduino on, you might as well leave the TLC5940 connected and just use the BLANK line to turn off the LEDs. If you have a way to turn off power to the Arduino, you might be able to leverage that to also isolate your TLC5940 board.

Really, if you're designing something with enough LEDs to need a TLC5940, and has an Arduino running even in hot-standby mode, but can't provide 1mA in standby mode, your circuit might need some design changes.

It is possible to use a transistor to control power to the LEDs, as you suggested, and the rest of this reply will talk about the design of that circuit. But you may be able to find a better design to your overall circuit, rather than focusing on this particular switch.

This will be a high-side switch, meaning that you're turning on and off the current at the positive voltage supply. Most circuits use low-side switches, which cut off the current at ground instead; these are generally easier to design, especially if you're trying to control something with a different voltage than the microcontroller. But in your case, the TLC5940 acts as your ground connection, so you'd have to put a separate transistor on each of the 12 LED connections, rather than a single transistor at the top.

Now, let's decide which. You probably would rather use a BJT (that is, an NPN or PNP transistor) instead of a MOSFET; there are lots of tutorials about BJTs for hobbyists, and BJTs are a lot more durable. If you need a refresher on transistors, read http://sfe.io/t193.

So, do you use an NPN or a PNP? Well, if you use an NPN between the 9V battery and the LEDs, you'd never be able to turn it on! That's because an NPN turns on when the base is at a higher voltage than the emitter. But you'll have 9V at the collector, and if the transistor is on, you'd have a little less than 9V at the emitter. Since your Arduino can only put out a 5V signal, then it can't get higher than the emitter! So, you'll need to use a PNP.

A PNP turns on when the base is at a lower voltage than the emitter. There's two ways you could drive it with an Arduino. The one I'd suggest is the circuit at https://www.falstad.com/circuit/circuit ... 0+144+0%0A. That uses an NPN transistor (on the left) to control whether or not current can flow through the PNP's base (on the right). Then, I have a couple of current-limiting resistors on the bases.

I use a large current-limiting resistor (47k) between the Arduino and the NPN base because we don't need a lot of current there, so may as well use a large resistor to limit how much current we use. You could use a smaller resistor, down to 220 ohms or so, but I'd probably stick with the 4.7k-100k range. For the PNP's base resistor, I needed something smaller: I want the PNP's base to have a decent amount of current (2mA or so), so that it lets plenty of current through to the LEDs. I went with a 4.7k resistor; that will let nearly any PNP transistor pass 100mA to the LEDs, or more depending on the transistor. You can make the PNP base resistor smaller if you need more current for the LEDs, but if you do then you'll be using more current just to feed the base: the lowest I'd probably use is about 1k (which would use up 8mA for the base current alone).

As for which transistors: you can use nearly any transistor for that NPN; I'd probably use a 2N3904 http://sfe.io/p521 for it, which you are likely to have on hand already, since it's included in a lot of packs like the one at http://sfe.io/p13682; a 2N2222, PN2222, BC548, or similar would also work just as well. As for the PNP, that depends on how much current you need for your LEDs. The 2N3906 http://sfe.io/p522 is a common PNP transistor, and can handle about 200mA. If you're working from a 9V battery, you're probably planning on using less than that anyway!

If you do need more current, then you could use a higher-power PNP transistor like the 2N2907 (https://www.digikey.com/short/jd3fzj) or TIP105 (https://www.digikey.com/short/jd3fpc), but for over 500 mA or so, you'd probably be better off going to a MOSFET circuit like https://www.falstad.com/circuit/circuit ... +33+3+2%0A. I made the MOSFET version with a FQP27P06 (http://sfe.io/p10349) in mind. You could use a NDP6020P (http://sfe.io/p12901), which might be better to have on hand because it's easier to use with a Raspberry Pi, but it might be destroyed if you accidentally put 9V across its gate.

Post Reply