Bipolar voltage measurement - Page 1
Forum section: electronics / projects

author: markus.p
author_rank: Newbie
timestamp: October 08, 2025, 11:32:47 am
content: I need to measure the voltage of an external 24V supercapacitor using a microcontroller, regardless of the polarity of the external capacitor.A conventional approach is to scale down +/-24V to (for example) +/-1.5V and shift the voltage up to a positive level, in this case 0.15V to 3.15V. This is done using a reference voltage of +1.65V (+3V3A / 2).However, this poses a potentially dangerous edge case. If the capacitor is reverse connected (VCAP = -24V), and the circuit is not powered on, the LDO will produce an undefined output and +3V3A will not be generated. Consequently, a negative voltage could pass through to the op amp input and ADC.Requirements:Measure +/-24V using an STM32 microcontroller ADCOperate safely even when an external capacitor is reverse connected and the power is off (battery disconnected)Measure voltages down to VCAP = ~0V (making a series diode unviable)The capacitor voltage must be referenced to groundTo solve this edge case, my main concept at the moment is to use a normally open (NO) analog switch (MAX14759) to gate VCAP. The switch only closes when +3V3A is generated. (An alternative solution could be to use a reed relay).Will this work as intended, or are there problems I'm not aware of?

author: Terry Bites
author_rank: Super Contributor
timestamp: October 08, 2025, 04:35:32 pm
content: That could work. I think that that Vcap should connect to the analog switch via a series resistor to limit current through the internal protection diodes.I'm a bit suspicious of "Large dv/dt on the inputs causes large capacitive charging currents, which have to be limited to 300mA to avoiddestroying the internal diodes." 300mA seems very high. I'd be thinking a few mA.

author: markus.p
author_rank: Newbie
timestamp: October 08, 2025, 04:59:49 pm
content: Thank you for the heads up, I overlooked that part of the datasheet

author: PCB.Wiz
author_rank: Super Contributor
timestamp: October 08, 2025, 06:49:05 pm
content: Quote from: markus.p on October 08, 2025, 11:32:47 amUsually the divider resistors are large enough for that to not be a problem, and you can always add a negative clamp diode, since no LDO means no measurement anyway.

author: fchk
author_rank: Frequent Contributor
timestamp: October 08, 2025, 07:40:48 pm
content: Quote from: markus.p on October 08, 2025, 11:32:47 amA missing +3V3A can also pose a problem for the MAX14759. Many chips have a charge pump that produce a negative voltage to bias the substrate. This generates blocking PN regions so all the transistors on the chip stays isolated from each other and no current flows through the substrate. If the chip is unpowered the substrate is unbiased and bad things could happen.I'd use a voltage divider right at the VCAP input. This limits the current so the internal protection diodes of the Opamp can handle it.

author: markus.p
author_rank: Newbie
timestamp: October 09, 2025, 06:43:47 am
content: Thanks for the reply! If I have understood the datasheet correctly (page 11, "Nonpowered Condition"), that should not be a problem. It states that the pins can tolerate +/-25V even when the MAX14759 is not powered (although I have no idea how)

author: Terry Bites
author_rank: Super Contributor
timestamp: October 09, 2025, 07:32:33 am
content: Its not very clear on the maximum current allowed into any pin in the off state.It doesnt spevcify what current is permissible @25V. I'd still err on the side of caution.In fact, I'd install my own external input protection. A resistor and Shottky diode clamps.Relying on the MAX14759 to save the day is a risk.I'd prefer to have the magic smoke come from $1 worth of components rather than an $8 part.Especially because the MAX14759 doesnt have a drop in replacement.BTW, see attached app note from TI. Very handy single supply scaling stuff. I must write a script for doing this stuff one day.

author: sourcecharge
author_rank: Regular Contributor
timestamp: October 09, 2025, 11:54:30 pm
content: some resistors, 5 opamps, 2 relays, and 2 zeners.output is only positive, 3.15V to 0.15VMeasures +/-24 to 0Vdepending on your relays, adjust the resistance for the current capacity of the selected zener.Mode of operation:Takes the input voltage, divides it down, buffers it, and then amplifies the output into saturation.Saturation only turns on one of the two relays at a time.This can be done with mosfets, but relays are easier.the original buffered output is then put through a differential opamp, and then level shifted using 2 inverting opamps.This can be done with summing opamps too.if you are worried about connecting the vcap to the input of the opamp before power on, you can add a relay after the divider, and only pass the input bipolar voltage when power is turned on.This isn't exactly what you wanted but it's an alternative.so instead of -24V being 0.15, it's 3.15, just like 24V.over the 3V of the ADC, this would give you more resolution of +/- 24V to 0V.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: October 10, 2025, 01:41:46 am
content: Quote from: markus.p on October 08, 2025, 11:32:47 amAn alternative approach is to use an absolute value amplifier / ideal rectifier. Modern CMOS opamps with RRIO make this easier to do.That folds +/- 24V so -24V and +24V give the same maximum scale and 0V is 0V, so you get more ADC resolution this way.The CAP connects via high value resistors, so it is very safe, no negative switching gymnastics needed.

author: Terry Bites
author_rank: Super Contributor
timestamp: October 11, 2025, 08:02:35 am
content: I had some more thoughts about the internal anlaog switch protection devices.Unless there are some magic in the chip there will be a problem.I imagine that the ESD diodes will be very distressed.From the datasheet:"A, B, A1, A2, B1, B2, COM .................... (VN - 0.3V) to Lesser of(VP + 0.3V) or (VN + 52V)"That 0.3V over voltage tells you that there are internal diodes from the various inputs to the supply rails and the there is some kind of transient voltage suppression with a breakdown voltage of VN + 52V.300mA has to be a surge rating not continuous, at 24V the dissipation would be 7.2W!The absolute maximum allowed for the MAX14759 is 2W. Melt down can be expected.I have sketched out an alternative circuit that can be used with any (low cost) single supply analog switch.The effects of Ron are eliminated and the protection diode current is very low under fault conditions.I've show Schottky diodes but 1N4148 types would probably be sufficent.I also found this better app note on single supply scaling and offset stages.