Read battery voltage before buck converter, ripple problem? - Page 1
Forum section: electronics / projects

author: adhoc_user
author_rank: Contributor
timestamp: March 09, 2017, 08:00:00 am
content: Hi Folks,we want to measure the voltage of the 2 LiPo batteries (~6...8.4V) on our microcontroller with adc range of 0...3.3V.An OpAmp is connected to the batteries, which subtracts 5.1V to maximize adc range. But the buck converter, which is also connectet after the batteries procuces a lot of ripple there.1. pic: buck converter schematic2. pic: battery voltage3. pic: second opamp output; to adc input4. pic: op amp schematicAs you can see on pic 3 there is a huge voltage difference, without capacitors C2 and C8 the signal looks distorted.How we can reduce the peak to peak amplitude on opamp output to measure a smooth signal?Thanks!

author: Siwastaja
author_rank: Super Contributor
timestamp: March 09, 2017, 09:09:46 am
content: RC filter.That being said, your opamp schematic shows a large capacitor directly connected to the opamp output. Most opamps go unstable from this and start oscillating, so you are probably seeing oscillations instead of PSU ripple.You can reduce the 1u to something between 10n and 100n, which is enough to really filter the reading and provide low impedance source for ADC. Then add a series resistor to the opamp output (before the cap), at least around 50-100 ohms, this is enough to stop the oscillation. You can use larger resistor (and/or a larger capacitor, so use the 1u is ok if you want to use it) to RC filter more, because the battery voltage doesn't need quick reaction anyway, so I can't see anything wrong with 1K + 1u, for example.

author: adhoc_user
author_rank: Contributor
timestamp: March 09, 2017, 10:29:28 am
content: Hi Siwastaja,thanks for the response!we have changed the schematic and added a low pass with your suggest 1µ/1k.After our soldering the signal is better, but not good enough for the adc (high peaks). Should we change the capacitance/resistor?1. pic: new schematic2. pic: opamp-output3. pic: zoom in from pic 2

author: Siwastaja
author_rank: Super Contributor
timestamp: March 09, 2017, 10:38:27 am
content: How is the capacitor located, and how do you measure the signal?Capacitor should be physically right next to the ADC input pin, and you should scope the signal directly over the capacitor, using the small metal ground spring instead of the alligator ground clip.

author: capt bullshot
author_rank: Super Contributor
timestamp: March 09, 2017, 11:50:34 am
content: Save yourself the trouble and forget about the usefulness of full ADC range.Throw away the LM358 and use the usual 3 components: a resistive divider to fit the battery full scale (7.4V) to about 90% the ADC input range (you'll need some spare range for component tolerances etc.), and one suitable capacitor from ADC input to GND.You get plenty of additional resolution by summing up a significant amount of ADC (64 to 1024) readings to your final result. This summing will also reduce the noise induced by the ripple - and bob's your uncle.

author: adhoc_user
author_rank: Contributor
timestamp: March 09, 2017, 01:40:54 pm
content: @SiwastajaThe capacitor is located directly on the opamp, the adc input is ~3cm away and i used the ground alligator clip on the probe. But also with the local cap ground the signal is not better.@capt bullshotyeah thats rigth, it's much easier. In our previous version we used a voltage divider. But even with 10k samples the average value was sometimes 0.2v away from the real value. We will change the design with the voltage divider and a RC filter, this should be fine. A LTspice simulation was also okay with a small sin wave in the dc.Thanks!

author: capt bullshot
author_rank: Super Contributor
timestamp: March 09, 2017, 02:39:53 pm
content: Quote from: adhoc_user on March 09, 2017, 01:40:54 pmThats quite normal when you're using an ADC input of a micro with high DC source impedance. Although the ADC input appears to be high impedance, it draws a dynamic current which in turn causes some voltage drop over the source impedance. Nothing that cannot be taken care of by some calculation and software.

author: StillTrying
author_rank: Super Contributor
timestamp: March 09, 2017, 03:44:37 pm
content: Quote from: capt bullshot on March 09, 2017, 11:50:34 amQuote from: adhoc_user on March 09, 2017, 08:00:00 amIn theory this is all you need, a 10 bit ADC value will still have a resolution of about 0.0083V at the battery.If you can spread the 64 or whatever readings over an exact number of mains periods, the mains wobble will average out to zero, 100ms is good as it covers both 50Hz and 60Hz.

author: David Hess
author_rank: Super Contributor
timestamp: March 10, 2017, 03:56:25 am
content: The switching regulator may be injecting all kinds of noise into ground if the ground is not laid out carefully.An LC filter (actually CLC filter) at the input of the switching regulator will be necessary to get a cleaner signal from the battery. This might be a good idea anyway to reduce EMI.