4
\$\begingroup\$

I ran into a problem which I tought was extremely simple, and after giving it some thought for more than 2 hours I had to recognise it actually is quite complicated. The problem is the following:

  • I have a circuit which runs on a +24V power supply, so only discrete components are available (no integreated circuit)
  • The input of the system is a single digital input that can be either at low level, at high level, or disconnected
  • When input is at 0V level, I want the first LED to emit light. When the input is at +24V level, I want the second LED to emit light. When the input is unconnected (left open), I do not the LEDS to emit light.
  • The leds use a high current (25 to 50 mA) so they must not rely on the input to provide this current, it should be buffered with transistors

The solution that does this with the smallest amount of discrete components will be approved.

For some reason, all my solutions could not shut both transistors at the same time, and I always had the rist of having some unwanted current putting them in linear mode, leading to LEDs being partially lit up. I do not want that, I want a current as close as possible to zero through the LEDs when they are shutted off.

Also, last but not least I do not with to be tied to a particular transistor model or whathever, so please use generic component whenever possible.

EDIT : So here is my schematic. It works fine for cases where the input is close to 0V or power supply. It however does not work when the input is unconnected, because current can flow through R1 and R3, and it will put transistors in linear mode and send some unwanted current through the LEDs.

enter image description here

I tried a similar circuit using common emmiter instead of common collector, but the fundamental problem is the same, when the input is left floating, the current can make it's way through the base of both transistors at the same time, putting them in linear mode, and having some current in the LEDs :

schematic

simulate this circuit – Schematic created using CircuitLab

(Just trying the builtin schematic for the 1st time, so don't blame me. Please ignore resistor values, they have absolutely no meaning whatsoever).

\$\endgroup\$
  • \$\begingroup\$ I really don't see how the first part of the first bullet implies the second part... \$\endgroup\$ – Eugene Sh. Sep 9 '16 at 18:18
  • \$\begingroup\$ When the input is disconnected, what is its voltage - or how can you distinguish the disconnected state? \$\endgroup\$ – Peter Bennett Sep 9 '16 at 18:18
  • \$\begingroup\$ @Peter Bennett The input is left floating, it doesn't matter it's voltage but it's not being actively tied to any of the power rail. \$\endgroup\$ – Bregalad Sep 9 '16 at 18:19
  • \$\begingroup\$ Of course it matters... It's a state you want to detect, so you should know what to detect. \$\endgroup\$ – Eugene Sh. Sep 9 '16 at 18:20
  • 1
    \$\begingroup\$ @Bregalad I think you are confusing what we are doing here. We are not designing for you, we are helping you to fix your design. \$\endgroup\$ – Eugene Sh. Sep 9 '16 at 18:23
3
\$\begingroup\$

One approach here. D1 and D2 are to protect the bases from excessive reverse voltage.

schematic

simulate this circuit – Schematic created using CircuitLab

See also the minimalist version on the right- it requires low leakage high-Z input and wastes power when the LEDs are off.

\$\endgroup\$
  • \$\begingroup\$ Right side, minimalist schematic wastes way too much power. Hard to imagine it being used in practice. \$\endgroup\$ – jonk Sep 9 '16 at 19:21
  • \$\begingroup\$ @jonk One could contrive a situation- if the signal is only open in case of an accidentally disconnected wire it would be fine. \$\endgroup\$ – Spehro Pefhany Sep 9 '16 at 19:25
  • \$\begingroup\$ Yeah, since you have to supply the current to the LED anyway. I suppose. Hmm..... simple inductor for a buck mode wrapped by just two BJTs, a zener, a couple of diodes..... from an idea I saw a few years back here on EE.SE from Russel... \$\endgroup\$ – jonk Sep 9 '16 at 19:30
  • \$\begingroup\$ Ah. Found the link: electronics.stackexchange.com/questions/34561/… \$\endgroup\$ – jonk Sep 9 '16 at 19:34
  • \$\begingroup\$ dont exceed Veb typ. ratings for reverse breakdown \$\endgroup\$ – Sunnyskyguy EE75 Sep 10 '16 at 4:43
6
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. Current shunting the LEDs.

Rather than trying to switch the LEDs on under certain conditions it may be easier to switch the off by shunting the current around them. Can someone do a sanity check on this design?

How it works.

  • With SW1 high as shown, Q2 is biased off and Q1 is biased on shorting out D1. D2 will light.
  • With SW1 toggled, Q2 is biased on, shorting out D2, and Q1 biased off allowing D1 to light.
  • With SW in mid-position (disconnected) current will flow Q2e-b - R1 - R2 - Q1b-e, bias both transistors on and shunt both LEDs.
  • Current through R3 will be almost constant in the three states. With an LED on it will be \$ \frac {22}{470} = 47~\mathrm mA \$ rising slightly to \$ \frac {24}{470} = 51~\mathrm mA \$ when both LEDs are shunted.

The solution that does this with the smallest amount of discrete components will be approved.

Component count: 5 + the two LEDs.

\$\endgroup\$
  • \$\begingroup\$ Not the way that I'd do it but +1 for actually meeting the requirements of the original poster. \$\endgroup\$ – Dwayne Reid Sep 10 '16 at 13:30
  • \$\begingroup\$ @AndrewMorton: And the switch needs to have three positions, not two. An additional one for "unconnected." ;) \$\endgroup\$ – jonk Sep 10 '16 at 15:34
  • \$\begingroup\$ @AndrewMorton: Engineers usually can't spell. This one, apparently, can't count! Fixed, thanks. \$\endgroup\$ – Transistor Sep 10 '16 at 16:34
  • \$\begingroup\$ @jonk: "With SW in mid-position (disconnected) ..." was my attempt at making up for the limitations in the CircuitLab library. ;^) \$\endgroup\$ – Transistor Sep 10 '16 at 16:35
  • \$\begingroup\$ Thanks, @DwayneReid. What way would you do it? \$\endgroup\$ – Transistor Sep 10 '16 at 16:37
