Ugenz Academy/IoT Tutorial

Logic Gates

13 min read2,408 words

Reading progress

Keep learning

Logic Gates

1. What Are Logic Gates?

Logic gates are the basic building blocks of digital electronics. They perform logical operations on binary inputs and produce a binary output.

Digital circuits work with two logic states:

  • Logic 0 (LOW): Usually represents a low voltage.
  • Logic 1 (HIGH): Usually represents a high voltage.

The actual voltage levels depend on the technology used, such as TTL or CMOS. Logic 0 does not always mean exactly 0 V, and logic 1 does not always mean exactly 5 V.

Logic gates are used in computers, calculators, microcontrollers, memory devices, digital clocks, and many other electronic systems.

Integrated Circuit Symbol: Types & Circuit Diagram Examples

OR Gate Circuit Diagram using IC 74LS32

Circuit design COMPUERTAS LOGICAS - Tinkercad

7

For example, imagine a circuit that turns on an output only when two switches are ON. An AND gate can perform this operation.

If either switch is OFF, the output is 0. When both switches are ON, the output is 1.

2. Binary Logic and Boolean Algebra

Logic gates operate using Boolean algebra, a mathematical system that works with two values: 0 and 1.

The main Boolean operations are:

OperationSymbol commonly usedMeaning
ANDA⋅BA\cdot BOutput is 1 only when both inputs are 1
ORA+BA+BOutput is 1 when at least one input is 1
NOTA‾\overline{A}Reverses the input
XORA⊕BA\oplus BOutput is 1 when the inputs differ
XNORA⊕B‾\overline{A\oplus B}Output is 1 when the inputs are the same

Here, AA and BB represent input signals, and YY represents the output.

Boolean expressions describe how a logic gate works. A truth table lists every possible input combination and the output produced by each combination.

For two inputs, there are four possible combinations: 00, 01, 10, and 11.

3. AND Gate

An AND gate produces an output of 1 only when all its inputs are 1.

Sum of Product - Electronics-Lab

electronics-lab.com

Boolean expression

Y=A⋅B\boxed{Y=A\cdot B}

The dot represents the AND operation.

Truth table

Input AInput BOutput Y
000
010
100
111

Working principle

  • If A is 0 and B is 0, the output is 0.
  • If A is 0 and B is 1, the output is 0.
  • If A is 1 and B is 0, the output is 0.
  • If both A and B are 1, the output is 1.

Example

Imagine a machine that runs only when its power switch and safety switch are both ON.

  • Power switch = 1
  • Safety switch = 1
  • Machine output = 1

If either switch is OFF, the machine output becomes 0.

Applications: Safety interlocks, digital control systems, condition checking, and enable circuits.

4. OR Gate

An OR gate produces an output of 1 when at least one input is 1.

PPT - Chapter 3 – Describing Logic Circuits PowerPoint Presentation, free download - ID:7042267

slideserve.com

Boolean expression

Y=A+B\boxed{Y=A+B}

The plus sign represents the OR operation in Boolean algebra, not ordinary arithmetic addition.

Truth table

Input AInput BOutput Y
000
011
101
111

Working principle

The output remains 0 only when both inputs are 0. If either input or both inputs become 1, the output becomes 1.

Example

Imagine an alarm that activates when either a door sensor or a window sensor detects an intrusion.

Y=A+BY=A+B

If either sensor is activated, the alarm output becomes 1.

Applications: Alarm systems, event detection, control circuits, and combining digital signals.

5. NOT Gate

A NOT gate has only one input and reverses its logic state. It is also called an inverter.

Logic Gates - Types, Truth Table, Circuit, and Working

electronicsforu.com

Boolean expression

Y=A‾\boxed{Y=\overline{A}}

The bar above A means NOT A.

Truth table

Input AOutput Y
01
10

Working principle

  • When the input is 0, the output becomes 1.
  • When the input is 1, the output becomes 0.

The small circle at the output of the NOT-gate symbol represents inversion.

