← Blocks

Invert a Logic Signal

Signal

Suggested Parts

Overview

Signal polarity mismatches are common at system boundaries. For example, a sensor like the IMD outputs an OK signal, but perhaps the downstream logic would rather capture a FAULT signal - the logical inverse. A single-transistor inverter resolves the mismatch in a small footprint.

An N-channel MOSFET in a common-source configuration inverts a digital logic signal. When the gate is driven high, the MOSFET turns on and pulls the output low. When the gate is low, the MOSFET is off and a pull-up resistor holds the output high.

This approach suits designs where one or two signals need inverting and an N-channel MOSFET is already in use, which avoids adding unique parts to the BOM. For inverting multiple signals, a dedicated gate IC such as the 74HC04 or 74LVC1G04 is a good, compact option.

Circuit description

The input signal drives the gate of Q1 through series resistor R1. Pull-down resistor R3 holds the gate low when the input is floating or high-impedance. Pull-up resistor R2 connects the drain of Q1 to the supply. The output is taken at the drain, and the source is tied to GND.

An N-channel MOSFET acting as a digital signal inverter

Design notes

Gotchas

Input impedance

R1 and R3 form a signal path to ground. This is fine for push-pull (low-impedance) sources. If VinV_\text{in} is fed by a higher-impedance source then care must be taken in selecting the resistors involved. For example, an open-drain output with a pull-up resistor is a common logic-signal source. Here, it is prudent to choose the pulldown to be 3-10x the pullup value. Else, the resulting voltage divider may deny the gate voltage from ever exceeding Vgs thV_\text{gs th}.

In the schematic below, a comparator U1 with an open drain output drives the inverter. Since U1 is open-drain, a pullup resistor RPUR_\text{PU} is required. RPUR_\text{PU} already limits the gate-current, so it does double-duty as the gate resistor. Now there is a current path from VDD to ground through RPUR_\text{PU} and RPDR_\text{PD}, which together create a voltage divider and define the maximum gate voltage. If the resistors are equal then the gate voltage will max-out at 0.5×VDD0.5 \times \text{VDD}, which may be too low to properly drive the MOSFET. Setting RPU=4.7kΩR_\text{PU} = 4.7\text{k}\Omega and RPD=47kΩR_\text{PD} = 47\text{k}\Omega means the gate voltage can reach 0.91×VDD0.91\times \text{VDD} which is likely more acceptable.

Drive is asymmetric

The falling edge is actively pulled low by Q1 (fast), but the rising edge is set by the R2-load RC time constant (slow). For signals above ~400 kHz or into high-capacitance loads, reduce R2 or use a dedicated gate IC.

Meaningful signal names

Account for the inversion in your system-level logic. It is easy to lose track of signal polarity when inverters are added mid-design; document active-high vs. active-low conventions at each node by using meaningful net labels: A common convention is to name the signal by what its HIGH state means. For example, an active-high “OK” signal inverts to a “FAULT”, or OK\overline{\text{OK}} (“NOT OK”) signal. To add the overbar styling in KiCad, type ~{OK} for your label or text.

signal naming conventions