Cleaner ADC measurements which of these ways is better

Hi All, I am trying to achiever more stable ADC readings and have few plans in mind but I am not sure which one is better can you provide you opinions?

Currently I have whole system (Atmega328p on PCB) powered by Switching regulator that provides 3.4V with stable ripple of 40mV at about 5Khz. Avcc feeds from the same rail and apparently Aref as well (measured with scope directly at the pins). I want to provide cleaner reference voltage into ADC so here is what I am thinking to do:

Plan 1 - Keep powering AVcc with same switching regulator that has 40mV ripple however use low pass (RC) filter and get smoother voltage curve into VREF. I'm thinking about R = 200R and C = 1uF, or play with values of RC chain so that voltage that goes into Vref does not drop too much, I want it to stay as close as 3.3V while being smooth.

Plan 2- Just to place LDO regulator after switching regulator and convert 3.4V into steady 3.3V into whole system.

What do you think?

If you feed a different voltage into AREF you need to call analogReference(EXTERNAL); in
setup() before using the ADC, to prevent the internal linking of AREF to Vcc.

3.4V to 3.3V is a very small voltage drop, I would suggest just filtering the 3.4V heavily, rather than
expecting a linear regulator to perform well with 100mV of dropout. Perhaps RCRC filter to AREF.

You might just try a capacitor first. The ATmega datasheet says:

The voltage reference may be externally
decoupled at the AREF pin by a capacitor for better noise performance.

But, it doesn't say what the impedance or suggest what value capacitor to use.

Plan 1 - Keep powering AVcc with same switching regulator that has 40mV ripple however use low pass (RC) filter and get smoother voltage curve into VREF. I'm thinking about R = 200R and C = 1uF, or play with values of RC chain so that voltage that goes into Vref does not drop too much,

That's worth a try. Like I said, I don't know the impedance but I assume it's much higher than 200 Ohms.

And actually, a fixed (and hopefully known) voltage drop would be OK. ...Your other solution was a voltage regulator to drop the voltage.

Or, you can use the internal 1.1V reference and a voltage divider on the ADC input (if necessary).

Switching regulator that provides 3.4V - Change that to 5V, power arduino with that, on board 3.3V should be clear.
For 5 kHz filtering, better use 1mH (or more) inductor instead an resistor.

A few ideas:

A LC filter (inductor and capacitor) for AVCC is very good, but not always needed.
Do not use a RC filter for AVCC.

It is not clear what is connected to AREF. I hope you did not connect the 3.4 V of VCC to it :confused:
Keep AREF open, but do add a capacitor of 100nF between AREF and GND. That does help.

I like the idea by @ted to change the switching regulator to 5V and add a LDO for 3.3V.

You could use the internal voltage reference of 1.1V. It is in the datasheet how much it rejects the VCC ripple. I forgot what it was, but it was a good number. Don't use the internal voltage reference when using an analog ratiometric sensor.

Use many samples to take the average if you have enough time for that.
When measuring a battery voltage or the light intensity or something else that is slow, the average of only 5 samples reduces the noise a lot. Sometimes I use the average of 10000 samples, but that's nuts. About 5 to 30 samples is often enough.

The best option depends on the sensor that you want to read. Reading a ratiometric sensor is not the same as reading a battery voltage.

MarkT:
If you feed a different voltage into AREF you need to call analogReference(EXTERNAL); in
setup() before using the ADC, to prevent the internal linking of AREF to Vcc.

3.4V to 3.3V is a very small voltage drop, I would suggest just filtering the 3.4V heavily, rather than
expecting a linear regulator to perform well with 100mV of dropout. Perhaps RCRC filter to AREF.

I'm not using arduino for this, but of-course once Aref has external voltage Vcc and V1.1 leave this equation.
I am planning to use mic94310 as a LDO, it has 100mA drop out voltage max at 200mA, should be ok.
Never actually came across RCRC filter, sounds very interesting, thanks for pointing out, researching now.

Koepel:
A few ideas:

It is not clear what is connected to AREF. I hope you did not connect the 3.4 V of VCC to it :confused:
Keep AREF open, but do add a capacitor of 100nF between AREF and GND. That does help.

The best option depends on the sensor that you want to read. Reading a ratiometric sensor is not the same as reading a battery voltage.

Right now Aref has a capacitor to ground as prescribed in datasheet and as I guess most of arduino (mini micro, uno, etc) boards based on 328p have it can be wrong but seems like it. If I choose to provide reference voltage to Aref, then as I mentioned in original post it will be either powered from LDO or from same noisy Switching regulator via RC (or RCRC, or LC), will be testing tonight which one works better in my case.

I do not have specific sensor choice, the idea is to make clean reference voltage (without using bandgap reference) came as an interesting challenge while using analog sensors. Can be anything: mic, temperature, light meter, etc. It is actually a bit of overkill since 40mA is not bad ripple and is stable but I want to see how lower I can make it without too too much effort.

It does not wrap up to something good. There are too many things that can go wrong.

The LC filter is for AVCC, not for AREF.

As I wrote, reading a ratiometric sensor is not the same as reading the voltage of a battery.
When, for example, a LDR is used to measure the light, then the LDR + resistor should be powered with the same voltage as AREF. When AREF is open and the default VCC is used as reference, then it makes sense. If you mess with AREF with a RC or RCRC filter, then you should also power the LDR + resistor with that voltage, but that will drop the voltage after the RCRC filter.

A LDO from 3.4 to 3.3 V while its own drop is 100 mV, that can't be right.

An analog temperature sensor depends so much on the reference voltage, that it is very hard to make accurate. Use a digital temperature sensor, for example the DS18B20.

Why don't you want to use the internal voltage reference ?

In my opinion, the 40 mV ripple is not good and you might make it worse with a wonky reference voltage.

alexmg2:
Currently I have whole system (Atmega328p on PCB) powered by Switching regulator that provides 3.4V with stable ripple of 40mV at about 5Khz.

5kHz, 40mV...
Is this a DIY switching regulator.
Modern micropower switching regulators work between 500kHz and 2Mhz.
Much easier to filter that with an LC circuit.
Leo..