4
\$\begingroup\$

This is the same thing I showed yesterday, but with resistor values filled in and the input section changed a little to work around a problem pointed out by Dwayne Reid in a comment.

The requirements only specify what the circuit must do at three operating points, input tied to the supply, tied to ground, and left floating. This circuit is symmetric about the 1/2 supply point, so we only need to analyze the open case and when the input is tied to one of the rails.

When the input is left open, R5 and R6 form a voltage source attempting to drive the bases of Q1 and Q3 to half the supply. R1 and R2 likewise drive the emitters to half the supply. Both Q1 and Q3 therefore have 0 B-E voltage, which keeps them off. Since there is no base or emitter current, there is no load on the R5-R6 nor the R1-R2 voltage sources, so they are indeed half the supply. With no Q1 and Q3 collector currrents, Q4 and Q2 have no base current. This keeps them off, which keeps their collector currents at 0. These are also the LED currents, so the LEDs are off.

For the other operating case, we will pick IN tied to the positive supply (24 V). Let's say all the transistors have a minimum gain of 50, which is reasonable for small signal transistors. We'll also say the B-E drop of each transistor is 700 mV.

Since the bases and the emitters of Q1 and Q3 are tied together, one will be reverse biased while the other is forward biased. It should be obvious that with IN tied high, Q3 will be off, which also means Q2 will be off, which means D2 will be unlit. No current will flow thru any part of Q3, Q2, D2, or R3, so we can analyze this case as if these components were not present.

R1 and R2 form a Thevenin source of 1/2 the supply voltage with 10 kΩ impedance. With a minimum gain of 50, this will be reflected to the base of Q1 as 510 kΩ to infinite impedance. R5 and R6 form a Thevenin source of 1/2 the supply voltage with 500 kΩ impedance. Not considering the load from Q1 (Q1 gain infinite), the base voltage of Q1 is driven by a simple voltage divider, and is 20.6 V. With the gain of Q1 being 50, the extra load from the base brings it down to 18.9 V. The Q1 base will therefore be from 18.9 to 20.6 V depending on the actual gain of Q1. This means the emitter of Q1 will be from 18.2 to 19.9 V.

R1 and R2 form a 12 V source with 10 kΩ impedance. The emitter current of Q1 will therefore be in the range of 615 µA to 787 µA. The minimum collector current is 50/51 of that, or 603 µA. This is the minimum current the base of Q4 will be driven with. That means Q4 can support at least 30 mA collector current.

As a quick check, with the emitter of Q1 at most at 19.9 V, and the base of Q4 at 23.3 V, there is a minimum of 3.4 V across Q1 C-E, and it is well into its "linear" operating region. This shows the problem pointed out by Dwayne Reid in the previous design has been fixed.

