# Tri-state with transistor?

Discussion in 'Electronic Basics' started by FyberOptic, Sep 6, 2006.

1. ### FyberOpticGuest

Hiya folks, I'm not up to speed as well as I probably ought to be on
analog electronics, but I have a particular case where such a thing
might be simpler to implement than adding in a whole 'nother IC for one
logic connection, so I thought I'd ask the smart folks to verify
something for me.

Basically, I want to be able to toggle between tri-state and ground for
a single signal. Here's my impression of how this should work, using
an NPN: I connect my signaling line which will do the toggling to the
transistor base, then tie the signal I want to be able to go into
tri-state to the collector, and then tie the emitter to ground. When
the base goes high, this should make the other signal go low, and when
the base is low, the other signal would theoretically be tri-state.
Correct?

Something I thought that might be an issue, if my above method is even
correct, is that an IC might not be able to source enough power to
operate a transistor. Could this be the case?

The only alternative here is to stick in a tri-state buffer or
something of that sort, just for this one line I need to toggle. I
guess if it's absolutely necessary I can, but there's got to be a way
to tri-state something using more analog methods; I mean, that's what's
happening at some level inside the IC's, after all!

2. ### Randy DayGuest

You're using 'tri-state' a bit differently than the industry norm.
What you're referring to is called 'open-collector'.

True tri-state devices have the following 3 possible output
states:

