Part I – Untangling the wires:
On your journey of exploring the different areas of embedded systems and microcontroller programming, you must’ve come across the term ‘AVR’. This blog (or series of blogs) will try to demystify all the terminologies.
Prerequisites
Before we proceed, this blog assumes that you already have a basic overview and understanding of what microcontrollers are, what their basic functionalities are, and how they differ from microprocessors. Knowledge of the C/CPP programming language would be beneficial.
Table of Contents
- Introduction
- Arduino vs AVR
- The family of AVR microcontrollers
- Keywords
- Further reading
- References
Introduction
The technical definition of what AVR is, is: The AVR microcontroller is a family of mostly 8-bit microcontrollers developed by Atmel (now Microchip), that follow the Harvard RISC architecture.
Let\’s try to break all this technical jargon down. Harvard architecture is a type of architecture where the instructions (program code) and data are stored in different parts of memory. This is in contrast to Von Neumann\’s architecture where no such distinction is made. The following illustration might help you understand the concept a little better.
Now coming to the other piece of jargon that might’ve thrown you off RISC. It stands for Reduced Instruction Set-Computer. It is a computer architecture philosophy that generally follows the idea of having smaller and atomic instruction sizes when compared to its counterpart CISC (Complex Instruction Set-Computer), which has relatively bigger instructions. We won\’t be diving into this as this is a topic for another day.
Arduino vs AVR
Before we move any further let\’s clear one big misconception out of the way. People tend to confuse the terms Arduino and AVR quite often. Although it wouldn\’t be fair to compare these two (it would be like comparing an engine to a car), the following table clearly explains what are the differences between the two. In this article when we use the word “Arduino”, we will be referring to the Arduino platform which includes all the hardware and software made by the company.
Arduino | AVR | ||
1. |
Is hardware and software platform which includes, but is not limited to: the Arduino IDE, Arduino Uno board, and the Arduino programming language | 1. |
Is a family of microcontrollers developed in 1996 by Atmel. It is only a piece of hardware. |
2. |
The Arduino Uno is a board that is built around the ATMega328, which is an AVR microcontroller. Apart from the microcontroller itself, it has other components such as a USB2.0 cable and a PCB on top of which the components such as resistors and capacitors are wired together. |
2. |
Is a microcontroller that requires additional passive and active components (clock, LEDs, etc.) to be wired up by the end-user for it to work. |
3. | Products are developed and maintained by Arduino (company) | 3. | Products are developed and maintained by Microchip Technology Inc |
4. | An Arduino Uno board: Notice the various components such as voltage regulators, connectors, switches, LEDs that are already soldered onto the board. The rectangular black IC (Integrated Circuit)/chip on the bottom right-hand corner of the board is the engine that drives the car (board), ie, the ATmega328, which is an AVR microcontroller |
4. | The ATmega328P, an AVR microcontroller: It doesn’t come packaged with any components, which have to be attached by the vendor/programmer themselves |
The family of AVR microcontrollers
Microchip offers a wide selection of microcontrollers to choose from, each meeting a different set of requirements. They can broadly be divided into three categories.
Series | Package size | FlashSize | Operating Frequency | Example |
ATtiny(TinyAVR) |
8-32 pins |
0.5kB – 32kB |
1.6MHz-32Mhz |
ATtiny85 |
ATMega(megaAVR) |
28-100 pins |
4kB – 256kB |
1.6MHz-32Mhz |
ATMega328 |
ATxmegaXMEGA |
44-100pins |
16kB – 256kB |
1.6MHz-32Mhz |
ATXmega128 |
The above table isn’t exhaustive as there are many other families of microcontrollers such as the 32-bit AVR32 and the newly released AVR Dx series.
The family of microcontrollers you end up choosing, totally depends on the scope of your project. Looking for a very small compact and lower power microcontroller which can automate a basic task, like toggling an LED-based on an input switch? Then go for the ATtiny family.
Looking to control a servo motor that is connected to an IR sensor? You definitely won\’t go wrong with the ATmega series. Still, looking for more firepower for controlling multiple sensors? The ATxmega series has got your back. In the upcoming blog, we shall deep dive into one of the most widely loved and used microcontrollers – the humble yet mighty ATmega328.
Till next time! Ciao!
Further Reading
https://en.wikipedia.org/wiki/AVR_microcontrollers
References
https://www.microchip.com/en-us/product/ATmega328P
Intro Video on Device Drivers and Application Code for AVR(Arduino Boards) – YouTube