user88062: I need a circuit where an Arduino MCU can set an output to 3 different states.

HIGH (12V)
LOW (GND)
N/A (completely disconnected)

Using transistors seems to be the correct way but I am too much of a noob in this area to be sure.
I’ve been researching “tri-state” online but there seems to be different meanings of this.
I’d appreciate a circuit for this or information that can get me on the right track.
Update:
I did test this schematic and it almost works. Although in the high state I got 2.7V output when the input was 12V. Very odd. I used two NPN transistors.
This is a half h-bridge, right?


user7508: The simplest solution could probably be an H-bridge, like the ones you
have on motor driver shields. Actually you only need half an H-bridge.
You will typically be driving two inputs of the chip: “input 1” and
“enable”:

if you set “enable” to LOW the bridge output will be in the high
impedance state (your “completely disconnected” state)
if you set “enable” to HIGH, the output will be HIGH or LOW,
mirroring “input 1”.

Edit: your transistor circuit looks slightly similar to half an
H-bridge. However, in order to operate from 12 V, you typically need at
least three transistors, one of them being a PNP. See for example this
discussion in the Arduino forum. I suggest you use a ready-built
H-bridge, as this will simplify things for you.

88062: <p>I need a circuit where an Arduino MCU can set an output to 3 different states.</p>
<ul>
<li>HIGH (12V)</li>
<li>LOW (GND)</li>
<li>N/A (completely disconnected)</li>
</ul>
<p>Using transistors seems to be the correct way but I am too much of a noob in this area to be sure.</p>
<p>I’ve been researching “tri-state” online but there seems to be different meanings of this.</p>
<p>I’d appreciate a circuit for this or information that can get me on the right track.</p>
<p>Update:</p>
<p>I did test this schematic and it almost works. Although in the high state I got 2.7V output when the input was 12V. Very odd. I used two NPN transistors.</p>
<p>This is a half h-bridge, right?</p>
<p><a href="https://i.stack.imgur.com/M588G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M588G.png" alt="circuit schematic" /></a></p>
 7508: <p>The simplest solution could probably be an H-bridge, like the ones you
have on motor driver shields. Actually you only need half an H-bridge.
You will typically be driving two inputs of the chip: “input 1” and
“enable”:</p>
<ul>
<li>if you set “enable” to <code>LOW</code> the bridge output will be in the high
impedance state (your “completely disconnected” state)</li>
<li>if you set “enable” to <code>HIGH</code>, the output will be <code>HIGH</code> or <code>LOW</code>,
mirroring “input 1”.</li>
</ul>
<p><strong>Edit</strong>: your transistor circuit looks slightly similar to half an
H-bridge. However, in order to operate from 12 V, you typically need at
least three transistors, one of them being a PNP. See for example <a href="https://forum.arduino.cc/t/custom-h-bridge-circuit-not-working-when-adding-motor/379745" rel="nofollow noreferrer">this
discussion</a> in the Arduino forum. I suggest you use a ready-built
H-bridge, as this will simplify things for you.</p>
