Connecting 5v Logics to 3.3v Logics

Hi

I have a question that I am curious about for a long time,
and it came up again this week, since I ordered a Bluetooth module.

So I will use that BT module as an example, but the question is general, since the problem often happens with many other modules/chips.

The question is this:

I (and many other people) use Arduino boards that are 5v.
In my case I like the Arduino Nano, 5v 16MHz - I have many of it.

The BT module I talk about is an HC-05 module, that comes on a Breakout Board that includes a Voltage Regulator to 3.3v.

So you can feed the BT module with 5v Operating voltage from your Arduno board,
and it will be converted to 3.3v.
But your Logics are not handled there in any way.

Now when I see people connect that BT module to a 5v Arduino,
(the 2 UART data lines)
what they do is this:

The outgoing data from the BT module (TX) goes directly to the Arduino RX,
without any conversion.
It is 3.3v that goes into a 5v input leg,
and since 3.3v is over the threshold needed for a "1" even for a 5v Logics,
then that's OK - even without conversion.

The problem is the other direction:
Arduino TX, going to the BT module RX:
this is 5v going into 3.3v..

Now some users use a Voltage Divider, to convert the data from 5v to 3.3v,
but some others, don't use anything, and connect the 5v TX directly to the 3.3v RX.

What I wonder:
Is the second way OK?
Or is it a true problem that should be avoided in any case?

Thank you

I, too, have seen it both ways (voltage divider and straight to BT RX) when researching how to connect an Uno to a BT module. I always use the voltage divider to be safe.

There are other ways to level shift. I use a bidirectional level shifter using 2N7000 MOSFETs for I2C devices because they don't affect the (faster) waveform as much as a voltage divider. For level shifting one way signals (like for a 3.3V Nokia 5110 display or an SD card module to an Uno) I use the 74HC4051.

Nice.
What about using a simple Diode for the 5v to 3.3v direction?
Is that better or worse than a Voltage Divider?
(and is there a diode that can decrease something close to the 1.7v voltage drop that is needed here?)

What about using a simple Diode for the 5v to 3.3v direction?

Bad idea because that screws with the logic zero voltage leaving the 5V input in effect floating.

Use a resistor divider and if that is not fast enough for the signal you need to use a buffer run off the 3V3 but has 5V tolerant inputs.

Those people who do nothing are simply stupid and their systems will fail sooner than it otherwise would.

Bidirectional Logic Level Converter

Thank you,
I am aware of Level Converters, and actually have some here..
But was looking for some way that will take less space on the breadboard..

