# Automotive electronic circuit design: voltage divider to uC ADC pin

Automotive circuit requirement:

1. If input pin is connected to Battery(T87 line), the output of the circuit shall provide a output voltage of 5V to ADC pin of microcontroller, if the input pin is connected to GND, the output of the circuit shall provide a output voltage of 0V to ADC pin of microcontroller and if the input pin is left floating, the output of the circuit shall provide a output voltage of 2.5V to ADC pin of microcontroller.

The battery voltage in load dump condition could be up to 60 V, but in normal operation without any fault condition, it would be up to 32 V. Would a simple voltage divider (with a pull-up to 5 V) with a blocking diode be enough? Any other ideas? What parameters of the ADC of the microcontroller should be considered? Injection current into the uC ADC pin would be critical, right?

How do I find out the voltage thresholds?

Also, what are the parameters of the Schottky diode that I should look to select? The diode would decouple the input pin from the centre tap of the voltage divider, because in case the input pin is connected to the battery, the injection current into the uC ADC pin would be too high.

I have used a switching diode, since it was already available in the Bill of Materials.

• I don't think a voltage divider would work here, specifically for the "floating provides 2.5V" part of the problem. It doesn't seem like the output should be a division of the battery voltage, they want 3 distinct states. You don't want a half-charged battery to provide 2.5V and the system thinks the pin is floating. Feb 8, 2021 at 18:06
• Likewise, consider using a TVS to also help protect the µC. Automotive electrical is harsh. Feb 8, 2021 at 18:11
• @RonBeyer Hi, I have added the circuit above. I thought voltage divider would be right precisely for the floating condition. do you get my point now after looking at the circuit ? Feb 8, 2021 at 18:11
• @Nidhi - Hi, Just to clarify: This is a 24V (not 12V) automotive system isn't it? Thanks. Feb 9, 2021 at 11:39
• @SamGibson My circuit currently is for 12V systems, for 24V systems the ISO pulses would be +-600V. what are the parameters of the diode that I should look into ? Feb 10, 2021 at 13:03

If you are willing to swap the "high input" vs. "grounded input" output signal levels (in other words, a +5V output signifies a grounded input, and a 0V output means battery positive is connected), then this simple little window comparator using a pair of BJTs could work for you:

simulate this circuit – Schematic created using CircuitLab

D1 introduces a 4.7V difference "window" between potentials at the two bases, so that when a potential appears at IN, only one of the transistors can be switched on at any time.

When the input rises past 8V, the base of Q2 will begin to rise, eventually switching on completely, pulling OUT to ground potential. Q1 stays off because its own base-emitter junction is reverse biased. It can never be reverse biased very much, since the potential at its base is clamped to a maximum of just over 5V by D1 and the base-emitter junction of Q2.

R1 and R2 form a potential divider between the input and +5V, setting the input potential required to switch on Q1 at about 3V. When the input drops below that, Q2 switches on and pulls the output high to +5V.

With an input between these two thresholds, neither transistor is on, and the potential at OUT is set half way between the 5V supply and ground by R4 and R5.

In the case where IN is floating, not connected to anything, there's no source of current via R1 that can bias either transistor into conduction, so with both Q1 and Q2 off the output is +2.5V.

Here's a graph of $$\V_{OUT}\$$ vs. $$\V_{IN}\$$:

The circuit can tolerate input potentials over 100V. Resistor R1 is chosen to pass enough current via R2 and R3 to bias the transistor bases, but not so much that it dissipates more than 250mW. It's probably a good idea to replace R1 with a couple of resistors in series (totalling about 50kΩ), to share the input potential equally, and avoid having too much voltage across a single one.

I'd say a divider is not enough since from spec you need 5V when the battery is connected. Battery can go from about 8V to… nominal 18V but you need to protect for up to about 100V, in the worst case. There's an ISO with the required ''has to survive to'' signals. Your 32V maximum is probably referring to a jump start battery condition, IIRC it should be for not more than 60 seconds.

I would start with some appropriate TVS (there are parts specifically designed for load dump condition) to clamp to a sane level (usually about 30V, check the pass-thru rating of the diode). If you need a continuous 32V voltage, well, there are many ratings for these. A reverse protection diode (you don't want to source to the battery line) and at last a resistor-zener clamp to 5V and a pullup to 2.5V to handle the disconnected case. Spruce filter capacitors as needed since the battery line is hell.

Personally I would buffer the 2.5V and the output with a voltage follower to better isolate the circuit but it's not strictly necessary. That would also another good opportunity for filtering, if needed.

There is actually a case when this circuit would fail: during cold crank (starting the engine in winter) the battery line can (by spec) go down to about 4V, and this is the voltage you would have on your output line. It depends on your 'battery connected' definition and how much leeway on the output values you have.

Sadly this only works on low battery because of the diode leakage current. It's really not good practice. You could do a transistor contraption as an exercise but it will be difficult to reach the rails and have 'sharp' transitions. In 2020 we have better solution for these things (we actually have dedicated battery monitor ICs!)

In fact detecting the 'cable disconnected' situation is difficult in itself since any required protection or filter component will draw the signal toward one power rail (ground, usually). The same protection TVS, for an high impedance input, would be seen as a grounded line. I think the only way to do it is to try to force some small current out of it and see if it goes around to ground. This could be taken from the 5V rail since if it doesn't flow because there are 12V, well, you have 12V to see on the inputs. With some clever comparator positioning you could do it.

Definitely not simple, in my opinion. If there are definite battery thresholds, the usual way to do it is this:

• Let's assume that 2-4V is forbidden and will be detected as disconnected.
• Scale the battery down with the divider so that, say, 12V is 5V on the output
• Add a pullup to some reference voltage the battery can't have so that with the battery disconnected the voltage is 3V. This is where the network resistor exercises come to fruition!
• Zener it to 5V (4.7V, actually, is the nearest standard zener). Be careful to have enough zener current to make it work
• On the output place two comparators that pull up when the voltage is over 4V and pull down when the voltage is below 2V.

This is more or less what I would make:

Comparators must have push-pull outputs to work, it's a common variation on the window comparator (maybe there's an integrated version of it)

This has of course drawbacks on the original specs:

• There is a battery voltage range which is detected as disconnected;
• Output is not 0V and 5V but about 0.3V and 4.7V (a diode loss); this is not perfect but remains easily detectable.
• Thank you. Could you please add a rough diagram ? That would be greatly helpful Feb 9, 2021 at 2:10
• Also a pull-up to 2.5 V is not possible in my case. pull -up to 5V is an option since 5V is available as output from an LDO Feb 9, 2021 at 2:41
• Uhm… I fear it wouldn't work as expected with a connected 0V source. Well, it could by chance exploiting diode leakage, but it's not neat. I'll edit the answer later. Feb 9, 2021 at 7:34
• Oh, by the way, to pull to 2.5V just do a divider and pull from it :D Feb 9, 2021 at 8:30
• How about reverse battery connection and reverse jump? What part of the vehicle is this going to be mounted in. What class is it and the temperature requirements?
– Gil
Jul 23, 2022 at 17:27