0

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?

circuit schematic

6
  • Have you tried googling for something like "tri state transistor circuit"? Found this site which seems promising.
    – chrisl
    Commented Dec 18, 2022 at 11:05
  • Thank you, I will check that out! Commented Dec 18, 2022 at 19:18
  • 1
    In your schematic Q1 needs to be an PNP transistor, not NPN. And keep in mind, that you will loose a bit of the voltage on your diode.
    – chrisl
    Commented Dec 18, 2022 at 20:59
  • Thank you, I will try this as well! Commented Dec 20, 2022 at 11:35
  • Q1 will work, it is in the emitter follower configuration. You will lose about 0.7V when fully on. That will be dissipated as heat. The emitter voltage will follow the base voltage but -0.7V lower referencing ground. You will also lose another 0.7V across the diode. If you put 5V on the base you lost about 1.3V across the resistor, something is not correct.
    – Gil
    Commented Dec 22, 2022 at 22:38

3 Answers 3

2

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.

0

Another possibility is a tristate buffer with enable. There are lots available, just make sure the voltage can be 12 volts (eg MC14503B)

2
  • 2
    The MC14503B is not suitable: if supplied with 10 V, its inputs are only guaranteed to read HIGH if they are driven above 7 V. You have to find a tri-state buffer that can drive 12 V while being driven by 5 V logic. H-bridge chips are designed for this: they typically have dual supplies (one for the logic inputs, one for the driver outputs). Commented Dec 19, 2022 at 9:40
  • Thank you for your input Edgar! Commented Dec 20, 2022 at 11:35
0

Another option is to use a pair of opto-mosfets arranged as half bridge. The opto's LEDs could easily be controlled by logic levels.

Another option is to use complementary pair of PNP and NPN transistors again arranges as half bridge (joined collectors as ouput, PNP emitter at +12V, NPN emitter at GND. The NPN transistor is controlled directly; the PNP via an auxiliary small NPN (collector driving the PNP base)

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Dec 12, 2023 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.