This textbook provides practicing scientists and engineers a primer on the Atmel AVR microcontroller. In this second edition we highlight the popular ATmega164 microcontroller and other pin-for-pin controllers in the family with a complement of flash memory up to 128 kbytes. The second edition also adds a chapter on embedded system design fundamentals and provides extended examples on two different autonomous robots. Our approach is to provide the fundamental skills to quickly get up and operating with this internationally popular microcontroller. We cover the main subsystems aboard the ATmega164, providing a short theory section followed by a description of the related microcontroller subsystem with accompanying hardware and software to exercise the subsystem. In all examples, we use the C programming language. We include a detailed chapter describing how to interface the microcontroller to a wide variety of input and output devices and conclude with several system level examples.