Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Removing DC offset from ADC Buffer

Status
Not open for further replies.

blue_diode

Newbie
Newbie level 3
Joined
Aug 10, 2020
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
71
I'm using a STM32 Cortex M0+ to read an AC signal from a CT. I'm sampling at 6kHz and storing 400 samples. The signal has a DC bias equal to Vcc/2 = 1.65V. In the digital domain this is 2048. When there's no input signal, I only read the DC bias which is OK. Have a look at the dc_bias_raw.txt file. As you can see, the readings are not so bad. It varies from 2044 to 2052. The DC bias is very precise in hardware so I think this variation is due to the noise floor. Now if I want to do RMS in that set of data, I need to find a way to deal with this DC bias variation. In the file adc_raw_current.txt you can see the samples when there's an input signal.

I have been thinking the following:

1- Subtract a fixed value of 2048 from each ADC reading. This is no so good as I said above this value may vary slightly. Also, if I want to read zero cross it may cause errors to choose exactly 2048 as reference.
2- Sample the DC bias and average it.
3- Don't remove the DC bias. If I calculate RMS then I would get the DC value when there's no input signal.
4- Use a more sophisticated software high pass filter

I appreciate any help or suggestion
 

Attachments

  • adc_raw_current.txt
    4.6 KB · Views: 91
  • dc_bias_raw.txt
    12.9 KB · Views: 91

Hi,

"More sophisticated high pass filter".
This sounds rather difficult.
Good news: it's way less difficult than RMS calculation.

I'd adjust the high pass filter with your RMS algoritm.
--> How do you do the RMS calculation?
Blockwise? Reading n samples in a buffer, then processing RMS?
If so, then first do an average on all the buffer values. Sum up all buffer values the multiply by "1/n".
Then do the RMS by "buffer_value(n) - average"

Other methods are for continouos measurement
* biquad high pass ( read_ADC --> high pass --> store in buffer)
* low pass to get DC value, subtract this value from ADC_values

Klaus
 
Last edited:
Some ARM Cortex parts have differential input capability for SAR or DelSig.
So you could take your precision Vref and feed that to - input such that
you are digitizing a +/- range about that Vref, eg. the diff input subtracts
out the offset. Some parts even have a fairly precision Vref on them, +/-
.1%.

1600598396888.png


Shown above is a Cortex part with both a SAR and DelSig and +/- .1% Internal
Vref, all single chip. The Vref can also use onchip PGA to G up its value, but
the PGA G accuracy probably would not support 12 bit absolute accuracy.
Or you can use external Vref. Note OpAmp also on chip (there are 4 of them).
You could use onchip OpAmp with external precision Rs to G up the Vref and
get the accuracy, just a thought. Note the DelSig is up to 20 bits, so you can
manage errors better. If you need more channels also onchip analog muxes
to manage that.

Adding a filter or a subtractor adds error and noise.


Regards, Dana.
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top