A diode logic OR gate outputs a HIGH signal if any of its inputs are HIGH, utilizing the one-way current flow of semiconductor junctions rather than complex transistor arrays. The safest default build for 5V systems uses 1N4148 switching diodes (100V, 300mA) for the logic elements and a 10kΩ pull-down resistor to ground. For 3.3V microcontrollers like the ESP32, you must swap to BAT54 Schottky diodes to prevent voltage drop failures. While integrated circuits (like the 74HC32) have replaced discrete diode logic for heavy computing, the diode OR gate remains a staple on the workbench for power OR-ing, sensor multiplexing, and simple interrupt routing.
Schematic Symbol, Pinout, and Signal Flow
Unlike integrated logic gates with dedicated VCC and GND pins, a discrete diode OR gate is built from individual components. The "pinout" is defined by the physical orientation of the diodes and the resistor network.
- Inputs (Anodes): The anode (non-banded end) of each diode connects to a separate input signal source.
- Output Node (Cathodes): The cathodes (banded end) of all diodes are tied together at a single junction. This junction is the gate's output.
- Pull-Down Resistor: A resistor (typically 10kΩ) connects the output node to circuit ground (GND). This is mandatory; without it, the output node floats when all inputs are LOW, leading to erratic logic states.
When any input goes HIGH, current flows through that diode's anode to the cathode, pulling the output node HIGH. The other diodes become reverse-biased, effectively blocking their respective LOW inputs from dragging the output down.
Operation Regions and Logic States
Understanding the forward voltage drop ($V_f$) is critical. A standard silicon diode drops about 0.7V when conducting. This means your output HIGH voltage will always be roughly 0.7V lower than your input HIGH voltage.
| Input A | Input B | D1 State | D2 State | Output Voltage (5V Logic) | Logic State |
|---|---|---|---|---|---|
| LOW (0V) | LOW (0V) | Reverse Biased (Off) | Reverse Biased (Off) | 0V (pulled to GND via 10kΩ) | LOW |
| HIGH (5V) | LOW (0V) | Forward Biased (On) | Reverse Biased (Off) | ~4.3V (5V - 0.7V $V_f$) | HIGH |
| LOW (0V) | HIGH (5V) | Reverse Biased (Off) | Forward Biased (On) | ~4.3V (5V - 0.7V $V_f$) | HIGH |
| HIGH (5V) | HIGH (5V) | Forward Biased (On) | Forward Biased (On) | ~4.3V (Current shared) | HIGH |
Component Selection: Biasing and the 3.3V Gotcha
Selecting the right diode and pull-down resistor requires balancing power consumption, switching speed, and logic thresholds.
The Pull-Down Resistor Calculation
The pull-down resistor must be low enough to sink leakage current and overcome parasitic capacitance, but high enough to avoid wasting power when an input is HIGH. A 10kΩ resistor is the standard default. If an input is 5V, the output is 4.3V. The current through the resistor is $I = V / R = 4.3V / 10,000\Omega = 0.43mA$. This is highly efficient. If you are driving a long wire with high capacitance, drop the resistor to 4.7kΩ to improve the rising edge speed (reducing the RC time constant).
If you are feeding an ESP32 or Raspberry Pi Pico (3.3V logic), do not use standard 1N4148 silicon diodes. A 3.3V HIGH input minus a 0.7V $V_f$ leaves you with 2.6V at the output. The ESP32's Input High Voltage ($V_{IH}$) threshold is typically 0.75 × VDD, which equals 2.475V. Your 2.6V output is dangerously close to the threshold and will cause intermittent missed interrupts due to thermal drift or noise. The fix: Use a BAT54 Schottky diode, which has a $V_f$ of only ~0.3V. This yields a robust 3.0V output, well above the 2.475V threshold.
Application Circuit: Dual-Sensor ESP32 Wake-Up
Let's build a practical circuit: routing two remote 3.3V PIR motion sensors into a single ESP32 GPIO pin (GPIO33) to wake the microcontroller from deep sleep. Either sensor triggering will wake the board.
Bill of Materials:
- 2x BAT54 Schottky Diodes (SMD or through-hole equivalent like 1N5819 if space permits)
- 1x 10kΩ 1/4W Resistor
- 1x ESP32 DevKit V1
- 2x 3.3V PIR Sensors (e.g., AM312)
- Wire Sensor 1: Connect the AM312 OUT pin to the anode of Diode 1 (D1).
- Wire Sensor 2: Connect the second AM312 OUT pin to the anode of Diode 2 (D2).
- Tie the Cathodes: Connect the cathodes (banded end) of D1 and D2 together on your breadboard or PCB. This junction is your
OR_OUTPUT. - Install Pull-Down: Connect one leg of the 10kΩ resistor to the
OR_OUTPUTjunction, and the other leg to circuit GND. - Route to ESP32: Connect the
OR_OUTPUTjunction to ESP32 GPIO33 (an RTC-capable wake pin). - Configure Firmware: In your ESP32 Arduino or ESP-IDF code, configure GPIO33 as an input with no internal pull-up or pull-down (the external 10kΩ handles this), and set the wake trigger to
ESP_SLEEP_WAKEUP_EXT0on a HIGH state.
Failure Modes and Multimeter Diagnostics
Discrete logic is robust, but it fails in specific, predictable ways. Here is how to troubleshoot the circuit using a digital multimeter (DMM).
Symptom: Output is stuck HIGH regardless of inputs
Cause: A shorted diode or a missing/floating ground on the pull-down resistor.
Test: Set your DMM to continuity mode. With power removed, probe from the output node to GND. You should read ~10kΩ. If you read near 0Ω, a diode has failed short (rare) or the resistor is blown. If you read infinite (OL), the pull-down resistor is disconnected, leaving the node floating and susceptible to picking up ambient EMI, which the MCU interprets as HIGH.
Symptom: One input is ignored (Output stays LOW when Sensor 1 triggers, but works for Sensor 2)
Cause: Open diode or broken trace on the ignored input leg.
Test: Set the DMM to Diode Test mode (the diode symbol). Place the red probe on the input side (anode) and the black probe on the output side (cathode). A healthy BAT54 will read 0.25V to 0.35V. A healthy 1N4148 will read 0.5V to 0.7V. If the meter reads "OL" in both directions, the diode is internally open and must be replaced.
Symptom: Inputs are shorted together (Triggering Sensor 1 also back-feeds Sensor 2)
Cause: Diodes installed backward (cathodes to inputs, anodes tied together).
Test: Visually inspect the band on the diode. The band must face the output node. If installed backward, the diodes act as a simple wire OR-ing the inputs together, allowing current to flow backward into the inactive sensor's output pin, potentially damaging it.
Frequently Asked Questions
Can I cascade multiple diode logic OR gates together?
No, not without buffering. Because each diode introduces a forward voltage drop ($V_f$), cascading them accumulates the voltage loss. If you feed a 5V signal through two series diode OR gates, you lose 1.4V, leaving only 3.6V. By the third stage, the voltage drops below standard TTL/CMOS HIGH thresholds. If you need complex, multi-stage logic, use a dedicated IC like the 74HC32 quad OR gate, or buffer the discrete diode output with a single NPN transistor or a Schmitt-trigger inverter (like the 74HC14) to restore the logic levels.
Why does my diode OR gate output read 1.2V when both inputs are LOW?
This is almost always caused by a conflict with microcontroller internal pull-ups. If your ESP32 or Arduino GPIO pin is configured with an internal pull-up resistor enabled in software, it will back-feed current through the pull-down resistor, creating a voltage divider. The 1.2V you are reading is the result of the MCU's internal ~40kΩ pull-up fighting your external 10kΩ pull-down. Ensure your GPIO is configured as a standard high-impedance input (INPUT in Arduino, not INPUT_PULLUP) and let the external 10kΩ resistor define the default LOW state.
What is the difference between a signal OR gate and a power OR-ing circuit?
While the topology is similar, the component selection is entirely different. A signal OR gate (like the ESP32 circuit above) uses fast switching diodes (1N4148/BAT54) and requires a pull-down resistor to define the LOW state. A power OR-ing circuit (used to combine two 12V battery sources or redundant power supplies) uses high-current Schottky diodes (like the 1N5822 or MBR2045) to minimize heat from the $V_f$ drop, and does not use a pull-down resistor. In power OR-ing, the load itself (e.g., a motor or a buck converter) acts as the pull-down. Never use signal diodes for power OR-ing; the 300mA maximum continuous current rating of a 1N4148 will result in a melted glass envelope and a shorted power bus.






