Ugenz Academy/IoT Tutorial

Logic Gates And Truth Tables

8 min read1,490 words

Reading progress

Keep learning

Logic Gates and Truth Tables

1. Introduction

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

A logic gate works with two binary values:

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

The exact voltage represented by 0 or 1 depends on the digital logic family and circuit design.

Logic gates are used in computers, calculators, microcontrollers, memory systems, control circuits, and other digital devices.

2. What Is a Truth Table?

A truth table is a table that shows the output of a logic gate for every possible combination of its inputs.

For example, a gate with one input has two possible input combinations: 0 and 1. A gate with two inputs has four combinations.

For nn binary inputs, the number of possible input combinations is:

2n\boxed{2^n}

For two inputs, AA and BB, the four combinations are 00, 01, 10, and 11.

Input AInput B
00
01
10
11

A truth table helps us understand, design, and test digital circuits.

3. AND Gate

Sum of Product - Electronics-Lab

electronics-lab.com

The AND gate produces an output of 1 only when all inputs are 1. If any input is 0, the output is 0.

Boolean expression

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

Here, AA and BB are inputs, and YY is the output.

Truth table

ABOutput YY
000
010
100
111

Explanation: The AND gate behaves like a system that requires two conditions to be true simultaneously. For example, a machine may operate only when both its safety switch and start switch are ON.

4. OR Gate

The OR gate produces an output of 1 when at least one input is 1. Its output is 0 only when all inputs are 0.

Boolean expression

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

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

Truth table

ABOutput YY
000
011
101
111

Explanation: An alarm could be activated when either a smoke sensor or a temperature sensor detects a dangerous condition.

5. NOT Gate

Not Gate - 1200x500 PNG Download - PNGkit

pngkit.com

The NOT gate, also called an inverter, has one input and produces the opposite value at its output.

  • Input 0 produces output 1.
  • Input 1 produces output 0.

Boolean expression

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

The bar over AA represents logical NOT.

Truth table

AOutput YY
01
10

Explanation: If a signal indicates that a condition is false, a NOT gate can reverse that signal to represent the opposite condition.

6. NAND Gate

NAND Gate

de-iitr.vlabs.ac.in

The NAND gate is the opposite of an AND gate. Its name comes from “NOT AND.”

It produces 0 only when all inputs are 1. In every other case, the output is 1.

Boolean expression

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

Truth table

ABOutput YY
001
011
101
110

Explanation: A NAND gate combines an AND operation with an inversion at the output.

NAND is called a universal gate because any basic logic operation, including AND, OR, and NOT, can be constructed using only NAND gates.

7. NOR Gate

File:Nor-gate-en.svg - Wikimedia Commons

commons.wikimedia.org

The NOR gate is the opposite of an OR gate. Its name comes from “NOT OR.”

It produces 1 only when all inputs are 0. If any input is 1, the output is 0.

Boolean expression

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

Truth table

ABOutput YY
001
010
100
110

Explanation: A NOR gate first performs an OR operation and then inverts its result.

NOR is also a universal gate, meaning complete digital logic circuits can be built using only NOR gates.

8. XOR Gate (Exclusive OR)

The XOR gate produces 1 when its two inputs are different. When both inputs are the same, the output is 0.

XOR stands for Exclusive OR.

Boolean expression

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

It can also be expressed as:

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

Truth table

ABOutput YY
000
011
101
110

Explanation: XOR detects whether two binary inputs differ. It is used in binary adders, parity generators, and error-detection circuits.

For example, in a half adder, the XOR gate produces the Sum output.

9. XNOR Gate (Exclusive NOR)

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

vedantu.com

The XNOR gate is the opposite of an XOR gate. It produces 1 when its inputs are equal and 0 when they are different.

Boolean expression

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

Another expression is:

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

Truth table

ABOutput YY
001
010
100
111

Explanation: XNOR is useful for checking whether two binary bits are equal. It is used in digital comparators and equality-detection circuits.

10. Comparison of All Basic Logic Gates

Logic gateBoolean expressionOutput is 1 when…
ANDY=ABY=ABBoth inputs are 1
ORY=A+BY=A+BAt least one input is 1
NOTY=A‾Y=\overline AInput is 0
NANDY=AB‾Y=\overline{AB}At least one input is 0
NORY=A+B‾Y=\overline{A+B}Both inputs are 0
XORY=A⊕BY=A\oplus BInputs are different
XNORY=A⊕B‾Y=\overline{A\oplus B}Inputs are equal

11. Combined Truth Table

The following table compares all seven basic logic gates for every possible combination of two inputs, AA and BB. For the NOT gate, the output shown is the inversion of input AA.

ABANDORNANDNORXORXNORNOT A
000011011
010110101
100110100
111100010

12. Applications of Logic Gates

Logic gates are used in many digital electronic systems.

  • Computers and processors: Perform arithmetic, logical operations, and data processing.
  • Calculators: Perform binary calculations using digital circuits.
  • Memory circuits: Store and control digital information.
  • Security systems: Combine sensor signals to control alarms and access systems.
  • IoT devices: Process signals from sensors and control outputs such as LEDs, buzzers, and relays.
  • Communication systems: Support encoding, decoding, and error detection.
  • Digital comparators: Compare binary values to determine whether they are equal or different.

13. Summary

Logic gates perform basic Boolean operations on binary inputs. Truth tables describe their outputs for all possible input combinations.

The seven basic gates are AND, OR, NOT, NAND, NOR, XOR, and XNOR. Among them, NAND and NOR are universal gates because either one can be used alone to construct any Boolean logic function.

These gates form the foundation of digital electronics and are combined to build adders, subtractors, multiplexers, counters, processors, and other digital circuits.

Keep learning. Keep building. Keep growing.

© 2026 Ugenz Academy