5V to 3.3V TTL conversion

Thread Starter

Kihun Song

Joined Nov 23, 2017
16
I'm using a 3.3V LoRa module with 5V Arduino Nano.
I took recommendations from Github and put a 4.7k resistor between the Tx and Rx connections.
Since they don't communicate at high speeds, it worked just fine.

1. With a single 4.7k resistor, not a voltage divider, does the resistor do anything else than limit the current?
What is the function of this resistor? Does the resistance on the arduino/LoRa module work as a second resistor and create a voltage divider?

2. Why would I want to put a resistor when I need to step up the voltage from 3.3V to 5V?


I feel like this question might be a duplicate, but I couldn't feel confident with the stuff I found on the internet, sorry.
Thanks in advance.
 

ericgibbs

Joined Jan 29, 2010
21,401
hi Kihun,
Welcome to AAC.
The 4k7 resistor should be on the Arduino TX output pin to the LoRa RX input pin, is that correct.?
E
 

danadak

Joined Mar 10, 2018
4,057
If you are translating 5V to 3.3V logic, into a CMOS input, a series
R to limit current (which goes thru parasitic input diodes to its Vdd
pin) is OK if relatively low speed applications. If higher speed you
have to consider pulse alteration due to series R and C at the
input.

3.3 to 5, to get adequate noise margin, you need to do a translation,
either with a discrete transistor or, if part has open drain and its open
drain is isolated from it own Vcc/Vdd (rare).



Regards, Dana.
 

ericgibbs

Joined Jan 29, 2010
21,401
hi,
That 4k7 acts a current limit resistor.
It is also possible to use a 2k and a 3k3 resistor in series.
Top end of the 2K goes to the Ardunio output pin and the bottom of the 3k3 to 0V, the junction of the two resistors goes to the LoRa's input pin.
.
What circuit are you using for reading the LoRa into the Arduino.?
E
 

Thread Starter

Kihun Song

Joined Nov 23, 2017
16
If you are translating 5V to 3.3V logic, into a CMOS input, a series
R to limit current (which goes thru parasitic input diodes to its Vdd
pin) is OK if relatively low speed applications. If higher speed you
have to consider pulse alteration due to series R and C at the
input.

3.3 to 5, to get adequate noise margin, you need to do a translation,
either with a discrete transistor or, if part has open drain and its open
drain is isolated from it own Vcc/Vdd (rare).



Regards, Dana.
Thanks for the reply.
For 3.3V to 5V conversion, I understand it requires a level shifting circuit like you posted, but what would a resistor in between do to the circuit?
 

ericgibbs

Joined Jan 29, 2010
21,401
hi,
All the series 4k7 in your original post would do is limit the current into the LoRa.
It is an often used method to get from 5V down to 3V, providing the input circuitry of the receiving device can tolerate the higher input current.
E
 

Thread Starter

Kihun Song

Joined Nov 23, 2017
16
hi,
That 4k7 acts a current limit resistor.
It is also possible to use a 2k and a 3k3 resistor in series.
Top end of the 2K goes to the Ardunio output pin and the bottom of the 3k3 to 0V, the junction of the two resistors goes to the LoRa's input pin.
.
What circuit are you using for reading the LoRa into the Arduino.?
E
Thanks for the replay.
Yes, but would I need a current limiting resistoe for 3.3V to 5V?
If you follow the github link, there's a simple diagram showing where to put resistors. I followed the diagram and it works.
 

Thread Starter

Kihun Song

Joined Nov 23, 2017
16
hi,
Going from 3.3V upto 5V requires an active level shifter.
This PDF shows some methods.
E
Yes, that's exaxtly what I thought with requiring active level shifter.
So just a single resistor in series wouldn't do any good in 3.3V to 5V circiuit, right?
 

ebp

Joined Feb 8, 2018
2,332
If an input is "TTL compatible" which almost always means TTL input voltage level compatible, the maximum for logic 0 is 0.8 V and the minimum for logic 1 is 2.0 V. This is usually easily met by CMOS circuitry running at at least 3 volts. If CMOS circuitry is running at 5 V and the inputs are standard CMOS type, then driving the inputs from 3.3 V CMOS circuitry may be marginal. Typically the input requirements will be less than 1/3 Vdd for LOW and greater than 2/3 Vdd for HIGH. This puts the logic HIGH threshold very close to the maximum output voltage from 3.3 V logic. Usually it will work, but sometimes it is unreliable. I encountered a case of exactly this problem where someone was sending serial data from 3.3 V logic to 5 V logic and it sometimes worked and sometimes didn't.

Almost all inputs on almost all digital and analog ICs, especially MOS devices, have diodes for protecting the inputs from electrostatic discharge damage. One diode goes to the positive supply (anode to input) and one to the negative supply (cathode to input). The diodes have limited current handling ability. Depending on the device, the absolute maximum current through a diode can range from about 2 mA to 20 mA or even more, but the datasheet must be consulted. It is permissible in most cases to deliberately "use" the diode - rely on it to limit the voltage, but the current limit must be observed and the actual current limited to something typically well below the maximum. In the case of some analog circuitry, the input will be protected if you allow diode current but the circuit may not operate properly. Atmel processors tend to be very poorly specified in this regard (meaning the datasheet provides poor information).

