3.3V to 5V RX/TX and vice versa

I was looking for optimal solution to connect Arduino and RaspberryPi TX/RX lines for serial communication. Because i didn’t want to buy and include level shifter just for that i arranged some circuit from the web. I also wanted to protect Raspberry’s TX side since Arduino can send some 5V signals to Raspberry when uploading new sketches.

What do you think about the circuit?

What do you think about the circuit?



Why exactly?

You didn't ask that you asked what I thought of it and I told you.
Why do you think it is any good?

ooh, there's the Grumpy version i'd yet to witness ! :smiley:

What do you think about the circuit?

i'm assuming that's a Schottky diode in there - i don't know enough about that component to say it's used wrongly or not, but i would imagine from EE basics, you just want a Voltage Divider circuit.

anyway, you have to know that Grumpy_Mike is VERY senior and MOST knowledgable when it comes to electronic circuits so you will want to learn from him !!

His question;

Why do you think it is any good?

is a reasonable question, and if you do want to learn about Arduino (AND! Raspberry Pi) you'd try and reply that honestly.

Ok crapness rating … all these things are bad

  1. the 5V from the arduino is dumping current into the 3V3 rail of the Pi.
  2. the Pi’s TX output is being pulled up to 5V
  3. the Arduino’s TX is dumping current into the Pi’s power rail

… and if you do want to learn about Arduino (AND! Raspberry Pi) you’d try and reply that honestly.

Thank you for reply,

i didn’t take “crap” as personal insult :slight_smile: Concerning how many posts and karma likes Grumpy_Mike have got i believe he is/you are really good at his/your work.

My explanation why i think (well, i thought) it is/was any good…

I saw a lot of circuits with voltage divider for Arduino TX to Raspberrys RX and direct connections from Raspberrys TX to Arduino RX for this purpose. I wanted to protect Raspberrys TX pin when uploading sketches to Arduino. Besides that i used divider with diode and resistor rather than resistor and resistor because of the current consumption. If i understand it correctly version with diode and resistor have less current losses.

I made new version with classic voltage divider and diode protection for Raspberrys TX pin. Is this version better?

There was no protection in the original circuit in fact it was putting the Pi's TX pin under strain.
The problem with the upper circuit is that it further reduces the output from the Pi I to the arduino's RX and it is already on the margin. You would be better off removing that diode as it is not dou g anything for you apart from making things worse.

I was afraid of that voltage drop because of the diode.

Is there any other way to protect Raspberrys TX port? Otherwise i can't upload sketches to Arduino if Raspberry is connected, right?

Ah, itis the words you are using that are not quite right.
You want to provide a degree of isolation not protection.
Protection is taking precautions against excess voltage conditions.
Isolation is ensuring there is minimum interaction between the circuits that is a diffrent matter.
The serial lines have a 1K seriese resistor in them so that they are able to be over ridden by another circuit. So that means if you want to program the arduino that has to override the Pi's circuit, therefore making the Pi's input even weaker and so less reliable in normal use. But then it has to over power the USB input in normal use, see what I mean, it is impossible to do well with this sort of circuit.
What is wrong with just plugging the USB of the arduino into the Pi?

So the best and safest way would be to use level converter (something like this -> 4-channel I2C-safe Bi-directional Logic Level Converter [BSS138] : ID 757 : $3.95 : Adafruit Industries, Unique & fun DIY electronics and kits )

I think i will go with USB cable for start.. Actually i totally forgot on this option. Easier is better.. and safer in this case :smiley:

or even this for a dollar cheaper...

or if you prefer the colour red !

just noticed this 74LVC245 - Breadboard Friendly 8-bit Logic Level Shifter : ID 735 : $1.50 : Adafruit Industries, Unique & fun DIY electronics and kits (for a "dollar-fiddy"...)
and was wondering how it compares with the actual level converter referenced above.

From the datasheet;



#1 This octal bus transceiver is designed for 1.65-V to 3.6-V VCC operation.

#2 The SN74LVC245A is designed for asynchronous communication between data buses. The device transmits data from the A bus to the B bus or from the B bus to the A bus, depending on the logic level at the direction-control (DIR) input. The output-enable (OE) input can be used to disable the device so the buses effectively are isolated.

#3 To ensure the high-impedance state during power up or power down, OE should be tied to VCC through a pullup resistor; the minimum value of the resistor is determined by the current-sinking capability of the driver.
#4 Inputs can be driven from either 3.3-V or 5-V devices. This feature allows the use of this device as a translator in a mixed 3.3-V/5-V system environment.

#5 This device is fully specified for partial-power-down applications using Ioff. The Ioff circuitry disables the outputs, preventing damaging current backflow through the device when it is powered down.

Have i understood the following correctly based on the datasheet description above;

#2 means it's only bi-directional if you control that DIR pin - meaning there will have to be an extra digitalWrite() in place (to that DIR pin) before accessing a connected device in read or write mode.

#4 indicates both 3.3 & 5 V levels are available for the input side, but does #1 mean that output can only be 3.6V max ? Would this mean bi-directional capabilities are not available if there are 5V levels involved ?