Active-low (logic 0, output pulled to ground - base-high in
Open ( output is open circuit, base-low in your example)

Active-high(logic 1, output pulled to +V by an upper transistor
in a 'totem pole' arrangement)
Replace 'tri-state' with 'open collector' and you're
absolutely right.
Not usually. Most IC outputs can provide several mA
of current; proper selection of your transistor and
its base resistor will keep you within spec...

Check the datasheet for the IC you have in mind.
Yep. There are also 'open'collector' versions of the
common logic gates available.

HTH

3. ### FyberOpticGuest

So is this to say that "open-collector" is the same as the
high-impedance state something like a buffer or latch goes into when
its output is disabled? From what I gathered from your post, this is
possibly the case, but I'm wanting to make absolute sure. For the
signal I have in mind, I'd want to be able to take it from being forced
'low' (aka tied to ground) to being the equivalent of being
disconnected (or floating, whatever you want to call it).

Hmm, would something like an open-collector inverter be able to perform
the same task I'm referring to? I'd put the toggler line on the input,
and the togglee on the output, and this would supposedly pull the
togglee low when the input was high, and let the togglee float when the
input was low?

4. ### jasenGuest

Yup that'd work , you've just "invented" the open-collector output.

Another trick is to put a diode in series with the ic's output.
That depends on the IC and the transistor.
if it's an issue use two (or more) transistors.

As long as your using small transistors and only switching typical logic
level signals it will not be an issue.

Bye.
Jasen

5. ### Michael BlackGuest

LOgic families usually can supply and source a voltage or current.
That means they switch between a high level and a low level.
"Low" is not an absence of voltage, it is an active positioning of the
output to ground or close to it.

You can't connect anything in parallel, because one may try to be high while
the other gate output is trying to be low (bad for the ICs, and unless
it's really controlled, you don't want the results).

But sometimes you want to be able to select between two outputs connected
to the same point, and devices with tri-state outputs are one solution.
The in effect disconnect the output of the IC, the point that goes
between high and low, from the output pin, so the circuitry connected
to that pin will never know something is connected there. It looks
like the IC is never actually connected to the circuit. Then you
can run the other device connected to that point like nothing else
is there.

This is the high impedance state, the "tri-state" that is neither high
nor low.

An obvious example is a computer data bus, when many devices need
to output to that bus feeding the CPU. Using tri-state devices
ensures that only one device is driving the data bus at a time.

Open collector devices can only provide a low, ie ground or
close to it. But they require some external voltage source in
order to operate, without that voltage there is nothing to pull "low",
even if the transistor could operate without any voltage on the collector.
ICs that provide open collector devices are usually used to drive
external circuitry, where levels will not be at the logic level of
the device. Thus you can provide the needed pull up resistor to
the +supply, the resistor supplying the "high" to the following circuitry.
Or, the open collector device is feeding something that doesn't need
a "high" output, but merely the low. These are things that have
their other side connectoed to the +supply, such as relays and Nixie
tubes, and speakers.

Michael

6. ### FyberOpticGuest

I seem to have a knack for "inventing" things. Maybe next I'll invent
the telephone.
Hey that does sound like an interesting trick indeed. I don't think I
actually have any around, though, but I do have some transistors. I'll
have to check and see if they're the right kind for the job.

Something I was wondering about is whether I need to put a resistor
between the emitter and ground. Or between any of the other transistor
connections, for that matter. I've never connected an IC's output to
ground before, and while I think there might be resistance in the
transistor to prevent a short, I'm not going to go wiring it up and
take a chance on burning everything out just yet!

7. ### FyberOpticGuest

At risk of sounding like an even bigger beginner, I'm afraid I can't
make heads or tales enough out of the datasheets for the transistor
type I have and for the IC I want to activate it with.

My toggler line to the transistor base is coming from a 74LS374 (octal
flip-flop), and the transistors I have are PN2222A. First, I found the
datasheets..

http://info.hobbyengineering.com/specs/Fairchild-PN2222A.pdf#search="PN2222A"

...but as mentioned, I don't understand how to read the charts well
enough to figure out what volts/amps are output from the one and
required for input on the other. I was looking in the "On
Characteristics" of the transistor datasheet, but it says stuff like
50ma at the base and 500 at the collector, then 2v to the right of
that. I don't get what that means, exactly, if that's even what I'm
supposed to be looking at. I looked at the electrical characteristics
for the '374 as well, but I can't find an output current.

Something I did notice about the '374 is that if I'm understanding the
sheet, its active signals are actually around 3.4v, instead of the 5v I
assumed. I've never really looked at the electrical characteristics
for IC's before, and while I know 3.4v is enough to be TTL 'high',
maybe this is just common voltage output for most of'em.

I also want to say thanks to everyone who's replied so far, it's nice
to know there's folks who know their stuff out there willing to help!

8. ### Randy DayGuest

No. A tri-state device can put the output to +V, ground
or open.

Our open-collector (transistor) idea has only two
possible outputs: ground or open.

Here's a drawing of the output stage of a logic gate,
buffer or latch; the 'totem-pole' I mentioned:

Vcc
|
|/
-|
|>
|
+---- output
|
|/
-|
|>
|
|
===
GND
(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)

If the top transistor is turned on, the output is
connected to Vcc (logic 1). If the bottom transistor
is turned on, the output connects to ground (logic 0).
Think of the open-collector circuit as the bottom half
of a tri-state circuit.

If *both* transistors are off, you get the 'open'
state.

If both transistors are ON, you get the 'smoke'
state.

====================
Here's an interesting application for an open-collector
gate: As long as the max. voltage and current are low
enough, a 5v logic gate can control a higher (or lower)

Be sure you read the datasheet on the gate before you
try this, though!

1.5v-18v
|
5v +-+
|\ +-+
-| >O--|
|/
|
===
GND

(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)

9. ### WinfieldGuest

Below is basically what you need. The 2.7K (to 10K) resistor limits the
current fed into the base of the transistor to an acceptable level. e.g.
When the transistor is forward biased, (turned on), the base will be at
about 0.6V. If the chip's output is 3.4V, then the voltage across the
resistor will be 3.4-0.6V=2.8V. 2.8V into a 2.7K resistance will be about
1mA. Anything from about 2.7K to 10K should do the job fine.

.... Fred

5V
|
| +------ 0V / Hi-Z
+------+ |
| | |/
| '374 |---[2.7K to 10K]---| PN2222A
| | |>
+------+ |
| |
=== ===
= =
GND GND

10. ### Jerry RGuest

Be sure to use a resistor in series with the base of your open collector
transistor.

Rb = [ V(high) - 0.6v ] / ( Ic/beta )

....jerry