Measuring wide range of currents with ADC - Page 1
Forum section: electronics / general

author: Red_Micro
author_rank: Regular Contributor
timestamp: April 16, 2020, 11:13:29 pm
content: I'm designing an amplifier to read currents using a CT from 10 mA to 30A with a STM32 with no FPU. I have the following data:CT turns ratio = 1000:1Burden resistor = 10 ohmsADC reference = 3.3 VDC shift = 1.65V (2048 adc count)Amplifier gain from 10 mA to 10A = 8Amplifier gain from >10A to 30A = 2Let's say I want to read 10 mA:Secondary current = 10 mA/1000 = 10 uAVburden = 10 uA * 10 = 100 uVVpeak = 100uV * 1.41 = 141.42 uVVadc_in (amplified) = Vpeak * 8 = 141.42 uV * 8 = 1.13 mVVshifted = 1.13 mV + 1.65V = 1.65113VAdc_count = (Vshifted*4095)/3.3 = 2048.90 = 2049I can also say:Vadc_in(pk-kp) = 1.13 mV * 2 = 2.26 mV (peak to peak)Adc_span = (2.26 mV * 4095)/3.3 = 2.8 ~ 3So if I have 3 counts for a 10 mA primary current,1 count = 3.33 mAOR 3.33 mA/ADC countNow, let's say I want to read 15 mASecondary current = 15 mA/1000 = 15 uAVburden = 15 uA * 10 = 150 uVVpeak = 150uV * 1.41 = 211.5 uVVadc_in (amplified) = Vpeak * 8 = 211.5 uV * 8 = 1.692 mVVshifted = 1.692 mV + 1.65V = 1.651692VAdc_count = (Vshifted*4095)/3.3 = 2049.6Doing the same calculation for 10 A, I get 2.78V peak at the ADC input, and 2749 count.Is this approach right? I don't need to do RMS, that's why I think I can get away with just finding the peaks. Also, look at the case of 10 mA and 15 mA, the ADC count is almost identical, i.e., 2049. If I do the DC shift subtraction by software, that is, 2049-2048 = 1. There would be a lack of precision I think. I would get the same values for 10 mA and 15 mA. Please, correct me where I'm wrong.

author: thm_w
author_rank: Super Contributor
timestamp: April 17, 2020, 08:17:24 pm
content: As you said, ~3mA per count so trying to measure a difference of ~1 ADC count is going to be rough, its down in the noise.Probably need to move to a higher bit ADC, 14-16bit, if you need more resolution than 10's of mA.

author: Red_Micro
author_rank: Regular Contributor
timestamp: April 17, 2020, 10:45:46 pm
content: Quote from: thm_w on April 17, 2020, 08:17:24 pmI think I can get away with 12 bit ADC if I split my wide range (5 mA to 30A) in different ranges for different gains. It's easier for me to have different gains for certain ranges than switching to a 16 bits ADC. The thing is to have more counts, as 1 count difference will be hard to deal with.

author: hans
author_rank: Super Contributor
timestamp: April 18, 2020, 07:56:25 am
content: You're trying to resolve 10mA in a range of 10A. This means you try to engineer a 1000 count measurement.You have a 12-bit ADC, so basically 4096 LSB's. But you have to drop 1/sqrt(2) range due to sinusoidal signals, and therefore only have 4096/sqrt(2)/1000 = 2.896 ADC LSB/count, which results in approximately 3.45mA/LSB.Edit:Also, I assume you will also measure the negative peaks. In that case you only have 2048 LSB of resolution for the positive half, and therefore only measure 6.9mA/LSB.If you expect a regular ADC to have severalbitsof noise (say 1-2), you're really trying to resolve those 10mA into the noise floor. Since you're dealing with AC signals, oversampling is hard because you need accurate synchronization on your sinusoidal inputs.I think the division between your current ranges is odd. You may get better results if you try to resolve 10mA in a range of say 2 to 4A, and then allow for a significant gain decrease in the 30A range.Alternatively pick a higher resolution and low noise ADC.