Sully Station Technologies
Home Store Circuit Library Datasheets Contact

Parts, tools and supplies for the electronics experimenter.

NPN Transistor XOR Gate Circuit

  • Concept of Operation

    An electronic XOR (Exclusive OR) gate performs the digital logic XOR function. This function is generally similar to the standard OR function with one critical difference. For both OR and XOR, the output is high when either of the two inputs are high, and when both inputs are low, the output is low. However when both inputs are high, the standard OR circuit will be high but the XOR circuit will be low. A quick look at an implementation of an OR gate reveals that this difference adds a good deal of complexity to the circuit. As can be seen in the logic diagram below, the XOR gate is built by combining three more simple gates, the OR gate, the NAND gate and the AND gate to produce the desired result.

    The example transistor XOR gate circuit is implemented here using PN2222A NPN transistors (a variant of the 2N2222A) but many common NPN bipolar junction transistors could be substituted.

  • Logic Diagram

  • Schematic

  • Breadboard Diagram

  • Parts

    • PN2222A - NPN General Purpose Transistor (x6)
    • 10K Resistor (x6)
    • 1K Resistor (x3)
    • Green 5v LED (x1)
    • Tactile Pushbutton Switch (x2)

    (All parts for the project are available in our store.)

  • Truth Table

    In Out
    0 0 0
    0 1 1
    1 0 1
    1 1 0
  • PN2222A Pinout

  • Notes on Implementation

    1. The LEDs used in the project have a built in current limiting resistor eliminating the need for an external resistor to protect the device. This resistor is shown in the schematic as a resistor with the value “Lim” for completeness.
    2. The circuit was built and tested at 4.8 volts DC (4 AA NiMH rechargeable batteries).