Example

Suppose a circuit should turn on a warning LED when a sensor's digital output is LOW.

A NOT gate can invert that sensor signal so the warning LED's control signal becomes HIGH when the sensor output is LOW.

Applications: Signal inversion, active-LOW control, digital circuits, and Boolean logic design.

6. NAND Gate

A NAND gate is an AND gate followed by a NOT operation. Its output is the opposite of the AND gate's output.

Primary Logic Gates and Fact Tables - handla.it

handla.it

Boolean expression

Y=A⋅B‾\boxed{Y=\overline{A\cdot B}}

Truth table

Input AInput BOutput Y
001
011
101
110

Working principle

The output is 1 for every input combination except when both inputs are 1.

This makes NAND the opposite of AND.

Example

Suppose a digital output must remain HIGH until two conditions are simultaneously satisfied. A NAND gate can produce a LOW output when both conditions become HIGH.

Why NAND gates are important

NAND is called a universal gate because any Boolean logic circuit can be constructed using only NAND gates.

For example:

  • NOT using NAND: connect both inputs to A.
  • AND using NAND: use a NAND gate followed by another NAND configured as an inverter.
  • OR using NAND: invert each input using NAND gates and combine them with another NAND gate.

Applications: Digital processors, memory circuits, control logic, and general-purpose logic design.

7. NOR Gate

A NOR gate is an OR gate followed by a NOT operation.

Logic Gates - Types, Truth Table, Circuit, and Working

electronicsforu.com

Boolean expression

Y=A+B‾\boxed{Y=\overline{A+B}}

Truth table

Input AInput BOutput Y
001
010
100
110

Working principle

The output is 1 only when every input is 0. If any input becomes 1, the output becomes 0.

Example

A circuit uses two fault signals, A and B. The NOR output becomes HIGH only when neither fault signal is active.

Why NOR gates are important

NOR is another universal gate. Like NAND, it can be used alone to construct NOT, AND, OR, and more complex Boolean circuits.

Applications: Control systems, digital memory, alarm logic, and electronic switching circuits.

8. XOR Gate (Exclusive OR)

An XOR gate produces an output of 1 when its inputs are different.

Combination of Basic Logic gates — Electronics Class Notes

people.iitism.ac.in

Boolean expression

Y=A⊕B\boxed{Y=A\oplus B}

For two inputs, XOR can also be written as:

Y=A‾B+AB‾Y=\overline{A}B+A\overline{B}

Truth table

Input AInput BOutput Y
000
011
101
110

Working principle

  • Equal inputs produce 0.
  • Different inputs produce 1.

This is why XOR is often described as a difference detector.

Example

Suppose two digital signals must be compared. The XOR output becomes HIGH whenever the signals differ.

XOR gates are also important in binary addition. In a half-adder circuit, XOR produces the sum bit:

Sum=A⊕B\text{Sum}=A\oplus B

Applications: Half adders, full adders, parity generation, parity checking, and digital comparison circuits.

9. XNOR Gate (Exclusive NOR)

An XNOR gate is the opposite of an XOR gate. It produces an output of 1 when its inputs are the same.

XNOR Gate: Circuit Diagram, Truth Table, Symbol, Boolean Expression

vedantu.com

Boolean expression

Y=A⊕B‾\boxed{Y=\overline{A\oplus B}}

Another equivalent expression is:

Y=AB+A‾,B‾Y=AB+\overline{A}\\,\overline{B}

Truth table

Input AInput BOutput Y
001
010
100
111

Working principle

  • Equal inputs produce 1.
  • Different inputs produce 0.

Example

Suppose two digital signals represent the same bit position in two binary numbers. An XNOR gate produces 1 if the two bits match.

Applications: Equality comparators, digital data checking, error-detection circuits, and comparison logic.

10. Comparison of All Seven Basic Logic Gates

