# Understanding 5V to 1.8V UART level-shifting circuit

Hopefully it's OK to ask very basic electronics questions here.

I had a TTL 5V UART cable, however the board I had only accepts 1.8V max. So I found some online schematics that uses resistors and a transistor, and I built it on a breadboard. It actually worked.

I just want to understand how it worked deeply. Why did it work?

Also, how do you properly calculate the EXACT values of resistors to drop the 5V input to 1.8V? What's the formula for that? • It's perfectly OK to ask basic electronics questions. They are usually very well received. It is however impossible for anyone to answer how your "some online schematics" is hooked up. – pipe Mar 23 '19 at 17:47
• I'm not looking for schematics analysis, just want to know how resistors I used dropped the voltage from 5V to 3.3V, resistors drop I (amps), no? Also how to calculate exact needed ohms to convert 5V to 3.3V or any other V? Finally, if possible, why would this 5V -> 3.3V might need a transistor at all? – GMX Rider Mar 23 '19 at 17:50
• How they dropped the voltage depends on how they're hooked up. So if you can share the schematic, we can probably tell you. If you can't share the schematic, then we can only guess. – The Photon Mar 23 '19 at 17:53
• don't link to it, put that circuitlab in your question. Use the schematic button in the edit box toolbar, it's circuitlab! – Neil_UK Mar 23 '19 at 17:58
• Add the schematic into your question using the image upload button. That way we get to see it in the context of the question, don't have to follow links and the question still makes sense when the link dies. If it's CircuitLab then you can copy and paste using the CircuitLab button on the editor toolbar. – Transistor Mar 23 '19 at 17:58

There's two parts to this. On the TTL to Odroid section (pins 3 & 4 of both connectors), R2 & R3 form a simple voltage divider (you can web search "voltage divider" for lots of information, so I'm not going to go into any depth here). It works because the TTL output is either 0V or 5V, and because the Odroid input doesn't need any real drive.

On the Odroid to TTL section, they've implemented a transistorized amplifier. Bear with me, because it's complicated.

Pin 1 on the Odroid side is the Odroid's 1.8V power supply. It's connected to the base of the transistor. Pin 2 on the Odroid side is the Odroid's output and is connected to the transistor's emitter. The transistor collector is pulled up to 5V by a R1, and is connected to the UART receive.

When pin 2 on the Odroid side is at 1.8V, both the base and emitter are at 1.8V: there is no voltage difference between them. Because there is no voltage difference, no current flows. Because no current flows, R1 can cleanly pull the transmit line to the 5V UART up to 5V (basically, the circuit acts like the transistor isn't there, so R1 is free to pull the voltage high).

When pin 2 on the Odroid side is low, it's a different story. The emitter is pulled down to ground. That pulls the base of the transistor down to 0.6V or so (or 0.7V). That makes about 1.2mA flow in the base ((1.8V - 0.6V) / 1k$$\\Omega\$$). The transistor conducts current from collector to emitter. It's trying to conduct about 120mA (because transistors have current gain), but it can't pull the collector much lower than about 0.2V above the emitter (this is called "saturation"). Since the emitter is at ground, the collector (and the line to the UART) will sit at about 0.2V. That's not right at 0V, but it's plenty low enough that it'll be seen as a zero by the UART.

The transistor circuit is what's known as a "common base" circuit, if you want to search on it. It's used here rather than the more often used common emitter circuit because a common base circuit does not invert the voltages that it amplifies (a common emitter circuit would, and that would screw up communications).

So that's it. A simple (to slightly experienced hands) resistive voltage divider, and a simple (to somewhat more experienced hands) common-base amplifier.

• Thank you. Can you explain more on the choices of resistor values, 1k, 18k, 10k and the way they are connected. Where does those values come from? – GMX Rider Mar 23 '19 at 18:45
• The 10K & 18K resistors are somewhat arbitrary -- somewhat in that the ratio needs to be about 1.8 to make the voltage divider work (do a web search on voltage dividers), but the 10K could be anything from around 470$\Omega$ to 470K and it would still work. I'll edit the answer on the transistor section, although the 1K is also somewhat arbitrary -- you could use anything from 1K to 100K, as long as the collector resistance (R1) is no less than the base resistance (R4). – TimWescott Mar 23 '19 at 18:54
• Thank you, will wait for answer edit and I'm already reading about Voltage Dividers. Another question, in this scenario, when my TTL UART cable says 5V, I assume its pushing 5V into circuit from my USB port, then I also see ODroid have 1.8V VCC and GND ports. So which one is actually the source of voltage here? – GMX Rider Mar 23 '19 at 18:57
• The UART side is sourcing 5V to the collector of the transistor; the Odroid is sourcing 1.8V to the base. So, both. – TimWescott Mar 23 '19 at 18:59
• One more question, TTL_USART pin 3 will be 5V when its sending bit 1 and it will be 0V when its sending 0. So by having 18k and 10k resistors like that (R2 and R3), we say Vo = Vi x (R3 / R2 + R3). So output will 1.78 ~= 1.8V. Am I doing it right? – GMX Rider Mar 23 '19 at 19:12