# Measuring wide range of currents with ADC

#### Blue_Electronx

Joined Jun 10, 2019
112
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:1
Burden resistor = 10 ohms
DC shift = 1.65V (2048 adc count)
Amplifier gain from 10 mA to 10A = 8
Amplifier gain from >10A to 30A = 2

Let's say I want to read 10 mA:

Secondary current = 10 mA/1000 = 10 uA
Vburden = 10 uA * 10 = 100 uV
Vpeak = 100uV * 1.41 = 141.42 uV
Vadc_in (amplified) = Vpeak * 8 = 141.42 uV * 8 = 1.13 mV
Vshifted = 1.13 mV + 1.65V = 1.65113V
Adc_count = (Vshifted*4095)/3.3 = 2048.90 = 2049
I 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 ~ 3
So if I have 3 counts for a 10 mA primary current,

1 count = 3.33 mA

Now, let's say I want to read 15 mA

Secondary current = 15 mA/1000 = 15 uA
Vburden = 15 uA * 10 = 150 uV
Vpeak = 150uV * 1.41 = 211.5 uV
Vadc_in (amplified) = Vpeak * 8 = 211.5 uV * 8 = 1.692 mV
Vshifted = 1.692 mV + 1.65V = 1.651692V
Doing 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.

#### MrChips

Joined Oct 2, 2009
27,727
That is a long winded way of calculating resolution.
If your fullscale current is 30000 mA,
resolution using a 12-bit ADC is 30000/4096 = 7 mA
Hence 10mA and 15mA will be converted to 1 and 2 in the best of circumstances with zero noise.

#### Blue_Electronx

Joined Jun 10, 2019
112
That is a long winded way of calculating resolution.
If your fullscale current is 30000 mA,
resolution using a 12-bit ADC is 30000/4096 = 7 mA
Hence 10mA and 15mA will be converted to 1 and 2 in the best of circumstances with zero noise.
That's assuming I get 0.8mV per 7mA in the burden resistor, and unity gain amplifier. I think that doesn't match with my 10 ohms burden.

#### MrChips

Joined Oct 2, 2009
27,727
That's assuming I get 0.8mV per 7mA in the burden resistor, and unity gain amplifier. I think that doesn't match with my 10 ohms burden.

#### Blue_Electronx

Joined Jun 10, 2019
112