A single 2-leg component, like a Diode (if it was good here, which isn't unfortunately) could've been very nice.

So I assume a Voltage Divider is the closest thing to it..

For that application (9600 baud TTL serial), yes. But for higher speed signals like I2C or SPI an active method like the MOSFET or 74HC4061 would be called for.

But was looking for some way that will take less space on the breadboard..

If you use surface mount resistors the extra space it consumes would be minimal.

groundFungus:
For that application (9600 baud TTL serial), yes.
But for higher speed signals like I2C or SPI an active method like the MOSFET or 74HC4061 would be called for.

Thanks for the tip, I will remember that.

Grumpy_Mike:
If you use surface mount resistors the extra space it consumes would be minimal.

Well, since I am using Breadboards, then SMD component are not relevant for me..
Only TH components.

Some 3.3 V devices are specifically 5 V tolerant. It will state this clearly in the datasheet. If it doesn't say it's 5 V tolerant then I would always use a level shifter. Maybe you can get away with subjecting the thing to 5 V but it's also possible it will work for a month and then become unreliable, causing you to waste a bunch of time troubleshooting. I would rather work within the specs the device was designed for.

card5:
Well, since I am using Breadboards, then SMD component are not relevant for me..
Only TH components.

Solderless bread board or strip board? You can use surface mount with strip board where you can't do anything with solderless bread boards, they are useless.

pert:
Maybe you can get away with subjecting the thing to 5 V but it's also possible it will work for a month and then become unreliable, causing you to waste a bunch of time troubleshooting.

I see,
will not use that method then..

Grumpy_Mike:
Solderless bread board or strip board?

Solderless Breadboard.
Not Stripboard, not Perfboard.

card5:
What about using a simple Diode for the 5v to 3.3v direction?
Is that better or worse than a Voltage Divider?
(and is there a diode that can decrease something close to the 1.7v voltage drop that is needed here?)

You misunderstand how to use a diode.

Using a diode actually is better than a voltage divider, and also somewhat safer.

But it is not what you think!

The diode cathode goes to the 5 V output, and the anode to the 3.3 V input. You then use a pull-up - such as 1k - from the 3.3 V device input to the 3.3 V supply. You may not need this with an internal pull-up such as an ESP8266.

This means you have a "stiff" 1k pull-up, and a very stiff pull-down to 0.6 V which is a perfectly acceptable and guaranteed LOW level. And in the HIGH state - which is generally the idle state - it draws no current.

The voltage divider is the most easy way.

______ 5V signal
|
| | R1
| |
|
X------3,3V out
|
| | R2
| |
|
L______ 0V (GND)

Some values:

U1 U2 R1 R2 (R1+R2)
5V 2,94 3300 4700 8000
5V 3,15 3300 5600 8900
5V 2,72 4700 5600 10300
5V 2,96 4700 6800 11500
5V 3,18 4700 8200 12900
5V 3,00 2200 3300 5500
5V 2,97 1500 2200 3700
5V 3,23 820 1500 2320
5V 3,21 1000 1800 2800

Other way, use 3pcs 1N4148 Diode: (Onde diode drops 0,6V)

3x 1N4148 10k
5V ______
----|>----|>----|>--X------- GND
|
|
L
______ 3,3V out

Paul__B:
You misunderstand how to use a diode.

Using a diode actually is better than a voltage divider, and also somewhat safer.

But it is not what you think!

The diode cathode goes to the 5 V output, and the anode to the 3.3 V input. You then use a pull-up - such as 1k - from the 3.3 V device input to the 3.3 V supply. You may not need this with an internal pull-up such as an ESP8266.

This means you have a "stiff" 1k pull-up, and a very stiff pull-down to 0.6 V which is a perfectly acceptable and guaranteed LOW level. And in the HIGH state - which is generally the idle state - it draws no current.

Similar to what the OP is asking about, I have a serial signal which is 5v but, not 0/5 but rather +5/-5. It's probably slow enough that I don't need an IC level shifter and would normally use a resistor voltage divider, but I'm not sure how to proceed given I want to convert +5 to +3.3 and -5 to 0. This is intended to go into a Teensy, so it is not 5V tolerant. Oh, I only need to go one way, from my producer to the Teensy. Thanks!

AdrianCorner:
The voltage divider is the most easy way.

Full marks for enthusiasm, but you apparently did not comprehend my preceding explanation of the genuinely easiest and most practical method.

skyjumper:
I have a serial signal which is 5v but, not 0/5 but rather +5/-5.
...
This is intended to go into a Teensy, so it is not 5V tolerant. Oh, I only need to go one way, from my producer to the Teensy.

If you needed the other way, you would use a MAX232 and it would be all done.

This will need more diodes and I think one resistor. Have to run just now but will get back to you later. :grinning:

What are you converting ? A signal ?
You can use an op amp summing amplier and sum -5V with +5V to get 0
and sum -(5-3.3) with 5V to get 3.3V (-1.7V+5V=3.3V).

The MAX3222 is a RS232 to 3,3V serial converter. Also I have read that the MAX232 can be used at 3.3V even though the spec says minimum supply voltage is 4.5V (YMMV).

raschemmel:
What are you converting ? A signal ?
You can use an op amp summing amplier and sum -5V with +5V to get 0
and sum -(5-3.3) with 5V to get 3.3V (-1.7V+5V=3.3V).

It's serial data. Its documented to be "RS232 levels" but it's actually +/- 5 volts, not +/- 12 volts.

since I ordered a Bluetooth module.
So I will use that BT module as an example, but the question is general, since the problem often happens with many other modules/chips.

POST A LINK TO THE BT MODULE VENDOR

I'm not convinced Skyjumper is correct about the following:

It's serial data. Its documented to be "RS232 levels" but it's actually +/- 5 volts, not +/- 12 volts.

So why aren't you using an RS232 to TTL Serial converter ?
(like the MAX232 chip or similar ? That's really the only solution that makes since.
You're not the first to want to do that and you won't be the last)

READ THE DATASHEET (What does it say it is designed to do and what input levels ?)
MAX232