TTL NAND gate pull-up resistor question - Page 1
Forum section: electronics / beginners

author: Jim from Chicago
author_rank: Regular Contributor
timestamp: June 10, 2022, 05:22:10 am
content: I don't understand how the pullup resistor R3 guarantees that the LED will be off when the output of the NAND gate is HIGH but below 5V in this circuit. Even with R3 present, wouldn't the voltage drop across the diode and R1 be the same? Here is the full link from where the above image was taken for more context:https://www.nutsvolts.com/magazine/article/optocoupler-circuits

author: ataradov
author_rank: Super Contributor
timestamp: June 10, 2022, 06:16:57 am
content: 2.4 V is a bit low, typically the minimum compliant output voltage is 2.7 V. Full push-pull TTL output stage in a "high" state has voltage that is two diode drops lower compared to VCC, so about 3.5 V for 5 V logic.So, even if the output is "high", you will have 5 - 3.5 = 1.5 V across the R1 and the optocoupler diode. This is enough to have the diode (partially) open. The pull-up resistor makes sure that this voltage is close to 0 V by literally pulling the cathode to 5V (same voltage as the anode).

author: ledtester
author_rank: Super Contributor
timestamp: June 10, 2022, 08:39:39 am
content: The use of R3 is a standard way of interfacing TTL to CMOS logic but I'm wondering if in this case the resistor is strictly necessary.For instance, this analysis of a TTL NAND gate says that when outputting a logic HIGH:"... The above circuit's VOUT output cannot sink current (as Q4 is off.) ..."https://electronics.stackexchange.com/a/304722/95488

author: wraper
author_rank: Unknown
timestamp: June 10, 2022, 08:49:51 am
content: Even if there is some very small current flowing through the LED, it will not be enough to activate the output of optocoupler. Even though TTL output will not pull output to VCC, it does not mean it can sink any significant current to GND. Resistor in this case improves nothing and only increases current consumption when TTL output is in low state. Here is a typical TTL output:

author: Manul
author_rank: Super Contributor
timestamp: June 10, 2022, 04:18:14 pm
content: Well, one could argue, that LED would turn off slightly slower without the pullup. And then it's voltage would hover near conduction for quite some time. Of course, speed is not very important, because phototransistor is slow anyway.There is another point worth mentioning in my opinion. If the phototransistor side has high voltage swings, they will couple to the LED both positive and negative up to slight forward conduction or reverse breakdown. I don't know how significant it would be, it very much depends on the application and numbers, but pullup would help with that.With high speed optocouplers CMTI improvement could be achieved by equalizing impedances on both cathode and anode side of LED. But that is yet another story.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: June 10, 2022, 04:43:45 pm
content: The problem is made worse by the large ratio betwen R1 (150R) and R2 (10k). Because of this large ratio even a small parasitic current though the LED of the opto coupler results in a relatively large voltage over R2.The IR leds in optocouplers have a lower voltage then LED's in the visual spectrum (Voltage drop = energy gap = photon energy = light frequency) IR LED's typically have a voltage drop around 900mV.In the picture of the totempole TTL output wraper posted, you can see that Q3 is turned off at some point. If Q4 has a leakage current that is higher then the turned off Q3, then the difference comes from the output, even though the output is "high", and the extra pullup resistor allows for some leakage current before anything goes trough the optocoupler.Leakage current is also highly dependent on temperature. It usually doubles with each 10degree c temperature rise. This means that at 80deg.c (not unreasonably hot) it's 64 times higher then at room temperature, and it's 256 times higher at 100C.Add to that that voltage drop over diodes also gets lower with higher temperatures and the problem gets even worse, or at least more unpredictable.So such an extra pullup resistor can easily be the difference between "it works" (on your bench) and "it works" (reliably over the full temperature range and other unforseen circumstances such as induced noise by long wires).

author: TimFox
author_rank: Super Contributor
timestamp: June 10, 2022, 05:04:21 pm
content: Luckily, when properly chosen, the extra pull-up resistor is cheap, dissipates very little extra power, and takes up very little board space.

author: gamalot
author_rank: Super Contributor
timestamp: June 10, 2022, 06:24:25 pm
content: I think the R3 is not necessary at all.If you read the datasheet for a TTL gate device, you might see that the logic high output could drops down to 2.4V, but, obviously, it only happens when sourcing current reaches its limit.It sinks current when driving the optocoupler between VCC and the output pin, so there is no need to worry about the output voltage dropping.

author: wraper
author_rank: Unknown
timestamp: June 10, 2022, 06:35:28 pm
content: Quote from: TimFox on June 10, 2022, 05:04:21 pmAnd does literally nothing useful.

author: TimFox
author_rank: Super Contributor
timestamp: June 10, 2022, 06:56:24 pm
content: Quote from: wraper on June 10, 2022, 06:35:28 pmIn which case, mark the drawing "do not stuff" or similar. Who knows, you may need it later.

author: CaptDon
author_rank: Super Contributor
timestamp: June 10, 2022, 07:19:35 pm
content: For the old TTL stuff those pullup resistors were very common and with open collector outputs they helped square up the output signal of the optocoupler and overcome any leakage. In many of the modern TTL buffer families which won't ever be operated in the 'open' tri-state mode those pullups aren't needed since the buffers can both source and sink currents approaching 20ma. It is interesting to see octal buffers with all inputs in parallel and all outputs in parallel driving the gate of a power mosfet of the 'logic level' type which can show full drain to source saturation at about 4.5 volts gate to source. I have a 400hz avionics power supply that was built that way. The gate drive waveforms (it is a push/pull primary on the output transformer) are stored in an eprom and the waveforms include the deadband during switching. An early 80's Martin-Marietta unit.

author: wraper
author_rank: Unknown
timestamp: June 10, 2022, 07:32:08 pm
content: Quote from: CaptDon on June 10, 2022, 07:19:35 pmI wonder how it can possibly square up anything when phototransistor in optocoupler is super slow compared to anything else in the circuit.

author: CaptDon
author_rank: Super Contributor
timestamp: June 10, 2022, 07:50:32 pm
content: Depends what optocoupler you are looking at. Some can run data at over 100Khz baud and others with the logic output I believe can support data rates over 1Mhz. There is one particular amplifier that I work on using opto's at 500Khz. They are used for isolation and the signal is 5% to 95% PWM. Yes 4N35's are probably dog slow.

author: wraper
author_rank: Unknown
timestamp: June 10, 2022, 08:04:58 pm
content: Quote from: CaptDon on June 10, 2022, 07:50:32 pmAFAIK any fast optocoupler has a circuit with a separate power, and receiver is a photodiode + some sort of "amplifier". Not just a phototransistor.

author: gamalot
author_rank: Super Contributor
timestamp: June 10, 2022, 08:28:07 pm
content: Quote from: CaptDon on June 10, 2022, 07:19:35 pmYou're right, the pull-up resistor does make the voltage waveform at the output pin look better, but in the example being discussed here, the output voltage doesn't need to be a strictly square wave, the focus is on the current through the LED, and the extra resistor R3 doesn't really have a noticeable effect on the current.