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: 41
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
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 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: 41
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
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 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: 41
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 3970 times
mcucr.gif
mcucr.gif (3.6 KiB) Viewed 3970 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 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: 41
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.

RABO2320
Posts: 41
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 »

Hi
Can you help me what to do? :?: :!: :?:

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by QMESAR »

Hi,

Software filtering is not always the solution you need to find out from where the noise is coming or at what frequencies and you need to do HW filter
your problem sounds to me like a PCB ground plane issue which generate noise and that is hard to filter it normally comes down to bad PCB layout

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: ADC NOISE REDUCTION in AVR

Post by AbhijitR »

Hello!

Is it possible to know what is the type of analog signal you are trying to sense from the field, is it some kind of current transmitter (4-20mA) or any other type and how do you convert that signal to feed to the microcontroller, is there some analog circuit in between to stabilize the signal before feeding the micro.

As mentioned by QMESAR in his post there are many probabilities which can cause the unstable analog signal.

Abhi

Post Reply