# Correct way to drive an LED using 74HCxx logic

What is the correct way to connect an LED to a logic circuit?

The obvious thing to do is this:

simulate this circuit – Schematic created using CircuitLab

I have two concerns:

• Can the logic gate's output actually deliver enough power to drive the LED? (Sure, LEDs are very low-power. But so are logic gates!)
• Will the load from the LED distort the output so much that I can't connect it to any other gates?

The second problem looks like it ought to be trivial (if inconvenient) to solve:

simulate this circuit

Now only the output of the buffer has to deal with the load from the LED; the AND gate is blissfully unaware that anything has happened.

Trouble is, I'm planning to use 74HCxx logic running at 5 V, whereas it looks like most LEDs want to run at ~2 V. Also, it appears 74HCxx can only supply up to 4 mA, whereas most LEDs seems to draw drastically more current than that.

So now what?

Perhaps I could use a resistor to work around the voltage difference. (My knowledge of analogue electronics is far too weak to know if that would work.) Alternatively I could just run all the logic at 2 V instead. (The 74HCxx series seems to support that.) All of which does nothing to solve the current problem.

Do I need one of the level-translating logic gates? Or do I need to build something even more elaborate than that?

• A LED, like all diodes, will only draw as much current as you supply it with. May 26, 2018 at 18:02
• In both your schematics the LEDs will need series resistors to limit the current and they need to be flipped over so that they can be allowed to light. As depicted the LEDs will be reversed biased all the time. May 26, 2018 at 18:14
• @MichaelKaras Ah, I always forget whether the arrow is supposed to point towards + or away from it... May 26, 2018 at 18:18

The circuits you propose won't work (the LED will not light up) because you're trying to make the current flow through the LED in the wrong direction (reverse mode).

Also it is a must to use a series resistor. Yeah sure, it will work without a series resistor but that puts a lot of stress on the logic gate and the LED. Also without the resistor the current through the LED is very uncontrolled and that should be avoided.

Let's cut to the chase and let me show you how it is done:

simulate this circuit – Schematic created using CircuitLab

For this circuit D1 and D2 will light up when "signal" is high (one = 1 = +5 V)

Resistors R1 and R2 limit the current to about 3 mA when using a 5 V supply. For modern LEDs 3mA will be enough current. If you're using old LEDs you might need up to 20 mA and then it is better to use an additional transistor to make that current flow as logic gates aren't designed to supply such a current.

You need to remember that the HC gates cannot supply more than 4mA and provide valid logic levels at the same time. So, if you want to drive an LED from a gate output you can not also use that gate output as a logic signal. Your second solution is the more correct one.

Now, if you no longer care about maintaining valid logic levels where the gate output is connected to the LED then you can source considerably more than 4mA from the gate output. The manufacturer doesn't provide min/max values for this situation because that's not really how the gates are supposed to be used. Some manufacturers will provide graphs of typical output current as a function of output voltage. To be safe, you will need a series resistor to limit current. In the absence of data sheet specifications you will need to try some experiments. Be sure that you don't exceed the total current limit of the entire packaged device.

This whole approach is OK for a hobbyist situation but it's not suitable for high-volume manufacturing if you care about reliability. The right way to control an LED is with a discrete transistor or using an integrated circuit that is specifically designed for driving high-current loads.

• Can you give an example of an IC "specifically designed for driving high-current loads"? Does that mean one of the "open collector" logic gates, or something else entirely? May 27, 2018 at 8:55
• From a quick google search, look at the Microchip TC4467. There are many choices, depending on your needs. May 27, 2018 at 11:54
• It looks like the key phrase to search for is "driver". Thanks for the tip. May 28, 2018 at 8:43
• Changing to 74AC parts will provide +/-24mA current capability, no extra buffering would be needed to drive the LED/resistor and any following logic. Dec 20, 2018 at 13:27