# How can I differentiate between high and high-Z state?

I'm using this MCP73831 device.

I want to know how what to expect as a voltage level on the STAT pin when the below chart on page 13 says, STAT = HIGH & STAT = HIGH-Z.

When the charging is completed, I need to see HIGH voltage (say if Vdd is 5V, then HIGH would indicate 5V) 5V on the pin, as it is mentioned as HIGH.

When it is mentioned as high-Z state, then also, I will see the same 5V, right?

How can I differentiate between high and high-Z state?

This charge complete mode would also mean the same when there is no battery connected to Vbat right? So, when charging is complete or the battery is disconnected, then the STAT pins would show the same result, right?

• Can you place a small pull-down? Feb 2, 2023 at 10:42
• Feb 2, 2023 at 15:18
• High-Z means it is like the chip is not connected to the wire at all. So you will need to put something else on that wire, to detect that nothing is connected. Feb 2, 2023 at 20:16
• Why do you need to distinguish between the two states? Are you trying to identify whether a '31 or a '32 is being used? Feb 3, 2023 at 18:32

A trick I have used in this situation is to connect the line in question (Stat) to a GPIO pin on a microcontroller that supports internal pull-up and pull-down resistors. It does not need to have an ADC.

1. Activate that pin's pull-up resistor
2. Read and record the state of that pin
3. Disable the pull-up and enable the pull-down
4. Read and record the state of the pin again

If the pin reads high both times, then Stat is high. If it reads high, then low, then Stat is High-Z. And if it reads low both times, Stat is low.

Doing it this way has an added benefit of not consuming extra current for a voltage divider.

• If you theoretically had one of these microcontrollers (with high base frequency, >8x highest in the system you want to monitor) for every signal on a motherboard, could you completely read its state at any time? This would be very difficult to do non-destructively in practice Jan 4 at 0:50

A tri-state output pin is just like a normal digital output (high or low), but which the IC can also effectively disconnect from everything. This is achieved inside the IC using transistors, but you can picture it as follows:

simulate this circuit – Schematic created using CircuitLab

In the high-Z state (which means high impedance), the pin is essentially unconnected (inside the MCP73831, at least), so it won't source or sink any current.

As the datasheet suggests in section 5.2.1 (page 15), this behaviour can be used to power two different LEDs, or a single multi-colour LED, as a status indicator, but since you asked how to distinguish the high-Z state from the other two, I'll illustrate with an example.

If you want to interface this output to, say, an Arduino, one way could be to use one of the ADC channels to measure the voltage on STAT. Use a resistor potential divider to gently coerce the potential of STAT to half way between the supply potentials, whenever the MCP73831 isn't explicitly imposing an output there (ie. during high-Z):

simulate this circuit

Of course, be careful if Vdd is above the maximum permissible ADC input voltage! The STAT signal might need some additional tweaking, but I think you can see how the thing works now.

• Thank you very much for your detailed answer. Helps a lot. So, one question. For using the STAT pin, the Vdd of the MCP73831 and the Vdd domain of the Microcontroller should be the same, right? Or it can be different?
– user220456
Feb 2, 2023 at 12:48
• @Newbie They can be different, independent supplies, but that presents a whole new set of considerations and complications. Feb 2, 2023 at 12:59
• Oh thank you very much for the clarification.
– user220456
Feb 2, 2023 at 13:02
• I've this issue that, even when I disconnect the battery, I am seeing the Status pin as low. But ideally, it should be high impedance, right? Has this have anything to do with section4.2 on page 13?
– user220456
Feb 2, 2023 at 13:03
• It should be high-Z, but without some setup like the resistor divider I showed, a voltmeter connected between STAT and Vss would read zero in either high-Z or low states. Feb 2, 2023 at 13:08

I'm using this MCP73831 device.

The MCP73831/2 is internally configured like this as shown on page 2: -

So, specifically for the 73831, if the upper (p-channel) MOSFET is activated, the STAT output will be unambiguously high (when not in shutdown mode). For the other version (the 73832) the upper MOSFET is not present and therefore it can only be high-impedance (requiring an external pull-up resistor) or, a low logic level. The 73831 is a push-pull output and only goes into tristate (high impedance) when in shutdown mode.

If you were using the 73832 you would use a pull-up resistor to determine the status but, you are using the 73831 hence, it will be either high, or low and not tristate (high impedance) except when in shutdown mode.

$$\\color{red}{\text{My answer explains what the physical difference is between the two devices}}\$$

$$\\color{blue}{\text{Why the two devices are different is beyond the scope of the question}}\$$

Comments under my answer that seek to explain "why" the two devices are different are, in my opinion, unnecessary.

• To explain the reason they do this... the "open collector" version allows one pull-up resistor and multiple chips (which may or may not all be MCP73832) to share a single status signal. That way an MCU can read (and even interrupt) on "all cells finished charging" on a multiple-battery system, with just a single input pin. If you tried to share the STAT pin between two MCP73831 chips, as soon as one finished slightly before the others, you'd have a dead short from VCC to GND, burning out the IC output driver stages (and potentially causing other damage in the meantime). Feb 2, 2023 at 22:52
• @BenVoigt shouldn't this comment be under the question rather than specifically under my answer. Also, given that you have made an answer already why not put those details into your answer. At the moment the comment doesn't seem relevant to my answer. Feb 2, 2023 at 23:09
• Your answer is the only one that talks about the missing MOSFET in the '32, and provides the nice graphic of the internal variation in schematic, which my comment directly relates to. My "answer" was almost an edit to the question to add the Table 5-1 image. Feb 2, 2023 at 23:15
• It's irrelevant to my answer I'm afraid. Feb 3, 2023 at 0:02

This charge complete mode would also mean the same when there is no battery connected to Vbat right? So, when charging is complete or the battery is disconnected, then the STAT pins would show the same result, right?

With the MCP73832 those conditions would be indistinguishable, but with your MCP73831, it will change between High and Hi-Z as shown in Table 5-1.

So you do indeed want to distinguish between High and Hi-Z. I recommend @notloc's answer to you, as it doesn't require any additional circuitry.