Level shifting RS485 transceiver 5V to 3.3V UART

I am using SN75LBC184 transceiver (the one in orange block) which sends data to my ESP. This means that I need to shift the level to 3.3V as ESP operates at this voltage only.
I wanted to use discrete components and not IC. What I have right now that can be use is the following:

a. BCP55-16F (NPN Transistor)
b. T2N70002BK (N-channel MOSFET)
c. 2SC2712BL (NPN Transistor)

Also, the ESP has to read the DE/RE line, I am planning to use the GPIO16 so that means I also need a down shift level right?

I wanted to ask for guidance what circuit design I should use and explain the process as to how a 5V input from the D pin of the SN75 transceiver can be converted to 3.3V (I get confuse of the pull up resistor's purpose in the level shifting).

So I have to make a pcb design for two set-ups, either it can be used to function the 1st configuration or if 2nd configuration.

updated image:
1st configuration: ESP sends data to the SN75LBC184 IC (seen on the Main: TXD connection) , and the A and B pin of this IC is connected to an RS485 transceiver. As you can see the jumper (JP1) is shorted because the DE/RE line is connected to the VCC to enable transmission.

2nd configuration: ESP receives data from the SN75LBC184 transceiver of an external device (seen in the orange block). The jumper (JP1) is connected to the DE/RE line of the external device. and as the ESP should receive data from it, the external device's D (transmit) pin is connected to the RXD of the ESP.

Can you give a link to the data sheet?

Why don't you use 3.3V transceivers?

here's the link for the SN75 IC: SN75LBC184P Datasheet(PDF) - Texas Instruments

Because the external device has already the SN75 IC so I decided to use that as well for my circuit.

As your design only receives, then do you need this?

Is the SN75184LBC powered from 5V? Wouldn't a simple potential divider on the D pin step the 5V down to the 3.3V level required.

Are you trying to sniff the data on another circuit of which the SN75184LBC is a existing part?

I cannot read your non scalable circuit diagram and don't understand your needs.

Level shifters can be constructed from a single MOSFET, see I2C level shifter circuit diagrams.

this is correct for the 'rx' line, but a simple voltage divider will do. R -> 1K -> RX -> 1K -> 1K -> GND

the !RE / DE LINE are inputs on the transceiver and will respond to 3.3v logic level just fine, but you don't 'read' that line you control the transceiver's direction with it.

So keep things simple, just 3 (metal-film) resistors with a relatively low value will do the trick and are fastest.

Sorry for the low quality picture that is what I have right now.
With the MOSFET, I am confuse that there are that inverts the signal? And I am not sure of the right configuration and values needed for the resistors.

Thanks for the clarification, so what will happen if I connect both the DE/RE line of the transceiver on my circuit and the DE/RE line of the external device?

I will try to use the voltage divider network, but I just wanted to ask, is it efficient for my circuit? Won't it affect the sending and receiving of data?

No, that's almost the only (simple, active) level shifter that does not invert the signal.

Low enough to drive the connected input high (1-10k) if not already part of the circuit.

D is an INPUT NOT an OUTPUT
Do you mean to connect to R?
Is the ESP Sending data or Receiving data?

both will be in the same direction depending on what logic level the GPIO has, if both are in drive mode at the same time that will result in your transceivers breaking probably, while when both are in receive mode nothing will be communicated. If you are going to connect parts of your external device (other than the A & B lines) to your circuit, you may as wel omit the transceivers and keep things simple. The transceivers are used to pass significant distance as well as providing separation between devices. If these are not required you should simplify things.

@yessi23 can you explain a little more what you are trying to do. It looks like you are trying to listen in to the Comms of an existing circuit.

I am required to have 2 configurations with just 1 pcb design. I have updated the post to be more clear.

First config is ESP sending data JP1 is shorted so that DE/RE line is connected to VCC which will pull them high to enable the transmission.

Now for the second config, ESP should receive data from the external device that is why JP1 will be open, and that DE/RE line is connected to the external device's DE/RE line. That is why I connected external device's D pin (transmit pin) to the RXD of ESP (receive pin). This is how I tried to connect them as for my understanding, am I doing the wrong connection between ESP and external device?

I tried updating my post and clear things out, like I have 2 configurations that either if used, should be functional.

Thanks for answering, that means that connecting DE/RE line of my circuit to the external let's them be synchronized. And because the external device should send data to my ESP that is why I connected its D pin (transmit pin) to the RXD (receive pin) of the ESP. And this is where I should put a level shifter right? to convert the 5V from external device and shift it down to 3.3V to the receive pin of ESP.

yes but D (Drive) on the transceiver should be connected to the ESP's TX The ESP transmits through the TX to D and that will make the transceiver transmit.

Well first of all R (receive) of the transceiver should then be connected to RX on the ESP, through the voltage divider i described before to reduce the logic level, and the !RE & DE pins should simply be pulled LOW. In fact the easiest solution is to always connect R4 (the 10K resistor) to VCC and use it as a pullup, and move JP1 to between !RE & DE and GND so that unless JP1 is closed it will be in transmit mode, and closing it will put it in receiver mode. There are of course other ways, you could leave JP1 the way it is and use R4 as a pulldown instead, or you can connect !RE & DE to a GPIO pin and control the direction of the transceiver from the ESP's software.
Main thing is
TX -> D
R -> voltage divider -> RX

Sorry for not clarifying it, the GPIO2 is an extra TX as well, so it is a TX pin of ESP. Here is the datasheet for ESP WROOM
image

Well first of all R (receive) of the transceiver should then be connected to RX on the ESP

With this statement, does it mean the R pin of the transceiver in my circuit? or transceiver of the external device? (Still a little confused, I apologize for not understanding it).
Does it mean that the external transceiver, is still be using its D pin to transmit data and this pin should connect to the R pin of the transceiver of my circuit? Do I have a wrong understanding that the external device when transmitting, its transceiver D pin is directly connected to the RXD pin of ESP?

Thanks for the jumper suggestion, but if putting a jumper and shorting it to ground would ofc make it in receive mode, but the R4 is still in VCC won't it affect the mode at RE/DE? (I just want to clarify this part).

And I do get the voltage divider you are pointing out. I am planning to use this:


but also one question, I have seen some videos that voltage divider network is not that reliable enough as there could be power dissipation and it would heat up and as well as shifted signal is not that smooth square wave when using oscilloscope at higher frequency.

something like this? (haven't edited the JP1 that you suggested yet)


here from what I understood, D pin of the external device transceiver is connected to the R pin of the circuit's transceiver (blue wire connection). And then the RX pin of the ESP is connected as well in that connection?

You will need a 3.3V to 5V level shifter and a 5V to 3.3V level shifter.
You can use the T2N7002BK and the 2CS271BL that you already have to do the shifting
NOTE: These shifters invert the signals, so you must invert again in your ESP code

Sorry but by now i have no idea of what you are trying to do. Your PCB should have only 1 transceiver which can be used as a receiver or a driver depending on what logic level is applied to !RE & DE.

if there is a 10K pullup, then connecting it to GND will make it GND, disconnecting it from GND will make it VCC

does the trick, but lower resistor values allow for higher speed, what baudrate are you intending to receive at ?

That is nonsense, the 3.3v logic levels are easily enough to make the D of the transceiver 'HIGH'

Yes I only have 1 transceiver for my circuit this one:
image

the one in orange block/square is an external device also having the same SN75 transceiver, and this is the one that sends data to ESP
image

That is why I am trying to ask for assurance if the R (receive) pin you are referring the transceiver on my design and not the external device's transceiver.

Thanks for clarifying this pull up resistor. It will look something like this base on your suggestion.
image

does the trick, but lower resistor values allow for higher speed, what baudrate are you intending to receive at ?
Right might as well just use 5k and 10k resistors? The baud rate is at 9200.