Simple way to invert a tristate output
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.







simulate this circuit &ndash; Schematic created using CircuitLab