GateBoolean expressionOutput is 1 when…
ANDABABAll inputs are 1
ORA+BA+BAt least one input is 1
NOTA‾\overline AInput is 0
NANDAB‾\overline{AB}At least one input is 0
NORA+B‾\overline{A+B}All inputs are 0
XORA⊕BA\oplus BInputs differ
XNORA⊕B‾\overline{A\oplus B}Inputs are equal

For the seven common gates with two inputs (except NOT, which has one), the combined truth table is:

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

11. Universal Gates

NAND and NOR are called universal gates because either type can independently implement any Boolean function.

This is useful in digital circuit design because a complete circuit can be built using only one type of gate.

Building gates using NAND

NOT using NAND

GraphicMaths - Combining logic gates

graphicmaths.com

Y=A⋅A‾=A‾Y=\overline{A\cdot A}=\overline A

AND using NAND

First, a NAND gate generates AB‾\overline{AB}. A second NAND gate inverts that result.

Y=AB‾‾=ABY=\overline{\overline{AB}}=AB

OR using NAND

Invert both inputs and combine them using NAND.

Y=A‾⋅B‾‾=A+BY=\overline{\overline A\cdot\overline B}=A+B

Building gates using NOR

NOR gates can also construct the other logic gates.

  • NOT: connect both NOR inputs to A.
  • OR: invert the NOR output using another NOR gate.
  • AND: invert both inputs using NOR gates and combine them with a NOR gate.

This flexibility makes NAND and NOR particularly useful when designing circuits with a limited set of available components.

12. Logic Gates in Integrated Circuits

Logic gates are commonly available inside integrated circuits (ICs).

What 74LS08 AND Gate IC is and How It Works

SN74LS00N | Texas Instruments, 4 2-Input NAND Logic Gate, 14-Pin PDIP | RS

74LS32 Quad 2-Input OR Logic Gate IC - Micro Robotics

Some common examples from the 74-series logic family are:

IC numberFunction
7408Quad 2-input AND gates
7432Quad 2-input OR gates
7404Hex inverter (six NOT gates)
7400Quad 2-input NAND gates
7402Quad 2-input NOR gates
7486Quad 2-input XOR gates

The exact voltage compatibility and electrical characteristics depend on the specific IC family, such as standard TTL, LS-TTL, or CMOS-compatible 74-series parts. Always check the datasheet before connecting an IC to a power supply or microcontroller.

13. Applications of Logic Gates

Logic gates form the foundation of digital electronic systems.

Detailed macro shot showcasing the intricate pathways and components of a modern computer motherboard with a prominent CPU

Computers and processors

Gates perform logical operations, process binary data, and help implement arithmetic operations inside processors.

Digital Quartz Clock Built Using Logic ICs and 7-Segment Displays - Hackster.io

Digital clocks and counters

Logic gates combine with flip-flops and counters to count pulses and control display updates.

C) The digital logic circuit in fig 1 shows a simple alarm...

Security and control systems

AND, OR, and NOT gates combine sensor signals to determine when an alarm or control output should activate.

Arithmetic circuits

XOR, AND, and OR gates help build adders, subtractors, and other circuits that perform binary arithmetic.

14. Logic Gates vs. Transistors

Logic gates and transistors are closely related, but they are not the same thing.

FeatureTransistorLogic gate
What it isAn electronic semiconductor deviceA circuit that performs a logical operation
Main roleCan switch or amplify electrical signalsProcesses binary inputs to produce a logical output
ConstructionSemiconductor structureOften built from several transistors
ExampleMOSFET, BJTAND, OR, NAND, XOR

Transistors are used to build the internal circuits of modern logic gates. Millions or billions of transistor switching elements can work together inside a processor to perform complex digital operations.

Conclusion

Logic gates are the foundation of digital electronics. AND, OR, and NOT perform the basic logical operations, while NAND and NOR are universal gates. XOR and XNOR are especially useful for comparing binary values and performing arithmetic.

By combining logic gates, engineers can build adders, counters, memory circuits, processors, digital controllers, and many other electronic systems.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy