Getting Started with AVR® Microcontrollers

 Introduction and Key Training Application

Next Video

Hands-On Training (PDF):

This is a series of both video and hands-on training focused on the fundamentals of AVR® microcontrollers development. Projects are developed from scratch, using the datasheet, AVR LibC, and later app notes, as primary programming references (START is not used).
In the video series, several AVR peripherals are introduced, including GPIO, timer/counter, USART, and ADC. In the process, the training evolves toward building an example application which samples an analog light sensor with ADC, then proportionally updates a PWM duty cycle based on the ADC sensor reading. An averaged sensor value is then sent over USART to a PC terminal.

An off-line training can be downloaded as "Application note AN17644 - Getting Started with AVR Microcontroller" which contains the following projects:

  1. Toggle a LED on a push button
  2. Dim the LED using PWM, using TC1
  3. ADC channel read every 500 ms & LED0 toggled
  4. Power Optimization and Sleep mode

Project Access Through On-Line Atmel Start:

You can also access this training from the Atmel START database.
Atmel Start Project - Getting Started with AVR Microcontroller


This training is a combined solution to the projects mentioned above. In this combined solution, power optimization code is added, sleep mode is selected as POWERDOWN, ADC channel0 is read and PWM is generated on PB1 using TC1.

After initializing peripherals, the device enters sleep mode and wakes up on pin-change interrupt of PB7. When SW0 (PB7) on ATmega328PB is pressed, device wakes up, then reads ADC channel0 and wait for 10 seconds. During this time LED dimming is observed on PB1 (connect PB1 to PB5 on ATmega328PB Xplained Mini). After 10 seconds, the device goes back to sleep.


  • ATmega328PB Xplained Mini


  1. Click on 'Download Pack' and save the .atzip file.
  2. Import .atzip file into Atmel Studio 7, File > Import > Atmel Start Project.
  3. Build and flash into supported evaluation board.
  4. On the ATmega328PB Xplained Mini, connect PB1 to PB5 as LED0 is connected at PB5. Then connect PC0 to 3V3 as PC0 is ADC channel0.
  5. Device enters sleep mode.
  6. Press 'SW0' on the ATmega328PB Xplained Mini which wakes up the device from sleep. The ADC channel is read, then wait for 10 seconds. Observe the LED dimming for 10 seconds.
  7. After 10 seconds, the device enters sleep mode again. During sleep mode, the LED dimming can't be observed as in POWERDOWN sleep mode TC1 is also stopped.
© 2024 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.