Logic gates OR, AND, and NOT are the fundamental digital building blocks that output a high (1) or low (0) voltage based on specific Boolean rules applied to their input pins. In a real circuit, these ICs act as deterministic digital valves—they change a parallel or continuous set of input voltage states into a single, predictable output signal, allowing you to route, block, or invert data and control lines without needing a microcontroller. While software can handle complex logic, hardware logic gates operate at nanosecond speeds with zero boot time, making them indispensable for safety interlocks, signal conditioning, and high-speed digital routing.

The Core Truth Tables and 74HC IC Specifications

When selecting physical ICs for your breadboard or PCB, the 74HC (High-speed CMOS) family is the modern standard for 3.3V and 5V hobbyist and industrial designs. Unlike the older 74LS (TTL) family, 74HC chips draw microamps of quiescent current and accept a wider voltage range (2V to 6V). To understand how they behave, we map their inputs to outputs using truth tables. Think of an AND gate like two switches in series (both must close for current to flow), while an OR gate is like two switches in parallel (either one closes the circuit). The NOT gate is simply a single switch that inverts the state.

Truth Tables for Basic Logic Gates
Input AInput BNOT (A)AND (A & B)OR (A | B)
0 (Low)0 (Low)1 (High)0 (Low)0 (Low)
0 (Low)1 (High)1 (High)0 (Low)1 (High)
1 (High)0 (Low)0 (Low)0 (Low)1 (High)
1 (High)1 (High)0 (Low)1 (High)1 (High)

Knowing the logic is only half the battle; you must also respect the physical limitations of the silicon. Below are the real-world specifications for the most common DIP-14 and SOIC-14 packages you will encounter, based on the Texas Instruments SN74HC series datasheets.

74HC Logic IC Real-World Specifications (at VCC = 5V, 25°C)
Parameter74HC04 (Hex NOT)74HC08 (Quad AND)74HC32 (Quad OR)
Supply Voltage (VCC)2.0V to 6.0V2.0V to 6.0V2.0V to 6.0V
Quiescent Current (Icc)20 µA (max)20 µA (max)20 µA (max)
Propagation Delay (tpd)18 ns (typ)18 ns (typ)18 ns (typ)
Output Drive Current±5.2 mA±5.2 mA±5.2 mA
Max Fan-out (LS-TTL)10 LSTTL loads10 LSTTL loads10 LSTTL loads

Worked Example: Calculating Cascade Delay and Power Draw

Let us look at a practical scenario where you cascade multiple gates. Suppose you are building a hardware debounce circuit for a mechanical limit switch, feeding the cleaned signal into an AND gate to act as a safety enable for a motor driver. The signal passes through two NOT gates (configured as a Schmitt trigger buffer) and then one AND gate, totaling three logic stages in series.

Propagation Delay Calculation:
According to the All About Circuits digital logic guide, signals do not traverse gates instantly. At 5V, the typical propagation delay (tpd) for a 74HC gate is 18 nanoseconds.
  • Stage 1 (NOT): 18 ns
  • Stage 2 (NOT): 18 ns
  • Stage 3 (AND): 18 ns
  • Total Cascade Delay: 18 ns + 18 ns + 18 ns = 54 ns
If your motor driver requires a minimum 50ns setup time before the PWM signal arrives, this 54ns delay safely satisfies the timing requirement without needing a software delay loop.

Dynamic Power Dissipation:
CMOS gates draw almost zero current when static, but they draw current spikes when switching states to charge and discharge internal and external parasitic capacitance. The formula for dynamic power is P = f × C × V².
Assume your AND gate output is driving a 10 pF capacitive load (like a long PCB trace or a MOSFET gate) at a switching frequency of 1 MHz (1,000,000 Hz) at 5V.

  • P = 1,000,000 Hz × (10 × 10⁻¹² F) × (5V)²
  • P = 1,000,000 × 0.00000000001 × 25
  • P = 0.00025 Watts (0.25 mW)
