This repository will explain how and when to use the powerful noise suppression features available on the Microchip tinyAVR® 1-series and megaAVR® 0-series ADCs. In these ADCs, the input signal is fed through a sample-and-hold circuit which ensures that the input voltage to the ADC is held at a constant level during sampling. The ADC supports sampling in bursts where a configurable number of conversion results are accumulated into a single ADC result (sample accumulation). Further, a sample delay can be configured to tune the ADC sampling frequency associated with a single burst. This to tune the sampling frequency away from any harmonic noise aliased with the ADC sampling frequency (within the burst) from the sampled signal. An automatic sampling delay variation feature can be used to randomize this delay to slightly change the time between samples.
Topics covered include using the ADC hardware sample accumulator to filter out zero mean random noise and surpassing harmonic noise through tuned sampling delays or automatic sampling delay variation. The noise filtering is demonstrated by using an example source code and plotting a graph of ADC samples in MPLAB Data Visualizer. This is explained in detail in the Application Note AN2551 - Noise Countermeasures for ADC Applications by Microchip. The code is run on a ATtiny817 Xplained Pro board.
- MPLAB® X IDE 6.25 or later
- ATtiny DFP 3.3.272 or later
- MPLAB® XC8 3.00 or later
- AVR/GNU C Compiler 5.4.0 or later
- MPLAB® Data Visualizer 1.1.793 or later
- Atmel Data Visualizer 2.20.674 or later
- ATtiny817 Xplained Pro
- Micro-USB cable (Type-A/Micro-B)
-
Connect the ATtiny817 Xplained Pro board to the PC using the USB cable.
-
Download the zip file or clone the example to get the source code.
-
Open the project in MPLAB X IDE.
-
Follow the application note AN2551 - Noise Countermeasures for ADC Applications to configure the code for different types of noise.
-
Build the solution and program the ATtiny817.
-
Plot the ADC results:
-
In Atmel Studio go to Tools and open Data Visualizer. Configure Data Visualizer to plot a graph of the ADC samples. Refer to Appendix A in the Application Note AN2551 - Noise Countermeasures for ADC Applications on how to do this. Refer to Atmel Data Visualizer User's Guide for help with Data Visualizer.
-
Alternatively: Open MPLAB® Data Visualizer. Load the workspace with the configuration file that followed the code example. Make sure you are using the right COM-port. Refer to MPLAB® Data Visualizer User's Guide for help with Data Visualizer.
-
-
Try plotting different signals by combining the use of random noise, periodic noise, sample accumulation and sampling delay. You do this by reconfiguring the macro definitions before building and programming the device. The new graph will be plotted in Data Visualizer.
We have now looked at how to use the powerful noise suppression features available on the Microchip tinyAVR® 1-series and megaAVR® 0-series ADCs. The example described how to use the ADC hardware sample accumulator to filter out zero mean random noise and surpassing harmonic noise through tuned sampling delays or automatic sampling delay variation.