1
\$\begingroup\$

I am creating a circuit that will light an LED when either signal A or signal B is high. I know of three choices to accomplish this: a diode based OR Gate, a transistor based OR Gate, or an OR gate IC (Schematics below). Aside from minimizing cost and part lists, what are the pros and cons of each?

Edit 1:
Full disclosure. I am recreating the Adafruit Powerboost 500c Circuit, but I want to reduce the LED's I need down to one. It has four LED's to represent the following signals, next to which I put the desired behavior for my circuit:

BLUE - Power (I don't care about this signal)
RED - Low Battery - The LED should be lit when the battery is Low.
ORANGE - Charging - The LED should be lit when the battery is charging.
GREEN - Fully Charged - The LED should be unlit when the battery is charged.

I am removing the BLUE LED and R5. I am removing the GREEN LED and R7. I want to light a single LED if either the input to the RED LED or the input to the ORANGE LED is high. I wasn't sure if just hooking both inputs to an LED without other circuitry was a good idea so I googled "OR Gate circuit" and discovered three possibilities: a Diode OR Gate, a transistor OR Gate, and an OR Gate IC. If any of these is the best choice, which is it and why? If none is best, then what is? I would like to reduce costs if possible.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Your question is difficult to answer because you haven't provided enough information. What is the nature of signals A & B? For example, can they provide enough current by themselves to light the LED? Also, how much current does your LED need to light sufficiently? Is speed of any concern? Is this a one time circuit or are you planning to build many? It would seem that in your simple application, cost and parts lists should be the major concern unless you have the parts already on hand. \$\endgroup\$ – Barry Jan 2 '15 at 22:04
  • \$\begingroup\$ Your schematics will be much more readable if you always point ground down and at the bottom. \$\endgroup\$ – Phil Frost Jan 3 '15 at 3:30
  • \$\begingroup\$ Also, it would be much easier to discuss your schematics if you gave each component a unique identifier (rather than a handful of resistors all named "R?") \$\endgroup\$ – Phil Frost Jan 3 '15 at 3:42
2
\$\begingroup\$

I would say: none of the above.

Let's take them one at a time.

The first one you are assuming enough current from your logic outputs to drive the LED. You also need to take into account the voltage drop from the diodes. With silicon diodes that can be as high as 0.7V. It would work, and you don't need the 10KΩ resistor as it serves no purpose at all.

The second one the transistors are in the wrong place. They should be below the LED, not above it. The voltage to switch on is relative to the emitter, and with the LED and resistor in that path you're offsetting that voltage a lot. You should have the emitter to ground and the LED on the collectors. See my circuit below.

The third one I actually have no problem with, and if you want to use a chip then that's fine. Be sure to choose one that can source enough current to drive the LED.

The discrete component option I would use would be to use a pair of NPN transistors:

schematic

simulate this circuit – Schematic created using CircuitLab

With that arrangement the inputs aren't inverted (either HIGH turns a transistor on), and Vcc can be any voltage you like (with the right resistor and suitable transistors of course). The LED can draw as much current it needs to and isn't limited to just what the logic outputs can provide.


By the way, the layout of your circuits is not easy to follow. Especially the habit you seem to have of letting your ground points stick out at all angles. A good schematic has:

  1. Inputs to left
  2. Outputs to right
  3. +ve voltages to the top
  4. Ground to the bottom
  5. (If you have them) -ve voltages right down the very bottom.
\$\endgroup\$
  • \$\begingroup\$ I think your comment about the first circuit is not correct. The 10k resistor is connected to ground, not a DC voltage. So the LED can only turn on from current supplied by either of signals A & B. If neither is present, there is no source of current to turn on the lED. \$\endgroup\$ – Barry Jan 2 '15 at 22:07
  • \$\begingroup\$ That's true, the way the circuit is laid out I just read that as going to Vcc since it was upwards - shows the importance of proper schematic layout doesn't it...? \$\endgroup\$ – Majenko Jan 2 '15 at 22:09
  • \$\begingroup\$ Also, your comment about circuit 3 is incorrect. 74LS (except for driver chips, and the LS32 is not one of those) will not source the required current. For driving 10-15 mA, LS will work only if the LED is sinking current from +5, not sourcing it to ground. In this case, that also means the gate has to be a NOR - such as a 74LS02. \$\endgroup\$ – WhatRoughBeast Jan 2 '15 at 22:30
  • 2
    \$\begingroup\$ The second one will work fine. It eliminates the need for a base resistor at the cost of a (Si) diode drop across the B-E junction in series with the LED. (of course the pull-down 4.7kΩ resistor is unnecessary). The schematic you have drawn is missing the base resistors. \$\endgroup\$ – W5VO Jan 2 '15 at 22:31
  • \$\begingroup\$ Re option 3: I specifically mention to choose a chip capable of sourcing enough current. Re the circuit I drew: you're just fussy. I (and everyone with a clue) knows about the base resistors and take them as read. But just to please the pedant in you I have added them. \$\endgroup\$ – Majenko Jan 2 '15 at 22:38
1
\$\begingroup\$

Here's an even simpler scheme that works if the input voltages are something like 0/5V or 0/3.3V:

schematic

simulate this circuit – Schematic created using CircuitLab

And if your input voltages are 0V/5V and you can even do this:

schematic

simulate this circuit

The solutions with transistors have the advantage that the inputs do not have to source enough current to operate the LED, only a mA or so.

\$\endgroup\$
  • 1
    \$\begingroup\$ +1. I'd point out that your 2nd schematic is pretty much the 2nd schematic from the question, modulo the 4.7k resistor in parallel with the LED. \$\endgroup\$ – Phil Frost Jan 3 '15 at 3:36
  • \$\begingroup\$ Yes, good point. The 10K resistor in the OP's first schematic is also quite optional. \$\endgroup\$ – Spehro Pefhany Jan 3 '15 at 3:39

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.