Go Down

Topic: ADC Noise Reduction code please (Read 18 times) previous topic - next topic

Coding Badly

Quote
Would this work?

No.  The Arduino core does not support Noise Reduction Mode.  You will have to manipulate the registers directly.

Todd Houstein

Well, I'm sure a lot of people would find it useful to have a function that reads an analog input using ADC noise reduction, defined as such:

int analogNoiseReducedRead(int pinNumber)

But coding this is beyond my knowledge and skills. Anyone feel like taking it on and posting it here?

Coding Badly

Quote
Well, I'm sure a lot of people would find it useful to have a function that reads an analog input using ADC noise reduction

Why?  Have you noticed a problem with analogRead?

Todd Houstein

Quote
Have you noticed a problem with analogRead?


My analogRead values have been jumping around a bit. Admittedly, this could be due to any number of reasons.  However, I figured Atmel must have put the noise reduction mode in for a reason and thought I'd give it a try first.  But this didn't turn out to be so straightforward with Arduino, so I'm on to looking at my hardware now.

Coding Badly


In my experimenting, jumping analog readings are caused by...

1. General digital noise.  Cured by adding a 0.1 uF capacitor across VCC and GND as close to the processor as possible.  Already present on Arduino.

2. General digital noise.  Cured by adding a capacitor from AREF to GND and using the appropriate analog reference setting

3. General digital noise.  Cured by adding filtering to the analog input.

4.  CPU digital noise.  Cured by using Noise Reduction Mode.


I've only had problems with #4 on ATtiny processors or when reading the internal temperature sensor.  For the rest, the Atmel documentation is a good source of information and Grumpy_Mike has graciously written about filtering.  If you still have problems after adding filtering then it's time to add Noise Reduction Mode.

However, Noise Reduction Mode certainly won't hurt anything.

Go Up