Let's say D1 drops 2.1 V, and the minimum voltage across Q4 is 200 mV, that leaves a maximum of 21.7 V across R4. The maximum R4 current, which is also the maximum LED current is therefore 5.0 mA. Q4 can clearly support more current than that, and will be saturated regardless of where its gain or that of Q1 fall between 50 and infinity. With Q4 being able to support 30 mA but only needing to support 5 mA, there is a wide margin, indicating this design is has significant headroom with the minimum specified transistor gain of 50.

With IN at 24 V, LED D1 will light with 5 mA thru it, which is quite obviously lit for a modern green LED. It also runs the LED well below maximum, which is 20 mA for readily available indicator LEDs.

R4 will dissipate 110 mW, which is just within range of a 0805 properly mounted on a PC board. Any "1/4 W" resistor is more than adequate.

Again, the circuit will work symmetrically when IN is tied to ground. This time, Q3, Q2, and D2 will be on, with D1 off.

Therefore, D1 is lit when IN is at 24 V, neither LED is lit when IN is left floating, and D2 is lit when IN is at 0 V. Since these were the only requirements, this circuit meets the specifications.

\$\endgroup\$
  • \$\begingroup\$ The input needs to supply not only the entire base current for the output switches via the input BJT emitters, but also since the emitter must be at least \$750mV\$ or so above or below input (when connected), still more current into the Thevenin divider. Serious loading of input line, I imagine, if output BJTs are treated as switches (can't rely on their beta if not saturated, either) and supplying 40-50mA for the LEDs. \$\endgroup\$ – jonk Sep 9 '16 at 19:26
  • \$\begingroup\$ @Jonk: You are assuming incorrect relative resistor sizes. I'll probably get into this more tomorrow, but most of the Q1 and Q3 emitter currents come from R1 and R2, not the input signal. R5 is "high", and is only there to make sure Q1 and Q3 are off when the input is floating. With two transistors providing gain for each LED, the input impedance can be quite high. \$\endgroup\$ – Olin Lathrop Sep 9 '16 at 22:37
  • \$\begingroup\$ Okay. I was just giving it a first blush and thought things the other way. But I can switch my thinking around and imagine that the thevenin of \$R_1\$ and \$R_2\$ are supplying the principle currents. Thanks! You don't need to get into details. \$\endgroup\$ – jonk Sep 9 '16 at 22:43
  • \$\begingroup\$ I've given this +1 but I do think that 2 more resistors are needed: in the bases of Q1 & Q3. Examine what happens if the input is hard-connected to either +24V or Gnd - input current is high and there is a great possibility that neither LED will light. But the circuit topology is good. \$\endgroup\$ – Dwayne Reid Sep 10 '16 at 16:40
  • \$\begingroup\$ @Dwayne: Good catch. This has been fixed in the updated design I just posted. \$\endgroup\$ – Olin Lathrop Sep 10 '16 at 22:09
2
\$\begingroup\$

Frame challenge time: your 24V supply does not rule out ICs! Digital logic isn't built for such a high supply voltage, sure, but many analog ICs are perfectly happy running on a 24VDC supply, including comparators -- which take analog voltages and turn them into logic outputs.

Furthermore, your application is nothing new -- what you want is a window comparator, simply tweaked from the classical configuration. The circuit below should do the job -- the LT1017 has plenty of grunt to drive your LEDs, and is rated to run at anywhere from 1.1V to a whopping 40V! With the given resistor values, the input floats at midsupply when not driven, and needs to be pulled within 1.2V or so of the rail to turn the appropriate LED on. Hysteresis is left as an exercise for the reader.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
\$\begingroup\$

Lots of interesting options shown in the other answers, but I'll add another one to the mix:

Zener Diodes and MOSFETs

In this circuit the LEDs are driven by two MOSFETs - one LED is driven by a P-Channel and the other by an N-Channel.

The gates of the MOSFETs are pulled to opposite supply rails by 10k resistors which act to turn them off. The gates are then connected together with a pair of Zener diodes which are selected so that they have a forward voltage in the range:

$$V_{dd}/2 << V_{z} << V_{dd}/2 - V_{th}$$

Because the Zener diodes forward voltage is more than half the supply rail, and there are two in series, it means that when nothing is connected to the input (which is at the centre of the two diodes), the resistors will be able to pull the MOSFETs off as the Zener diodes are effectively open circuit.

When you pull the input (mid-point of the diodes) low, there is effectively now only one Zener diode between the PMOS gate and ground which allows the diode to conduct and so pulls the PMOS gate low which turns it on while keeping the NMOS off. Conversely, when the input is pulled high, there is now only one Zener diode between the NMOS gate and the supply rail which causes the NMOS to turn on which the PMOS stays off.

The Zener diodes will also regulate the gate voltages to the supply voltage minus the Zener forward voltage, so you don't need to find a MOSFET with a Vgs rating of the full supply (which is good as many are rated for 20V on the gate only).

For your 24V supply, I'd go for something like an 18V Zener diode as this will give you at least 6V Vgs so should allow the MOSFETs to turn on nicely.

You will need to size the two resistors to suit how much bias current can be drawn from the input. With 10k resistors as shown, around 0.6mA current flows to/from the input. If you go with say 100k you could bring this down to a few tens of microamps.

However, you can't make them too large as the Zener diodes will conduct a small amount of current even when below their threshold voltage. If the resistor are too large, then the MOSFETs may be turned on. It will depend on the I-V characteristics of the diode, but to be on the safe side 10k-100k should work perfectly well.

\$\endgroup\$
2
\$\begingroup\$

May as well add yet another random wag.

schematic

simulate this circuit – Schematic created using CircuitLab

Per Transistor: ;)

