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

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 to 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.

Hardware Prerequisites

  • ATtiny817 Xplained Pro evaluation kit
  • Micro-USB cable (Type-A/Micro-B)
  • A potentiometer
  • Three male-to-female wires
  • Internet connection

Software Prerequisites

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 second. ADC Result Ready (RESRDY) interrupt triggers a print of the ADC result to the USART terminal. When 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 no data transmission period. The same drivers and configurations from the previous assignment is used here. Atmel Studio is used to further develop the code.


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 ADC window threshold value, triggers USART transmission. The ADC results, which are above the window threshold value, is ignored and 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.

© 2018 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.