Page 1 of 1

open drain setup with level converter

Posted: Tue Apr 27, 2021 9:45 am
by pidou46
Hello,

I have a device with momentary switches, this device is powered with 0/+5V.

I would like to simulate switch press with external mcu : ESP32

I know that esp32 pins can be configured in open drain mode to simulate a switch, but has the device to control is powered with grater voltage than esp32 should handle should I have to use a level converter?

My thought is that I should. I have some TSX0108E board laying around, according to data-sheet it should be fine to work in open drain mode but I doesn't manage to do it.
I don't understand how to make it work in open drain mode.

Do you have some advices for the setup ?

Should I connect the TSX0108E's OE pin to GND or VCCA with or without resistor ?

Should I drive the esp32 pin in open drain mode or as an output ?

How can I check if this setup work ?
With ohmmeter beetwen GND and TSX's output ? I should see the value changing from ~0_ohm and ~infinite_ohm right ?

Re: open drain setup with level converter

Posted: Tue Apr 27, 2021 11:48 am
by Roberthh
I would use a single transistor/resistor inverter (e.g. 2N7000) in that case. Easy to set-up, robust.

Re: open drain setup with level converter

Posted: Tue Apr 27, 2021 12:55 pm
by pidou46
Thanks for your answer Roberthh,

Image

According to the 2n7000 specification, how should I wire it ?

1: Source -> ground
2: Gate -> Esp32 pin (set as an output 0 or 3.3v)
3: Drain -> switch pin

Re: open drain setup with level converter

Posted: Tue Apr 27, 2021 2:03 pm
by Roberthh
Yes, that's a good wiring. You can also add a resistor between Drain and 5V, unless that already exists on the target board. So you would write a 1 to the GPIO port to get a low value and Drain, and a 0 to get a high impedance of the 2N7000.

Re: open drain setup with level converter

Posted: Tue Apr 27, 2021 3:58 pm
by pidou46
Thanks