• Not Answered

Oversampling ADC

1. How to perform oversampling adc on MSP430 with analog s/g, any example code explaining this.

2. Can oversampling on DC voltage can be done also. ?

11 Replies

  • Most ADCs in MSP430 can perform up to 200000 samples per second. See data-sheet and device sample code.

    Oversampling  DC? Do you know what "oversampling" means?

  • In reply to old_cow_yellow:


     i don't know much abt oversampling.

    I read abt it on net, it shows how resolution can be increased for an analog signal, by sampling at freq greater than nyquist.

    I didn't know this method earlier in which resolution increases for analog signal.

    So I wonder is there any method of dc signals?     not particularly oversampling term . Just want to know the method, if any.

  • In reply to Aamir Ali:

    When a signal is sampled for A/D conversion, it's frequencies are repeated around each harmonic of the sampling frequency (aliasing). If the sampled signal has components at frequencies bigger than the sampl. freq/2, this components are aliased and appear as noise. So filtering is needed to limit the components of the sampled data. SInce making a filter with a very steep rollof is very difficult, oversampling puts the aliases at farther frequencies and makes the design of the filter simpler.

    Oversampling is also used to improve resolution, if you take four samples of a signal you could get two more "bits" at the expense of less bandwidth of the sampled signal. This principle is in the core of delta sigma converters.

    I have presented the issue to you in a much simplified way, I advice you to read further

    I don't understand your question regarding DC oversampling.

  • In reply to Avi Chami1:

    Oversampling is also used to improve resolution, if you take four samples of a signal you could get two more "bits" at the expense of less bandwidth of the sampled signal. This principle is in the core of delta sigma converters.

    Well, that's only partially correct. Well, one type of oversampling is noice cancellation by sampling at a higher frequency and calculate an average, This acts like an external hardware low-pass filter.
    Another type of oversampling is used in the delta-sigma converters like the SD16. Here the converter is a 1-bit converter only, with a feedback loop, an adder and an integrator. Taking a lot of samples and feedign them through a digital filter produces a (relatively) low-frequency result with high resolution. This is done in hardware, and taking more than one sample is just an averageing for noise cancellation again.

    The third kind of oversampling, the one that increases resolution, is one by adding a sinusodial wave of +-1/2LSB to the original frequency (by using an external analog adding circuit, like an OpAmp). Then four samples are take whose sampling frequency is exactly 4 (or 8, 12, 16) times the frequency of the added signal.

    This way, each sample contains the original signal and part of the overlay wave. THis will shift the signal over the next quantization step of the ADC for some of the time. How often this happens depends on how close the original signal was to the next ADC quantization step. The added wave will average out after a full waveform cycle.
    This way, you can get a 13 bit result from a 12 bit ADC by averaging 4 samples per wave, 14 bits by averaging 8 samples per wave etc.
    his method, however, requires external hardware. It is the only method that really increases resolution.

  • In reply to Jens-Michael Gross:

    Dear All,

    I too have a similar problem, for which oversampling seems to be the solution.

    I need to sense the output voltage of a analog multiplier (AD835), but AD835's output has a DC (0.9V) and a AC (2V rms) quantity.

    First i thought about RC filters and put one (R 100 ohm and C 0.1uF), but the AC wave still exists.

    When i sense this output voltage via my MSP430F2619's ADC channels, i get different ADC conversion

    values each time i start the conversion. In short, the AC wave is messing up my conversion results.

    So now, i plan to sample the output voltage a given number of times and take their average to get a stable ADC conversion result.

    If possible, a little help about how to achieve this would be great. Thanks.

    Best wishes

  • In reply to janmay b c:

    janmay b c
    (R 100 ohm and C 0.1uF)

    Low-pass cutoff frequency is 1/(2*Pi*R*C). So your low-pass filter has a cutoff frequency of 16kHz. Anything below 16kHz won't be filtered at all, and even above, a 32kHt signal will only be halved and 64kHz quartered.

    You don't write which frequency your AC signal has, but I doubt that your low pass will be able to filter it. You need a bigger capacitor and/or larger resistor. Or both. Much bigger.

  • In reply to Jens-Michael Gross:

    Hello Sir,

    That reply was incredibly fast, thanks :-).

    My output wave at 4kHz, just now tried again with a 100 ohm and 3.3 microFarad electrolytic Capacitor, cut-off freq at 482 Hz, still nothing sir, i still see the AC wave form.

    It should work right??, circuit fault (its on a bread board) or should i choose different components.??

    best wishes


  • In reply to janmay b c:

    With these values, the AC wave should be 20dB less (1/10 of the original amplitude). But of course still visible.
    Well, an electrolytic capacitor has some ESR (inner resistance), which counteracts its filter use. And since your series resistor is only 100Ohm, this will have a noticeable influence. But you should still see a significant reduciton in the AC amplitude.

    Did you wire it properly? resistor between MSP and signal and capacitor between MSP and GND.

  • In reply to Jens-Michael Gross:

    Dear Sir,

    Thanks once again for your super-fast reply :-)

    Fortunately, i was able to solve my AC-filtering problem. Here's what i did:

    I connected the shorter stem of the electrolytic capacitor to the R and the longer stem to the ground. That's it !!
    I had, previously, connected it the other way round. This time i used a massive 33 micro Farad Capacitor (electrolytic ) and R=100ohm, AC wave was filtered out beautifully :-). I think, polarity of the C connection does matter (i previously thought it does not , coz of the AC wave).

    best wishes


  • In reply to janmay b c:

    janmay b c
    I think, polarity of the C connection does matter (i previously thought it does not , coz of the AC wave)

    Well, an electrolytic capacitor isn't the best choice for an AC environment.

    Electrolytic capacitors are polarized for a reason. Other than with ceramic capacitors, which are purely based on size and distance of teh capacitor plates, electrolytic ones do have an electrolytic part which is sensitive to polarity. With wrong polarity, capacitance significantly differs and also the breakthrough voltage. While the second probably won't be a problem for small voltages, the polarity issue turns your 33µ capacitor in something significantly less. Also, ESR (inner resistance) increases and as a result, your cutoff frequency may be a decade or mor above what you thought.

    Now that you corrected polarity, it may or may not work. IIRC the AC part is larger than the DC part, so voltage goes into negative still. However, since the capacitor is after the resistor, the voltage is already averaged and teh remaining ripple is way smaller than the DC part and therefore still positive.

    For this reason, we sometimes use ceramic capacitors with up to 4.7µF, even though they are large and expensive compared to an electrolytic one. They have much less ESR, have no polarity problems, do not age (the electolytic component wears out over time), have a very small leakage current and have a higher voltage tolerance (at least in reverse direction) than the electrolytic ones. By far the better choice when dealign with analog signals.