# Transistors as switch

Discussion in 'Electronic Basics' started by Data888, Feb 7, 2004.

1. ### Data888Guest

Hi.
I have some data lines that use 0 or +5v logic. I can connect the line
to the base of the transistor, and a 12v line to the collector to
increase the voltage to run the data longer distances. However, I'm not
sure how to get it back to 5v at the other end. Do I just connect the
12v data line to the base and a 5v line to the collector?
Thanks
Nick

3. ### Data888Guest

20 to 30 meters.

6. ### Keith R. WilliamsGuest

Put a resistor in series with the receiving transistor's base to
limit the current and a resistor from the receiving transistor's
collector to +5V. Depending on how fast you need to go, choose
the base and collector resistors accordingly.

As a quick off-the-cuff stab (sans calculator, so be nice ;-):

+5V
|
+12V .-.
| | |
| R4| |
+5V +---+ '-'
| | | +
.-. .-. | |
R1| | R2| | - +--------o
| | | | ^ CR1 +
'-' '-' | R3 |
| | | transmission line ___ |/
| +---+--------------------|___|-+--|
| | | |>
| | - |
| |/ CR2 ^ |
o----+----| | |
|> +----+
| |
| |
=== ===
GND GND
created by Andy´s ASCII-Circuit v1.22.310103 Beta www.tech-
chat.de

If you choose R2 of say 1Kohm, you'll have something like 10mA in
the collector of the transmitting transistor. R1 should be
perhaps 30K or so (assuming a beta min of 30). R3 could be say
10Kohm giving you a base drive of about 1mA. With R4 of 1K

It might be more efficient to move R2 to the other end of the
line though.

CR1 and CR2 (may or may not be needed) are used as a free-
wheeling diodes to limit voltage spikes from the 20-30 meters of
cable, which might be quite inductive.

7. ### Jeffrey TurnerGuest

Don't forget a series resistor into the base of the first transistor.
And there's no reason for R3 because R2 will limit that current. R1
may not be necessary, either, depending on your circuit's drive. FETs
would be more efficient. There are probably line driver chips that do
what you're trying to do, also.

--Jeff

8. ### Keith R. WilliamsGuest

Depending on what's driving it, sure. I was assuming a 5V OC
Then you're only driving .7ish volts on the line. The OP wanted
to drive 12V on the line. If you get rid of R3, you can also get
rid of the first transistor and drive the current out of a 5V TTL
gate (of course 15V and 30V TTL drivers are a possibility).
Like the series resistor you brought up first, sure. It depends
That wasn't in the OP's question.

Again the OP specified a transistor, and I think the receiver was
really what he was interested in. OTOH, I'm sure there are a
thousand different variations on the theme, each valid for some
set of conditions (this solution is going to suck eggs at any
kind of frequency). Of course, there isn't enough information to
determine the best solution.

9. ### Jeffrey TurnerGuest

I thought the problem was voltage drop in the transmission line.
Surely adding a series resistance isn't going to help. Using a totem
pole driver rather than R2 could also improve things if line drop is
a major problem.

--Jeff

11. ### Jeffrey TurnerGuest

If the impedance of the wire wasn't a factor then an additional driver
a complete solution.

--Jeff

12. ### John LarkinGuest

This is horrible. The receive threshold is dependent of R3 and the
beta of Q2, and could be very low. You'd have better noise margins
just using 5 volt CMOS logic levels on both ends.

If you really need 12 volt swings, the receiver ought to have a
well-defined 6-volt threshold; a differential or opto receiver would
be even better ig ground loops are an issue.

The cable will be dominantly capacitive; it will *not* overshoot in
the pullup direction.

John

13. ### Keith R. WilliamsGuest

If the voltage drop across the line were a problem, one wouldn't
be using a current into essentially a voltage switch for
signaling. I thought noise was the problem, but again it wasn't
specified.
I never considered the resistance of a few tens of meters of wire
to be the issue. Noise, and ground difference would seem to be
to be far more important, thus the large voltage swing. Of
course there are better solutions, but they weren't asked for.

14. ### Keith R. WilliamsGuest

12V switching. ...at least as far as I could tell.

15. ### Keith R. WilliamsGuest

Horrible, perhaps. It was what the OP wanted, more or less. Try
inducing some noise in there at these currents. ;-). There is
lots of space in here for ground differences, and injected noise
since the currents are rather huge. Certainly I wouldn't do such
a thing for anything other than (very close to) DC, but this is
Think current. The receiver will have ~12V swing, R3 included.
Sure, the beta of the receiver is important, but the OP asked
for...
Nonsense. I've seen multi-million dollar mainframes *flame* for
such assumptions (and many mucky-mucks pretend to be engineers
after the FD leaves). Black-wire is *inductive*. If it's coax,
or other controlled interface, you're right (notice I attached
the may or may not tag). The cabling was not specified, so
random wire was assumed.
Because that's not what the OP asked for? Hell, why not offer a
current-loop? ...that's pretty much what I did. Crude, but it

The question was *not* what's the best way to transmit a 1MHz
signal 100ft using RG58AU. Gee, John, I even stated that I
wouldn't do this, were it my design and understood all the
parameters. I gave the OP the information he asked for.
....silly thing to do .basics, I realize.

16. ### John LarkinGuest

Any transmission line in this universe, including a random wire, is
going to have an impedance way below 1K. The lumped model of a short
such line will be capacitive, and the risetime of this circuit will be
slow compared to the transit time of such a short line.

Try it.

John