Electronic – Simple way to invert a tristate output

bjtbufferdigital-logiclogic-gatestri-state

I am looking for a simple circuit to invert a tristate output from a microcontroller, hopefully using only BJTs. What I mean by this is that the truth table would look like:

IN   OUT
H    L
L    H
Z    Z

An ordinary inverter circuit / NOT gate will not do, because I don't want current to flow through the output if it isn't flowing through the input.

Best Answer

Here's the simplest bipolar circuit I can think of. When the input is high-z it will float at 2.5V (1/2 the supply voltage) and a current of ~4.5mA will flow down through resistors R1-R4. R1 and R4 keep the Base-Emitter voltages of Q1 and Q2 down to ~0.45V, so both transistors will be off.

When the input is pulled to Ground (or +5V) there is twice as much voltage across R1 and R2 (R3 and R4) so the Base-Emitter voltage goes up to 0.6V or higher and Q1 (Q2) turns on, pulling the output high (low).

I chose low value resistors to get a strong output drive. If your MCU can't provide the required input drive current (~9mA) then just increase all the resistor values while keeping the ratios the same (eg. 1k and 4.7k). If you need to operate on a lower supply voltage then reduce the values of R2 and R3 and/or increase the values of R1 and R4 to get a high-z Base-Emitter voltage of ~0.45V.

schematic

simulate this circuit – Schematic created using CircuitLab