Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By martinayotte
#25984
MikeBolton wrote:Yes, I have a real RS232 port. I have had bad experiences with serial to USB converters, especially at 115200B. Hence the HIN232 IC. This inverts the RS232 and gives 5V logic levels.


I think you have ever complexified the logic here for simple level logic shifter by adding 2 inverters.
Simply use a MOSFET with 2 resistors as shown here :

Image
User avatar
By eriksl
#26041 It could indeed be very well the case that the esp8266 can source/sink more current than certain logic parts (completely depending on the model and the technology used).

On the other hand a uart logic input should be well high-impedance, so it shouldn't draw any significant amount of power.
User avatar
By MikeBolton
#26046
martinayotte wrote:
MikeBolton wrote:Yes, I have a real RS232 port. I have had bad experiences with serial to USB converters, especially at 115200B. Hence the HIN232 IC. This inverts the RS232 and gives 5V logic levels.


I think you have ever complexified the logic here for simple level logic shifter by adding 2 inverters.
Simply use a MOSFET with 2 resistors as shown here :

Image


Martin

I think you have missed what I am doing again. The added logic has nothing to do with logic levels. My original scheme, without added logic, worked fine for PC to ESP only. The logic was added so I can send and receive between the PC, the PIC and the ESP at the same time. This required additional gating. As I was using NAND gates, there was an intrinsic inversion, hence needing to invert it back again. As I said, nothing to do with logic levels, just I found initially that my 4000 series logic output would not drive an ESP Rx input.

Anyway, problem solved with a transistor. Your MOSFET level shifter seems OTT for what I did with just a resistor and zener.

Mike B
User avatar
By eriksl
#26048 The approach from Martin (which was conceived by NXP, formerly Philips Semiconductors, way back when Philips still made interesting stuff) is superior over an approach with a resistor and a zener. The latter wil always draw some current which is unused and also zeners tend to have quite a bit of capacitance, which may give problems at higher frequencies.

Off topic: I am using BS170's for this purpose (I2C 5V <-> 3.3V shifter). Many times you don't need level shifters for I2C though, as long as the bus is pulled up by the lowest voltage. It depends a bit on how peculiar the 5V parts are.