ADC and Power Optimization Training for tinyAVR® and megaAVR® MCUs

Last modified by Microchip on 2023/11/09 09:02

Introduction

This tutorial contains five hands-on applications for ADC data conversion, with current consumption measured for each application. The tutorial starts with a simple ADC conversion application. In the following applications, different techniques are introduced in order to demonstrate how the current consumption can be reduced in tinyAVR® 0- and 1-series and megaAVR® 0-series MCUs.

This tutorial also demonstrates how to use Atmel START to get started with AVR® devices ADC applications development. The ADC applications have been developed step-by-step in Atmel Studio. This tutorial has been developed on the ATtiny817 Xplained Pro evaluation kit but should be applicable for all tinyAVR 0- and 1-series, and megaAVR 0-series devices.

Solution projects for each of the assignments are available in the Atmel START Example Browser.
In the Getting Started category, search for ADC and Power Optimization Solution (1-5).
Direct links to the relevant example projects are provided in the assignment descriptions below.

Reference Materials

  • ATtiny817 Xplained Pro evaluation kit
  • Micro-USB cable (Type-A/Micro-B)
  • A potentiometer
  • Three male-to-female wires
  • Atmel Studio 7.0
  • Web browser. List of supported browsers can be found here: START supported browsers

Back to Top

Estimated Completion Time: 120 minutes

Assignment 1: ADC Conversion with USART Print Application

In this assignment, Atmel Studio is used to develop an application using ADC and USART drivers from Atmel START. The ADC is configured to run in single conversion mode and a potentiometer is connected to the ADC input pin to study the ADC functionality. The ADC data is sent via USART to the embedded terminal in Atmel Studio's Data Visualizer. In Data Visualizer, the current consumption of the application is analyzed using the embedded Power Analyzer.

Assignment 2: RTC Interrupts Triggers ADC and USART Print

In this assignment, the Real Time Counter (RTC) module is used. The RTC overflow interrupt is used to trigger an ADC conversion every half a second. ADC Result Ready (RESRDY) interrupt triggers a print of the ADC result to the USART terminal. When the RTC overflow interrupt is not triggered, the device is kept in Sleep Standby mode in order to reduce the power consumption. Atmel START is used to add the RTC module and to configure the RTC, ADC, CPUINIT, and SLEEPCTRL drivers. An Atmel Studio project is regenerated afterward.

Assignment 3: Power Optimization on I/O Pins

In this assignment, the digital input buffer on the I/O pins is disabled in order to reduce the current consumption. The current consumption is further reduced when the USART TX pin is configured as a high-impedance pin during the data transmission period. The same drivers and configurations from the previous assignment is used here. Atmel Studio is used to further develop the code.

Back to Top

Assignment 4: ADC Conversion Using Window Compare Mode

In this assignment, the ADC result ready interrupt is replaced by the ADC WCMP interrupt, to trigger a USART transmission. In this case, the ADC result, which is below the ADC window threshold value, triggers USART transmission. The ADC results, which are above the window threshold value, are ignored and do not trigger any USART transmission. Atmel START is used to reconfigure the ADC module and the Atmel Studio project is updated with the new configuration.

Assignment 5: Event System (EVSYS) Used to Replace the RTC Interrupt Handler

In this assignment, the event system with the RTC overflow event signal, instead of the RTC overflow interrupt, is used to trigger an ADC conversion. The Event System enables direct peripheral-to-peripheral signaling. It allows a change in one peripheral (the Event Generator) to trigger actions in other peripherals (the Event Users) through Event channels without using the CPU. A channel path can be either asynchronous or synchronous to the main clock.

Summary

This tutorial contains five hands-on applications doing ADC data conversion, with current consumption measured for each application. It starts with a simple ADC conversion application and different techniques are introduced in order to demonstrate how the current consumption can be reduced. This is a useful foundation for developing future ADC applications with specific current consumption requirements.

Back to Top