This is negligible for a single gate, but if you are switching a 32-bit bus at 50 MHz, that dynamic power scales up rapidly, which is why high-speed digital designers use lower voltages (like 3.3V or 1.8V) to keep V² small.

Where You Meet Logic Gates OR AND NOT in Practice

While microcontrollers handle complex algorithms, hardware logic gates are used where speed, reliability, or simplicity is paramount. Here is where you will actively deploy these components on the bench:

  • Safety Interlocks (AND): If a CNC machine requires both the enclosure door switch (Input A) and the emergency stop reset (Input B) to be closed before the spindle relay engages, an AND gate provides a hardwired, unhackable interlock. If either input drops low, the output immediately goes low, cutting power to the contactor coil.
  • Alarm Aggregation (OR): In a solar battery bank, you might have three separate fault signals: over-voltage, under-voltage, and over-temperature. Feeding these three active-high fault lines into a multi-input OR gate creates a single 'Master Fault' line that can trigger a relay to disconnect the load, saving GPIO pins on your BMS microcontroller.
  • Signal Inversion and Level Shifting (NOT): Many legacy sensors and reset pins are 'active-low' (they trigger when pulled to ground). If your ESP32 GPIO is configured to trigger an interrupt on a rising edge (active-high), passing the sensor signal through a 74HC04 NOT gate inverts the logic, matching the sensor's behavior to the microcontroller's interrupt configuration without rewriting firmware.

Common Wiring Mistakes and Floating Input Hazards

What people commonly confuse with basic AND/OR logic is the physical reality of CMOS inputs. In software, an unassigned variable might just default to zero. In hardware, an unconnected (floating) CMOS input is a recipe for destruction.

The Floating Input Hazard:
CMOS inputs have incredibly high impedance (often >10¹² ohms). If you leave an input pin on a 74HC08 AND gate disconnected, it acts like an antenna, picking up ambient electromagnetic noise. This causes the internal transistors to rapidly switch back and forth between high and low states. This oscillation draws massive amounts of current—often exceeding the IC's thermal limits—and causes the chip to overheat, fail, or inject noise into your shared VCC rail. Never leave a CMOS input floating. Always tie unused inputs to VCC or GND using a 10kΩ resistor, or directly if the datasheet permits.

Warning: Active-Low Logic Confusion
Beginners often confuse standard AND gates with NAND gates when reading schematics. If you see an AND gate symbol with a small circle (a 'bubble') on the output, that is a NAND gate. Similarly, bubbles on the inputs indicate active-low logic (NOR or negative-AND). Always verify the exact part number (e.g., 74HC00 is NAND, 74HC08 is AND) against the manufacturer datasheet, such as the NXP 74HC08 datasheet, before wiring your board.

Exceeding Fan-Out and Capacitive Loading:
While CMOS gates have nearly infinite DC fan-out (they draw almost no input current), they have strict AC fan-out limits. Every input pin you connect adds roughly 3 pF to 5 pF of capacitance. If you wire one 74HC04 NOT gate output to twenty other gate inputs, the total capacitive load might exceed 100 pF. This slows down the rise and fall times of the signal, turning a crisp square wave into a sluggish triangle wave, which can cause double-triggering in downstream clock circuits. If you need to drive many inputs, use a dedicated buffer IC like the 74HC244 instead of daisy-chaining basic logic gates.

Quick Reference FAQ

Can I power a 74HC logic gate with 3.3V from an ESP32?
Yes. The 74HC family operates from 2.0V to 6.0V. At 3.3V, the logic high threshold (VIH) is typically around 2.3V, which the ESP32's 3.3V GPIO easily satisfies. However, propagation delay will increase slightly (to roughly 25ns) compared to 5V operation.

What happens if I connect a 5V output to a 3.3V logic input?
You risk damaging the 3.3V IC. Standard 74HC inputs are not 5V tolerant when powered at 3.3V. Use a level shifter, a voltage divider, or switch to the 74HCT or 74LVC families, which have specific 5V-tolerant input architectures.