# Turn a transistor on when any one of nine LEDs is on using an LM3914

I'm wanting to turn a transistor on when any LED from LED2 through LED10 are on with an LM3914 in dot mode.

Basically, I want the transistor to be normally off until at least LED2 begins to light (using dot mode). Edit: there is some confusion with the diodes D1,D2,D3, and the capacitor C1. This causes LEDs 2,3,and 4 to blink when their on state is triggered based on this answer here: Make three respective LEDs blink with an LM3914 in dot mode

The answer to my new question needs to let the transistor be a solid on and not turn on and off with these blinking LEDs 2-4 in the schematic below:

Here is a picture of the circuit I'll be using for the LM3914.

• Why are LEDs 2, 3 and 4 wired differently to the other LEDs? And what are the diodes D1-3 for? – Andy aka Oct 19 '14 at 20:14
• If "dot mode" is selected, I assume only one LED will be on at a time, except for the brief period the display moves from one segment to another? (The datasheet talks about one fading out while the next fades in.) And if LED 1 is on, you want the transistor off also. – tcrosley Oct 19 '14 at 20:20
• @Andyaka they're wired differently to blink those respective LEDs when their on state occurs. (only 1 blinks at a time) – klcjr89 Oct 19 '14 at 21:49

This can be easily done with some logic gates (2 IC's):

I am using NAND's and AND's instead of OR's because the outputs of the LM3914 are active low. I found from another answer that the outputs are open-drain, so I added 100K resistors to all the inputs.

All inputs on the left come from the outputs of the correspondingly named LM3914 outputs.

If all LED's are off, the output of all three gates on the left will be enabled (NAND gate IC1A low, AND gates IC2A and IC2B high), and the output of the NAND gate (IC2A) will be low, keeping the transistor off.

If any LED is on, the output of its corresponding NAND or AND gate will be disabled, and the output of the NAND gate IC1C will be high, turning on the transistor.

There is a special case for LED2-4, which will be blinking. I added a diode D1, two resistors R11 and R12, and a capacitor C1 to form what is essentially a retriggerable one-shot. While any of the inputs to IC1A are cycling on and off, it keeps the input to the IC1C low and its output high, keeping the transistor on. IC1B is being used as an inverter, since the gate was spare.

This shows a simulation of the timer circuit using Circuit Lab. The input to the inverter is kept above the minimum logic high-level of 2v while the input is toggling:

I have not shown the power connections or other pin numbers, but they are available from any datasheet for the parts. You could also use other logic families, such as CD4000.

I realize it really looks like I should be using an OR gate instead of an AND. As mentioned earlier, it is all because the outputs of the LM3914 are active low. It turns out an AND gate is equivalent to an OR gate that has both inverted inputs and output:

Follow the truth table through for each gate if you don't believe me. So the inverted outputs of the LM3914 match up perfectly with the inverted inputs of the "OR", and the inverted output of the "OR" matches up perfectly with the inputs of the next OR.

• I agree with tcrosley. You need a 9-input OR gate. – user56524 Oct 19 '14 at 23:05
• Confused now due to above comment, would I need 9 pin AND or an OR? – klcjr89 Oct 20 '14 at 1:21
• @troop231 AND gate. I included some additional explanation at the bottom of my answer why that is correct. – tcrosley Oct 20 '14 at 1:54
• @tcrosley Thanks for the update. I'm a little confused where to wire the 3 legs of the AND gates to, before the LED, or after? Could you update the schematic? Thank you – klcjr89 Oct 20 '14 at 1:55
• You wire the inputs of each AND gate directly to the outputs of the LM3914. That is why L labeled the leads the same as the output pin names. i.e. the first input to the top AND gate goes to pin 18 of the LM3914, etc. – tcrosley Oct 20 '14 at 1:59

If you power LEDs 2 to 10 via a small resistor, you can look at the volt drop across this resistor to see that at least one of those LEDs is activated. You might need to use a comparator.

Alternatively you could diode-or outputs LED2 to LED10 to "acquire" the same information. Any one of those outputs going low would be seen on the common point of the diode-or gate as a low going signal. A resistor from the common-anodes of the diode-or up to 5V is also required.

EDIT SECTION - the question has changed slightly - the lower three blinking LEDs would cause a direct implementation of my above answers to "blink" the detection signal. This can be "put right" by adding a monostable circuit after the comparator or diode-or gate in order to keep the detection signal "valid" throughout the blink process. Should LED2 to 10 be turned off during the time delay added by the monostable, this would not be seen until the monostable period was finished. Should this be a problem I don't see any other solution other than using another LM3914 that doesn't blink the LEDs or, have a separate mechanism for blinking the LEDs.

If the logic is "LED2-10 On, Transistor On" aka "LED1 On, Transistor Off", a simple PNP transistor would work. See Figure 19 for a similar setup.

The LM3914 outputs are actually Open-Collector inputs. If On, the internal NPN is on, connecting the output to ground. If Off, the internal NPN is off, leaving the output floating. With a PNP and a weak pull-up, you can use that logic to turn the PNP On.

LED1 in Parallel with PNP, using weak Pull-up 27K and base resistor 15K. In Dot mode, if LED1 is off, LED2-10 must be on, no (might require biasing)?

Figure 18 can also be helpful.

Alternatively, A pair of npn (inverting logic) tied to LED2-10 would also work, but seems messier.

• +1 This is the only one that attempted to analyze the requirement a bit farther. – John R. Strohm Oct 19 '14 at 22:16
• Problem is, if LED1 and the others are off (lower voltage) the transistor still needs to be off. – klcjr89 Oct 20 '14 at 0:20
• @Troop231 thats why you need to bias the input (so that LED1 turns on at 0V input). Base on dutchforce.com/~eforum/… Well, if you're stuck using a 3914, the quick and dirty method would be to connect a 220k resistor between pins 5 and 7 and then connect a 27k resistor between your input signal and pin 5. This will bias the chip input to .11*Vref (turning on the first LED) when your input signal is 0 volts. Since the bias is derived from Vref, power supply fluctuations shouldn't affect it. – Passerby Oct 20 '14 at 2:48
• @Passerby Will this effect my 11.89V to 12.65V expanded scale? I'm using the LM3914 for a 12V SLA battery charge indicator. And I definitely don't want LED 1 to turn off once the voltage falls below 11.89V. – klcjr89 Oct 20 '14 at 2:54
• Wait, signal in must be less than V in. you are powering this from 5v, is your signal input already scaled? – Passerby Oct 20 '14 at 13:14

As the part count in this circuit continues to increase, you might consider using a microcontroller instead. There are plenty of options available in whatever your preferred architecture (e.g. PIC, AVR/Arduino, STM8, ARM Cortex-M0). They have built-in ADCs and oscillators, and with an extremely simple program you can quickly get whatever LED behavior you want with as many auxiliary outputs as you like.