4
\$\begingroup\$

I am busy with a design that needs to connect a Raspberry Pi to an Arduino via UART. Previously I have designed a circuit that worked okay.

Prev Design
(source: protoneer.co.nz)

But now I want start using SMD components and is planing on using the following component: BSS138BKS + 10k Resistor Bank.

I am not an expert at these things and I am usually use designs from other circuits in my new designs.

My question is, will the BSS138BKS used like in the original setup with the 2N7000 be able to run continuously without issues.

And is this the right way to do level shifting between the two devices? (I don't want to damaging the boards).

Edit: Updated circuit enter image description here

\$\endgroup\$
3
\$\begingroup\$

The BSS138 should work just fine in your level shifter circuit. Just make sure to connect it's G, D, and S pins up in the same method that you used for the other FET. For a level shifter like this it is essential that the D (drain) pin be connected to the side that has the 5V levels so that the body diode in the FET does not go into continuous forward BIAS.

This type of level shifter actually supports bi-directional signalling but will work just as well with the unidirectional signalling of your UART ports.

When you build it up with the BSS138 parts you may want to check the rise time of the signals passing through the level translator. If they are too slow for the baud rate you intend to use you may need to lower the value of the pullup resistors on one or both sides of the translator FETs.

\$\endgroup\$
  • \$\begingroup\$ Every circuit tells a story. thanks for the bit about the pullups. :) \$\endgroup\$ – Bertus Kruger Mar 12 '14 at 5:59
3
\$\begingroup\$

Do both UARΤ connections refer to direct connections to the mcu pins? If any of the two boards is using a UART driver (MAX232 or similar) then you are going to have troubles caused by the bipolar voltages (about +8/-8v).

I haven't seen a level translator like this used for UART connection, not that it's not possible but usually there are faster alternatives like SPI or I2C (TWI) that can be used for short distances. If you are using UART in order to be able to transfer the signal to a long distance then I don't think it's going to work, you'll need to use dedicated UART drivers.

You can easily use two MAX3232 (or one MAX232 for 5v and one MAX3232 for 3v) with a few SMD capacitors and interface the two boards.

enter image description here


Note that for a unidirectional level translator there is another option, using a diode and a pull-up resistor (when there in not an internal pull-up that can be used).

schematic

simulate this circuit – Schematic created using CircuitLab

Basically the input is either pulled up by the pull-up resistor (when the output is high), or it is pulled down to about 0.7v when the output is low.
In the 3v to 5V direction the input will either be at 0.7v or 4v (3.3+0.7v).
In the 5v to 3V direction the input will either be at 0.7v or 3v.

In both cases the voltages are in the proper range to be translated as logic High and logic Low from the mcu inputs.

\$\endgroup\$
  • \$\begingroup\$ Thanks. Both UART connections are MCU to MCU.Looking at your unidirectional level translator, took me a bit to have an ah-ha moment but I am concerned about the 5V RX. IF its not set for input it might send a 5v down the line to the 3v3 Tx, right? \$\endgroup\$ – Bertus Kruger Mar 13 '14 at 4:46
  • \$\begingroup\$ @BertusKruger Yes, but you will have the same problem with the mosfet translator. In the 3v to 5v direction if the 5v side becomes an output then the 5v will reach the 3v side through the mosfet substrate diode. That is how the 5v to 3v direction works anyway, utilizing the substrate diode. The only way I see to protect the mcu in such a case (both output) is to add a series resistor that can limit the current between the two I/O. \$\endgroup\$ – alexan_e Mar 13 '14 at 8:32
  • \$\begingroup\$ @alexan: As far as I understand the mosfet level shifter this is not true. There is no "direction" because it's bidirectional. The substrate diode is always in 3V ->|- 5V direction and only used to transfer low on the 5V side to the 3V side \$\endgroup\$ – Scheintod Jun 24 '16 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.