0

I need some logic gates for a simple demo like this one. I will use a regular breadboard and an Arduino UNO as a 5 V and GND supply.

I found these ICs from Texas Instruments SN74LSxxN (NOT, AND, OR, NAND, NOR, XOR). For my demo I only need two inputs (well obviously only one on NOT) and one output on each chip. I want to connect the output to a LED via resistor to demonstrate that for example 1 XOR 1 equals 0 (LED off), or NOT 0 equals 1 (LED on):

demo circuit

My LSs seem to work as expected without an LED connected:

works well

int value;

void setup() {
 pinMode(10, OUTPUT);
 pinMode(11, OUTPUT);
 Serial.begin(1200);
}

void loop() {
 digitalWrite(10, LOW);  
 digitalWrite(11, LOW);
 value = digitalRead(5);
 Serial.println(value);  
}

…but it would be great to make an LED demo too.

These ICs are probably a better choice in my case?

  • SN74ACT04N (NOT)
  • SN74ACT08N (AND)
  • SN74ACT32N (OR)
  • SN74ACT00N (NAND)
  • CD74ACT02 (NOR)
  • SN74ACT86N (XOR)

For everyone who isn't happy with Arduino as power supply here an alternative circuit with the same question - which IC family should I use?

enter image description here

Update: Well, probably I should better use something like LogicBlocks for my demo. There is no NOR, XOR or NAND in this set, but it should be much easier to handle.

12
  • 1
    No, that is not OK. Those chips have ±4mA outputs at 5V. You are asking around 15mA (depending on LED forward voltage).
    – Majenko
    Dec 29, 2016 at 21:25
  • Majenko could you recommend some suitable ones? Dec 29, 2016 at 21:30
  • GeMir, you can increase the resistor, say to 2K, and see if you have enough brightness. Some high-brightness LEDs are ok with up to about 15K series resistance at 5V. Note, see Ohm's law. 5V/200Ω = 25 mA, too much for typical 74HC outputs to source. [Actually, the calc. should be (5V-Vled)/200] 5V/4mA = 1250Ω, so a 2KΩ is ok. Or you could add a buffer to drive LEDs. Dec 29, 2016 at 21:36
  • @jwpat 1.8 kΩ carbon ones? Dec 29, 2016 at 21:51
  • GeMir, those should work ok. The current calc. for red LEDs at say 1.6V drop would be (5-1.6)/1800 = .00188, a little less than 2 mA. You could go as low as about 1K; (5-1.6)/1000 = .0034. With white LEDs at say 3.4V, (5-3.4)/1000 = .0016 = 1.6 mA and (5-3.4)/470 = .0034 = 3.4 mA. Anyhow, you don't need anything except a meter, an LED, a resistor, and a 5V supply to test if LEDs are bright enough at low enough current. Dec 29, 2016 at 21:58

2 Answers 2

2
+50

The SN74HC04 has a documented output driver capability of ±4 mA when running at 5V:

SN74HC04 datasheet

Assuming you are using red LEDs with a forward voltage of 1.6V (as I measured one of mine lying around on the bench to be), then to not exceed this you need to get a resistor of:

(5 - 1.6) / 0.004 = 850 Ω

A reasonable (and safer) value would be a standard 1k resistor, which you are likely to have lying around (and if not, get a few hundred of them). That would give you 3.4 mA current through the output pin, which is in range.


I found something very similar to my demo on YouTube ...

Yes, well, people on YouTube aren't always doing things exactly like they should. :)

See Mike Cook's tutorial The care and feeding of LEDs. As he points out, a lot of people use the wrong, or no, resistors because "it seems to work".

It may well seem to work for a while, but if you want a design that will last for a long time, you work within the manufacturer's specifications.

The problem with people disseminating wrong information is that someone will then copy it, and repeat it, and before long you find people saying "everyone does it this way".

2
  • Thank you very much for your time and explanations! Since SN stands for "Texas Instruments" and there is no SN74ACT02N (NOR), shouldn't I look for CD74ACT04, CD74ACT08 etc. (I prefer buying parts of same manufacturer)? Dec 30, 2016 at 10:56
  • Ok, found it. CD means "CMOS digital logiс IC". These chips were made by Harris Semiconductor. Dec 30, 2016 at 12:02
0

The circuit I was looking for looks like this:

enter image description here

And the HC family seems to do the job. Thanks to dlloyd (link).

2
  • 1
    I gather you have decided to source 9.7 mA from the 74HC08N output driver. Since the device is specified to provide ±4 mA I'm just curious to know why you did that? You are running at 243% of its documented ability.
    – Nick Gammon
    Jan 3, 2017 at 4:38
  • @NickGammon It was dlloyd's recommendation, I've got HC- and ACT-family chips and use ACTs now. Jan 4, 2017 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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