With 5 V driving an input of a circuit operating at 3.3 V, the input would be clamped at about 4 volts (one "diode drop" above the positive supply voltage), leaving 1 volt across a series resistor between output and input. 4.7 k ohms would therefore limit the current to a little over 1/5 of a milliamp, which is safe - again provided the input has a protection diode and is specified to allow some current. You can add an external diode (anode to input, cathode to 3.3 V close to the IC's supply pin). If you look carefully at the specifications, this actually is not a guarantee of meeting the spec for absolute maximum input voltage, but in practice it is generally OK.

For fast circuits an integrated level shifter should be used. All other circuitry, whether resistors or more elaborate discrete transistor circuits will compromise speed.
 
Last edited:

spinnaker

Joined Oct 29, 2009
7,830
hi Kihun,
Welcome to AAC.
The 4k7 resistor should be on the Arduino TX output pin to the LoRa RX input pin, is that correct.?
E
Yes that is correct.
Github says I should also place one on from LoRa Tx to Arduino Rx
You seem to be contradicting yourself. Do you want to connect the 5V output from the nano to the 3V input of the module? Or from the 3 v output of the module too the 5V input of the nano?


This is why youy should always post a schematic. Please do so now as it will clear up any doubt of what you want to do.
 

ebp

Joined Feb 8, 2018
2,332
forgot to mention:

Some CMOS devices that operate at low voltage have "5 volt tolerant" inputs which can be driven directly with a 5 V output.

There can be issues with any system, regardless of the level of the supply voltages, if an output of a powered device is connected directly to the input of an unpowered device. It is sometimes possible to power the unpowered device with current through its input protection diodes from the powered device. This is generally something to be avoided because it can cause damage if the current isn't limited and certainly can cause some very strange behavior.
 

Thread Starter

Kihun Song

Joined Nov 23, 2017
16
You seem to be contradicting yourself. Do you want to connect the 5V output from the nano to the 3V input of the module? Or from the 3 v output of the module too the 5V input of the nano?

This is why youy should always post a schematic. Please do so now as it will clear up any doubt of what you want to do.
Sorry. I thought the link on Github would make it clear as it's really simple.
Below is what the wiring looks like with 4.7k resistors on both the Rx and Tx side.

upload_2018-10-29_8-3-57.png

I was asking why I would need a resistor from 3.3V Tx to 5V Rx.
Shouldn't it be some active level shifter or just nothing rather than a resistor?
Shouldn't the current limit on 5V Rx should be higher than 3.3V Tx?
 

spinnaker

Joined Oct 29, 2009
7,830
Sorry. I thought the link on Github would make it clear as it's really simple.
Below is what the wiring looks like with 4.7k resistors on both the Rx and Tx side.

View attachment 162659

I was asking why I would need a resistor from 3.3V Tx to 5V Rx.
Shouldn't it be some active level shifter or just nothing rather than a resistor?
Shouldn't the current limit on 5V Rx should be higher than 3.3V Tx?
Most people won't click on outside links.

See if you can find a proper datasheet on the nano and the E32.

I suspect that the nano will be able to take a 3V in as a high but need to see the datasheet to be certain. I searched I was not able to find one.

The E32 might have 5V compliant pins but we need to see a datasheet to be certain.

Your series resistors will do nothing. You are still going to see 5V into the E32. If the pins are not 5V compliant then you can blow outyour E32.
 

BobaMosfet

Joined Jul 1, 2009
2,211
If you are translating 5V to 3.3V logic, into a CMOS input, a series
R to limit current (which goes thru parasitic input diodes to its Vdd
pin) is OK if relatively low speed applications. If higher speed you
have to consider pulse alteration due to series R and C at the
input.

3.3 to 5, to get adequate noise margin, you need to do a translation,
either with a discrete transistor or, if part has open drain and its open
drain is isolated from it own Vcc/Vdd (rare).



Regards, Dana.
I liked this at first, looked elegant, clean. But it is incorrect. In truth, as soon as Q1 conducts, there is no longer any separation between potential on either side of the BJT, and the entire signal line all the way back to IN is raised to 5V.
 

ebp

Joined Feb 8, 2018
2,332
I liked this at first, looked elegant, clean. But it is incorrect. In truth, as soon as Q1 conducts, there is no longer any separation between potential on either side of the BJT, and the entire signal line all the way back to IN is raised to 5V.
No, it is a common base level shifter. The voltage at the emitter will be Vbe below the voltage at the base - it cannot be higher or the transistor would turn off. It is rather like a common collector circuit with the base voltage fixed. A common base circuit like this can be used to shift hundreds of volts if a suitable transistor is used. It is simpler than using two common emitter stages for non-inverting up shifting. One drawback is that the current gain is less than unity.

Generality that is not important to the problem at hand:
If implemented with two transistors, particularly as a linear amplifier, it is commonly called a "cascode" circuit. A similar circuit is sometimes used with power bipolar transistors where the base voltage on the upper transistor is not fixed. Properly done this can sometimes result in better overall safe operating area than using transistors in parallel because it "shifts Vce left" from the second breakdown part of the curve into the power limited part of the curve. In the days when power MOSFET voltage ratings were not great and high voltage bipolar transistors were slow, you would sometimes see the BJT switched by a low voltage FET in the emitter. You could make a fast high voltage switch that way. The BJT is kept of out saturation, so it switches off fast.
 

ebp

Joined Feb 8, 2018
2,332
Yes, that's exaxtly what I thought with requiring active level shifter.
So just a single resistor in series wouldn't do any good in 3.3V to 5V circiuit, right?
Eric's solution at #11 can help. Outputs usually also have protection diodes, so you can't passively pull an input to more than a diode drop above the positive supply of the outputting device - so around 3.9 to 4 V with 3.3 V circuits. Again you must be careful not to exceed the current handling of the diodes and you have that risk of powering an unpowered circuit through the diode. But 10k limits the maximum current under any circumstances to half a milliamp. 4 volts is going to be a good clean logic HIGH for any standard input for CMOS running on 5 V. You definitely would not use the resistor in series between the output and the input.

I'm curious about the first three lines in the table at #16. How is direct connection safe/functional for those signals?
 
Top