ADC NOISE REDUCTION in AVR
Moderator: Benj
-
- 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
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.
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
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- 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
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?
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?
-
- 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
The are several suggestions from myself and Ben.
Which option are you referring to?
Which option are you referring to?
Martin
-
- 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
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.
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 (9.39 KiB) Viewed 5596 times
-
- mcucr.gif (3.6 KiB) Viewed 5596 times
-
- Valued Contributor
- Posts: 1191
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
- Contact:
Re: ADC NOISE REDUCTION in AVR
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
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
-
- 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
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.
The value read from the ADC fluctuates continuously, albeit slightly.
I have complied with all of the above regarding ADC circuit power supply.
- QMESAR
- 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
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
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
https://www.flowcodexchange.com/
Regards QMESAR
Regards QMESAR
- AbhijitR
- Posts: 300
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 283 times
- Been thanked: 80 times
- Contact:
Re: ADC NOISE REDUCTION in AVR
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
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