Level Shifting – How to Shift Levels of a 3 State Pin

analogbattery-chargingdigital-logicmicrocontrollerresistors

I want to design a simple battery charger using MCP73831/2. This chip has a 3-State state pin according to the table below:

enter image description here

I have a 3.3V MCU and I want to connect this pin to a GPIO. The MCU is not 5V tolerant and maximum votlage on any pin is given 3.6V per datasheet (esp32).

My question is, how can I safely connect this STAT pin to my MCU? How can I translate its HIGH state (which is I guess 5V) to 3.3 and its LOW state to 0V (logic low). Is a resistor divider enough for this? or will I need to use mosfet or transistors? Here is my circuit:

enter image description here
enter image description here

Best Answer

Using a potential divider is fine.

Use a 10K upper resistor and 20K lower resistor, or higher values, rather than 1K and 2K. That avoids drawing current needlessly.

You can't detect the high-Z output this way, though, but your question implies that you don't want to.