# Level Converter

Discussion in 'Electronic Basics' started by Jon Slaughter, Oct 5, 2007.

1. ### Jon SlaughterGuest

How can one convert one level to another in the simplest manner?

I have one device that works on 2.5V and another that works on ~5V. The bus
is bi-directional so I need to convert both ways.

Actually the 5V device has open collector outputs but the problem is that
its not truely open collector since it has a pullup itself. So if I put a
2.5V pullup it's actually larger than 2.5V. Of course I could reduce the
resistor pulling up to 2.5V but then it causes the current to go out of
spec.

The basic idea is

Vdd Vcc
--- ---
| |
.-. .-.
Vdd | | | |
--- | |Rd | |Rc
---------o '-' '-'
| |
-o | ___ | _/
__--o---|---|___|---|---o/ o- GND
GND------o Rw
Sw1
Sw2

Where everythign after Rw(Vcc, Rc, Sw1) are internal(the parallel port) to
the 5v device and everything before Sw2 is internel to the 2.5V(a micro
pic).

Sw1 controls the parallel port output state and Sw2 controls the output of
the pic. (it's also used as an input in which case Sw2 is set to
Hi-Z(middle) and there is a line connected just before it)

Rw is the wire resistance which is significant in this case I believe since
I'm actually getting only about 4V instead of 5V(although I haven't checked
the parallel port's voltage itself so it might be low already).

In any case, Vdd is the pull I add which is suppose to be about 2.5 volts.
In reality what the pic see's is over 3 volts dependon on how I choose Rd.
(It has to be alteast 625ohms because Sw1 can only sink 4mA and 2.5V/4mA =
625Ohms.) Rc is suppose to be 4.7kohms or so but no telling what it actually
is.

Actually there needs to be a current limiting resistor right after Sw2 in
teh case Sw2 is at Vdd and Sw1 is at GND. It too needs to be atleast
625ohms.

In any case I don't see an easy to to convert the levels in any decent way
because of the internal pullup ;/ What I was thinking is to use a bjt that
is driven by the parallel port... something like

Vdd
---
|
|
|
<| ___
|-o-|___|-o--- Parallel Port
/|
|
|
PIC ----o-----+
|
.-.
| |
| |
'-'
|
GND

I'm not sure if this is the best solution though. (Its not the complete
circuit and there are a few other issues but I think they are minor)

Just seems like a mess and I'm trying to find the best solution I can that
uses the least amount of components.

There are 4 lines and all our input(w.r.t to the pic) except one which is
input and output.

So what I really need is 3 5V to 2.5V level translators and 1 5V to 2.5V and
2.5V to 5V.

I suppose what would be nice is there was a device that translated between
two voltage levels with bidirectional capabilities? I was hoping I could get
away with just using resistors but this doesn't seem to be the case ;/

Maybe theres something easier that I'm overlooking or maybe my idea with the
BJT's won't work well?

Thanks,
Jon

2. ### Brendan GillattGuest

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I remember there being an article on the web that did level translation
with a single FET that was bi-directional. I have scoured my bookmarks
but I can't find it - sorry. Perhaps another member of this newsgroup
recalls it?

- --
Brendan Gillatt
brendan {at} brendangillatt {dot} co {dot} uk
http://www.brendangillatt.co.uk
PGP Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xBACD7433
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)

iD8DBQFHBrsvkA9dCbrNdDMRAsWcAJ4pm0SI253th0KT7BXE60whhB5ILwCfbJ+f
fHvcJtyLgJgfom21a6SysFQ=
=yrMw
-----END PGP SIGNATURE-----

3. ### Jon SlaughterGuest

A problem I have with the bjt's(or even mosfets) is that the level is
significantly below what I really need. I'm wondering if there is a way to
reduce the voltage drop across the transistor to get closer to rail voltage?

e.g.,

Vdd
|
|
+--+|
||
||
+--+|-----
|
|
\
/
\ R
/
|
GND

4. ### Jon SlaughterGuest

Maybe theres hope after all. I'm pretty sure it can be done but the problem
I'm having with a single mosfet is that the voltage is significantly lower
than what I need given that the gate is only about 1.5V above the drain.
This means I have to pull up the gate past 5V or so to get practically rail
to rail but that means I need another power source(2.5V and 5+V). This is
not necessarily the worse thing but I'd like to avoid it if possible.

5. ### John LarkinGuest

TI has some chips that do exactly this.

John

6. ### Jon SlaughterGuest

I send a schematic showing my idea to binaries.schematics but there are some
issues(the short that exists). Basically there are 4 parts. The parallel
port, which is up to the 10ohm resistor(wire resistance). The pullup's for
level translation which is the 8V and 2.5V parts. The Pic part which is J1
and everything after it(not sure the actual hardware involved but I modelled
it similar to the parallel port(forgot the pullup resistor but in this case
it doesn't matter to much). Then theres the read part which starts with Q2.
This is only when the PIC part is set for output mode. This occurs only for
one of the pins. The other 4 would not have this.

Even if this circuit worked as is(the resistor values were somewhat
arbitrary though) it would require 3 power sources. (I might get away with
just 2, a 2.5V and a 5V(or 6V even) but this might be risky).

7. ### Jon SlaughterGuest

Thanks, I'll look into it and see.

Jon

8. ### Jon SlaughterGuest

The

SN74LVC8T245

Looks pretty cool. Going to get some now. Probably all I need.

Thanks,
Jon

9. ### Andrew HolmeGuest

Look at the level-shifter circuit on page 43 of the I2C specification:

This is for bidirectional open-drain / open-collector signals.

10. ### Brendan GillattGuest

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yeah I think it was something like that - the source and drain were
connected between the two logic lines and the gate was attached to
(insert memory here).

- --
Brendan Gillatt
brendan {at} brendangillatt {dot} co {dot} uk
http://www.brendangillatt.co.uk
PGP Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xBACD7433
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)

iD8DBQFHB8Z+kA9dCbrNdDMRAqSTAKC/6uqbT+yUjy8rk/utFcjfrzvSGgCeOtVP
i+XV/wKPHfxKzKcdfzAejDA=
=ybsk
-----END PGP SIGNATURE-----

11. ### Jon SlaughterGuest

Hehe, I was just reading over that spec last week and glanced over that but
forgot ;/ It might work well.

I think though the biggest problem I'm going to have is that under certain
circumstances I can end up with a short and I'm not sure how I am suppose to
go about preventing any damange(I can, for the most part avoid the short but
in some cases I might not). I was thinking about a foldback limiter but
still working on the details.

Thanks,
Jon

12. ### Jon SlaughterGuest

This looks like it might solve my problem too The short won't exist
because it reverse biases the mosfet Seems like it might be the best
discrete solution. The biggest problem is that it requires 2 voltage
sources but I can live with that and theres probably no way around it
anyways.

Thanks again,
Jon