cancel
Showing results for 
Search instead for 
Did you mean: 

Implement oversampling.

MAnsa.1
Associate II

HI guys, i am using stm8s003f3.which have 10bit adc but my application count is more than 1024.so i am looking for some sample code of oversampling to reduce my adc step size.

if anyone have any sample or reference plzz do suggest n tell me how to implement it in ssoftware with proper resolution.

Thanks!!!

8 REPLIES 8
Ozone
Lead II

Oversampling is mainly helpful for noise reduction/filtering, you hardly get a useful gain in resolution.

I would consider a 12 or 14 bit external ADC with serial interface, or another MCU.

> ... but my application count is more than 1024...

I am not sure what that is supposed to mean.

You can left-shift the results (i.e. scaling), to get 12 ... 16 bit values.

While it does not increase resolution, it can be useful to "normalize" values from different input sources for commonly used routines.

so there is no other way to increase resolution internally????

Ozone
Lead II

If it's a 10-bit ADC, it is 10 bits.

It has its characteristc errors that scale up with any calcualtion as well.

> ...which have 10bit adc but my application count is more than 1024

Why do you think you need more ?

I worked on several commercial MCU applications successfully using 8-bit ADCs.

my requirement is 2000 count.

Cristian Gyorgy
Senior III

See AN3137 and you could also take a look at Atmel's application note AVR12: Enhancing ADC resolution by oversampling.

can you please share the link??

> If it's a 10-bit ADC, it is 10 bits.

As strange as it seems... It's not true. From the same AVR121 mentioned in other comment:

Doubling the sampling frequency will lower the in-band noise by 3dB, and increase the resolution of the measurement by 0.5 bits.

Therefore for example oversampling 256 times will effectively gain 4 additional data bits turning ADC from 12-bit to 16-bit. That is exactly what STM32L4 can do with it's 12-bit ADC. Though there is a small gotcha - the signal has to have some noise. However typically that is not an issue.

Also the delta-sigma modulation used in modern ADC and DAC chips is based on oversampling - running at a lower resolution but with a faster sample rate. DSD format and Class-D amplifiers take it to the limit. Basically those operate on a highly oversampled 1-bit digital audio stream.

It's AVR121 and you should learn using web search engines!