# How to digitize an AC signal?

Let's say I have a sinusoidal signal of amplitude 5V and frequency 100Hz. I need an accuracy of 0.1% in the digital signal.

How to determine the ADC parameters required?

Do I need to apply an offset first?

How is the process different than that for DC?

• By accuracy of 0.1% you mean in the converted voltage level? You may also need to specify a sample rate significantly higher than the Nyquist frequency.
– Icy
Oct 15, 2015 at 11:16
• Yes, the voltage level Oct 15, 2015 at 11:58

I need an accuracy of 0.1% in the digital signal.

An 8 bit ADC has a resolution of 1 in 256 = 0.39% therefore you need to choose an ADC that is at least 10 bit (0.097% resolution). But resolution isn't accuracy and accuracy can't be achieved without a greater resolution so you need to start digging into the specifications of an ADC that might suit your needs.

You need to consider INL, DNL, offsets, gain-errors and noise to be confident about predicting accuracy. INL stands for integral non-linearity and here's a picture to help you understand: -

Basically it's a curvature problem and below here's DNL (differential non-linearity): -

Offset problems: -

Gain error: -

Pretty pictures stolen from here

Do I need to apply an offset first?

If it's an AC signal then you'll likely need to apply a DC offset to position the centre-line of the AC signal to the mid-point of the ADC input range.

How is the process different than that for DC?

It's no different - a slow moving DC value should be treated in the same way as a repetitive AC signal.

• could you please show me how you determined the % resolution? Oct 15, 2015 at 11:13
• It's just $$1 / (2^n)$$ Oct 15, 2015 at 11:14
• @pjc50 That was a very dramatic comment ... the suspense was intolerable before my eyes reached the math! Oct 15, 2015 at 16:58

Another method of getting the offset (so that your signal is centred in the ADC conversion range) is to use an amplifier specifically designed for the task such as the AD8132.

This device features a Vocm input, and will offset the input signal by the DC level on this pin. It is common to expose the reference voltage used by the ADC (which is often the maximum voltage that can be converted) and divide it by 2 to get an offset in the centre of the ADC conversion span.

Your 0.1% accuracy requirement requires a signal to noise ratio of 60dB, so layout will be important (it always is in ADCs, it simply becomes more and more important with higher precision requirements).

There are many factors to consider when using ADCs to get the best out of them, and indeed to get what you need out of them. I particularly recommend reading the Effective Number of Bits (ENOB) section to understand what an ADC can actually do successfully. The PCB layout section is a source of excellent advice, as well.

Hope that helps guide you a little.

[Update] Added note that other manufacturers supply these devices.

Although I linked an Analog Devices part, ADC drivers (specifically designed for the purpose) are available from TI, Linear Tech and Maxim has some nice parts.

There are ways to avoid digitizing the DC offset, called "pedestal" in http://www.ti.com/lit/an/sbaa015/sbaa015.pdf The basic idea is (again) to use an RC network to create a low-pass filter (surprisingly!), so the details are different (than in your last question). The basic idea is:

In this circuit, the unfiltered signal is presented to the non-inverting input of the A/D converter and the DC portion of the signal is presented to the inverting input of the A/D converter. The 12-bit A/D converter will digitize the difference between its two inputs, consequently rejecting the DC portion of the signal.

I need an accuracy of 0.1% in the digital signal.

For that you need at least a 10-bit ADC. That means that you may get a quantization error of at most 1/2^n of your range, provided your signal fills the whole range of your ADC. However, this only accounts for the theorical minimum resolution you need. For real requirements, you need to account for noise, and that depends on a lot of stuff. To begin, you better use a 100Hz low-pass (antialiasing) filter (with the more stages, the better). That should take care of high-frequency noise. Then you should check the ADC's datasheet for non-linearity (which is usually considered as noise) and other internal error sources. Then you should check correct impedance matching (which when done incorrectly may increase noise). And since you are dealing with a very slow signal, you may also try Oversampling to get some additional bits from sampling at higher frequencies (software or hardware approaches). At higher rates you can also apply digital filters after sampling and before decimating.

How to determine the ADC parameters required?

Your most important parameters are resolution, sample-rate, noise and range. Assuming your "amplitude" means "peak amplitude", you need at least a 10V ADC to sample. Those are not common, so you'll probably need an attenuator or some other way to scale down your signal. Remember that those devices usually add more noise to the system (as does filters too) and that resistors add thermal noise too. Since you probably want to scale the signal a little more to avoid clipping and to allow for noise, you want to take into consideration how this affects your accuracy (your requirement is 0.1% of the signal, not of the ADC range).

Do I need to apply an offset first?

If your ADC is single-ended, you do need an offset. Adding an analog offset to the signal also adds its noise, so you should be careful selecting an analog reference which matches your requirements. Using a voltage divider from the power supply will probably get you into trouble because of noise (specially if using a switching regulator) and feedback. You most probably want to select a differential ADC to sample AC signals.

How is the process different than that for DC?

It is not. If you add an offset to a DC signal and use a single-ended ADC, you are actually sampling a DC signal, from which you'll have to subtract the offset afterwards. If you're using a differential ADC you have almost the same internals, except that you'll have a variable reference (which is part of the signal itself and usually avoids common mode effects) and the conversion allows for negative values.