1.8v to 5v logic level converter *solved*

Hi!

I had a similar question a couple of days ago how to convert a 2.65v signal to 5v with transistors. I ended up using 2*NPN transistors and it worked fine (serial communication)

Breakout board for TXB0108.

https://www.adafruit.com/products/395

olof_n:
Hi!

I had a similar question a couple of days ago how to convert a 2.65v signal to 5v with transistors.
I ended up using 2*NPN transistors and it worked fine (serial communication)

Hmm interesting. I’m going to have to try that before I buy anything TXB010* related.

Just wondering though, but why is R6 necessary? Why not simply just use R5 and increase the ohms?

@lemming
I saw that later last night and might consider it. It’s a little overkill but at least I don’t have to worry about making a mistake.

Hi!

R5 and R6 are a voltage divider. In this case the output voltage is 3.33V if the input is 5V.

Vout = (R6 / R5 + R6) * VIN

3.33 = (2 / (1+2)) * 5

schmidtbag: Just wondering though, but why is R6 necessary? Why not simply just use R5 and increase the ohms?

To make it switch fast - the divider circuit has a significantly lower impedance than just a high-value series resistor - the 2k + 2k divider has an impedance of 1k, whereas using a 10k series resistor would be 10k. Every input has a few pF of input capacitance and the lower source impedance will drive that capacitance faster, might make the difference between a 20MHz top frequency and 5MHz, something like that.

Thanks for the replies everyone, and sorry about the late reply - I haven't had much time to work on this until now.

The unidirectional output diagram olof_n showed seems to work fine but it revolves around a 3.3v source - mine is 1.8v. The transistor I'm using is the 2222A. What do I need to change to make it accept the 1.8v source? I tried removing the resistor between the odroid TX and the T1 base, but it didn't seem to make a difference.

The receiving end works fine, I just used 1.1k and 2.2k resistors instead of the 1k and 2k, I switched their positions, and now I seem to get approximately 1.8v. I have an analog multimeter so I'm not sure how far off from 1.8 I really am but the odroid didn't blow up knock on wood and it's receiving data.

schmidtbag: The unidirectional output diagram olof_n showed seems to work fine but it revolves around a 3.3v source - mine is 1.8v. The transistor I'm using is the 2222A. What do I need to change to make it accept the 1.8v source?

No "1.8V" modifications necessary (exc., perhaps a somewhat lower value for R1?) I don't see R3 as necessary, T2_B could go directly to junction of T1_C & R2. I'd consider adding a pulldown on the input (with a >= 22K from T1_B to Gnd.)

schmidtbag: I tried removing the resistor between the odroid TX and the T1 base, but it didn't seem to make a difference.

So, I guess you tried that out and "no joy". Perhaps a wiring error? Don't remove resistors recklessly.

I added a 27K from T1_B to gnd and it seemed to make the problem worse. Before, simply nothing was happening, but now on odroid when I run “cat /dev/zero > /dev/ttySAC1”, it claims there’s an I/O error and stops. However, it doesn’t fail if I unplug the wire at T2_C.

I quadruple checked everything. Like I said, it seems to work but only if the voltage is high enough. If I try putting the 3.3v source from the arduino at the T1_B and then use the multimeter to check T2_C, the output is about 5v. As a side note, when doing that (in the current setup), I’ve noticed T1_B is only getting about 1.5v. Seems like a lot of resistance over there.

You are doing like so:

?

Yes, that is how I have it set up. But the picture you supplied confuses me a little. T1 and T2 are NPN, but the transistor you showed me in the picture is, if I'm not mistaken, PNP: http://3.bp.blogspot.com/-iTo2cABnytE/UAmCx3gD34I/AAAAAAAAFBc/_xjB__ClEuI/s1600/NPNvsPNP.png

schmidtbag: T1 and T2 are NPN,...

Yes.

schmidtbag: ...but the transistor you showed me in the picture is, if I'm not mistaken, PNP: http://3.bp.blogspot.com/-iTo2cABnytE/UAmCx3gD34I/AAAAAAAAFBc/_xjB__ClEuI/s1600/NPNvsPNP.png

No, Sir! I added the inset, with the leads labelled, but the schematic's symbols remained unchanged. http://www.jameco.com/Jameco/Products/ProdDS/178511.pdf

A test: Disconnect "the circuit" from the RPi. If you put the input resistor to +5 then T1's collector should be Gnd/0V and T2's collector should be +5. If you put the input resistor to Gnd then T1's collector should be +5 and T2's collector should be Gnd/0V.

If you have access to the RPi's "1.8V", do the same using that instead +5 for the input.

I hope we have the Grounds in common: the RPi's goes to the circuit's goes to the TTL device's. Please confirm.

what's the point of the 2nd transistor?

except increasing propergation time?

cjdelphi: what's the point of the 2nd transistor? except increasing propergation time?

T1 and T2 are both inverters. A --> /A --> A

So here's what's going on at this point:

Apparently I had the transistors in backwards, not much of a surprise since I'm pretty terrible with electronics. Anyways, it seems to have a better end result but it's not the end result I'm looking for. The situation is if I replace the odroid TX with the 1.8v source (also from the odroid), T2_C shows the 5v as it should - I didn't get that far before with the transistors in backwards. However, doing this seems to make the odroid crash, as though it's draining all of it's power just for this serial port. I am running the system in a lower power rating than recommended, but I currently have no display, no USB devices, or processor intensive tasks running. When using the actual TX pin from odroid, the arduino doesn't seem to read it but the multimeter seems to show results.

The "odroid" is what's represented as the RPi ?

You may benefit from a couple of new transistors. Tried that yet?

Please confirm.

Yes, the odroid is represented as the RPi (but the devices have little to no relevance to each other).

I just tried some new transistors and that seems to do the trick - sending signals to the arduino seems to get me results, though I'm not sure yet if the arduino is receiving actual data or just jibberish. I'm going to mess with it some more and see what I can get out of it. I'll test another arduino just in case. If both arduinos encounter problems, I'll probably be back. Otherwise, I'll mark this as solved.

But no karma++; ?

I used a serial to usb adapter to test this and I can confirm it is working. And here's your karma haha.

Thanks everyone for pitching in.

@runaway_pancake I understand that first transistor invert output and the one after invert it again but I don't understand why? If R2 was moved to be between T1-Ground and output was taken from between T1-R2 then output should be normal (not inverted) and ready to be used.

Is there other reasons for having two transistors or am I missing something?

EDIT: Already answered here https://electronics.stackexchange.com/questions/82104/single-transistor-level-up-shifter#82108 Leaving my reply in case anyone got same question