ADC NOISE REDUCTION in AVR

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
RABO2320
Posts: 36
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times
Contact:

ADC NOISE REDUCTION in AVR

Post by RABO2320 »

Hi
please guide me.
How to enable ADC noise reduction mode in AVR.

medelec35
Valued Contributor
Valued Contributor
Posts: 9343
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2562 times
Been thanked: 3773 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by medelec35 »

Hi, RABO2320.
There are several things you can do.
1. Have conversion speed within POT properties set n the max e.g FOSC/128
2. Use GetAverageByte or Use GetAverageInt macro.
3. Use a suitable capacitor across ADC and GND
4. Make sure Supply voltage is stable.
Martin

User avatar
Benj
Matrix Staff
Posts: 15257
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4774 times
Been thanked: 4300 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by Benj »

Hello,

A common Avr circuit uses a 10uH inductor between vref and vcc and a 100nf cap between vref and gnd. Then in your adc settings switch to use the external vref. This should help to get rid of some noise.

Martins suggestions are also very useful.

RABO2320
Posts: 36
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by RABO2320 »

thank you so much medelec35
thank you so much Benj

I want the code that activates the ADC noise reduction mode.
What is this code and how can this code be used? :?: :?: :?: :?: :?:

medelec35
Valued Contributor
Valued Contributor
Posts: 9343
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2562 times
Been thanked: 3773 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by medelec35 »

The are several suggestions from myself and Ben.
Which option are you referring to?
Martin

RABO2320
Posts: 36
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by RABO2320 »

According to the MCUCR register tables:

I want SM0 = 1, SM1 = 0, SM2 = 0 to be in the MCUCR register Until Sleep Mode changes to ADC Noise Reduction mode.
Attachments
sleep_mode.gif
sleep_mode.gif (9.39 KiB) Viewed 160 times
mcucr.gif
mcucr.gif (3.6 KiB) Viewed 160 times

mnf
Valued Contributor
Valued Contributor
Posts: 1105
Joined: Wed May 31, 2017 11:57 am
Has thanked: 66 times
Been thanked: 423 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by mnf »

You can set bits in the registers using a C block

to set use | (or) and to clear use & (and)

in this case to set SM2 to SMO to 0b001 (binary)
MCUCR = MCUCR & 0b10001111; // Clear SM2 to SM0
MCUCR = MCUCR | 0b10000; // Set SM0 to 1

In the real world these would probably be combined into one line:
MCUCR = (MCUCR & 0b10001111) | 0b10000;

Martin

RABO2320
Posts: 36
Joined: Sun Mar 01, 2020 1:39 pm
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by RABO2320 »

I used this code in C block but there was no change in the ADC reading.
The value read from the ADC fluctuates continuously, albeit slightly.
I have complied with all of the above regarding ADC circuit power supply.

Post Reply