Well, I figured that the opamp will have to source from its (+) rail when trying to pull its output up and will have to sink into its (-) rail when trying to pull its output down. I just made it so that in order to source from the (+) rail it has to pull that current through an LED and in order to sink into the (-) rail it has to sink that current through the other LED. I had to stick \$R_1\$ and \$R_2\$ at its output, too. The result is that the opamp will either (a) pull current through \$D_1\$ to sink into \$R_2\$, when hauling its output upward (lowering current in \$R_1\$ while increasing current in \$R_2\$), or else (b) sink current into \$D_2\$, sourced from \$R_1\$, when hauling its output downward (lowering current in \$R_2\$ while increasing current in \$R_1\$.) Well, there is case (c) where the PIN is left unconnected. Then the opamp will sink or source slightly different amounts through the diodes, but on the order of dozens of microamps in both cases so probably not visible.

\$\endgroup\$
  • 3
    \$\begingroup\$ I think this one gets the award for the screwiest, or cleverest abuse of a opamp. However, it is relying on unspecified behavior of the opamp. I've never seen a datasheet that promises what exactly the power and ground currents of a LM358 will be at different operating points. \$\endgroup\$ – Olin Lathrop Sep 10 '16 at 22:34
  • 1
    \$\begingroup\$ Go on, Jonk. Add a little text. Nice idea. I'd forgotten this kind of trick. \$\endgroup\$ – Transistor Sep 10 '16 at 22:37
  • \$\begingroup\$ @OlinLathrop: I looked at the schematic for the LM358. I suppose they might redesign the thing. But I doubt it. \$\endgroup\$ – jonk Sep 10 '16 at 23:39
  • \$\begingroup\$ @Transistor: Done. \$\endgroup\$ – jonk Sep 10 '16 at 23:39
  • \$\begingroup\$ I remember having to design a complete op amp in 30 min. on a final exam, it has at least 20Q's \$\endgroup\$ – Sunnyskyguy EE75 Sep 10 '16 at 23:41
1
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

Zeners here are 12v (highest available in editor) - not a good choice. Something like 20v would be more appropriate. In an effort to reduce parts count, LED current limiting relies on 2N3904, 2N3906 transistor beta, in combination with R1 value. This one is similar to your second attempt, Bregalad.

\$\endgroup\$
  • \$\begingroup\$ Ugh. Relying on transistor gain not exceeding a maximum is pretty bad design, especially when you haven't even shown what that maximum gain is. \$\endgroup\$ – Olin Lathrop Sep 10 '16 at 22:36
  • \$\begingroup\$ @Olin Lathrop - Consider me judiciously slapped ;-) Criteria was for minimum parts count, so I've saved a resistor. What's more important here, min parts count, or reproducability? I've voted for Transistor's solution - sweet. \$\endgroup\$ – glen_geek Sep 10 '16 at 22:56
1
\$\begingroup\$

for something different for something different FETs ok ? I can use Darlingtons

\$\endgroup\$
  • \$\begingroup\$ This doesn't meet the spec since the LEDs don't go out when the input is left floating. If the left LED lights when the input is low, then both LEDs will share at least that current when the input is floating. \$\endgroup\$ – Olin Lathrop Sep 10 '16 at 22:40
  • 1
    \$\begingroup\$ if the Vgs is chosen correctly , both are off., which is why I used 10:1 divider \$\endgroup\$ – Sunnyskyguy EE75 Sep 10 '16 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.