Whether you are buying a new car, or a new house, trying to find the best one that meets your needs can be a daunting task.
Trying to find the best AVR microcontroller is no different.
But, every AVR microcontroller has its own advantages in different applications, so there isn’t one that is the best compared to the others.
However, there are a handful of AVR microcontrollers that stand out amongst the rest.
They have been chosen as the ‘best’ because they meet many factors that make them stand out above the rest. Factors like price, ease of use, amount of memory, availability etc.
The three best AVR microcontrollers are:
- AT TINY 25
- AT MEGA 8
- AT MEGA 32
While there are plenty of AVR microcontrollers, these three give you the most bang for your buck.
If you want to know why these three microcontrollers have made the cut and got the title of ‘Best AVR microcontroller’ read on for more explanation.
What is an AVR microcontroller
Like there are many manufacturers of cars, in the world of microcontrollers, you have a range of microcontroller manufacturers to choose from as well.
The major players in the field of microcontrollers include:
- Microchip
- Atmel
- NXP
- Texas instruments
- STMicroelectronics
The AVR microcontroller is a family of microcontrollers developed by ATMEL who started manufacturing them in 1996.
However, Atmel has since been acquired by Microchip in 2016. But, the AVR family of microcontrollers are still being manufactured by Microchip.
They are built on a modified Havard architecture. It is modified in the sense that the conventional Harvard architecture doesn’t allow the contents of the instruction memory to be accessed as data.
AVR microcontrollers were one of the first to utilise on-chip flash memory for program storage.
Due to their ease of use, and price they are commonly used by many hobbyists and makers. They are also used for educational embedded purposes.
What features does an AVR microcontroller have
Going back to my analogy of buying a car, knowing the features of the car will give you an indication of which car is best for you.
Features like power steering, cruise control, rear or front wheel drive, bluetooth audio system, cup holders etc.
The same holds true for features of AVR microcontrollers. Knowing what the different features are available will help you choose the best one to meet your needs.
Below are some of the many features available for AVR microcontrollers which are beneficial in many different ways.
Note, if you already know the features of AVR microcontrollers and are only concerned with which is the best, you can skip this section.
Memory
Imagine not remembering what you did yesterday, or the date of your partner and your wedding anniversary (this is not going to make them happy)..
Our memory serves us in more ways than one. From remembering what we have learnt, to important dates, peoples names, where we kept the house keys etc.
The memory of an AVR microcontroller serves it in more ways than one as well.
It helps it remember (store) things like variables, program code, sensor data etc.
An AVR microcontroller has three types of memory; FLASH, RAM, and EEPROM.
FLASH – This type of memory is known as ‘non-volatile’. What this means is that what data is stored in this section of memory is not lost when power is removed from the microcontroller. Therefore, this type of memory is used for storing program code (set of instructions) written by the programmer.
RAM (Random Access Memory) – Memory in RAM is ‘volatile’. Unlike FLASH memory, when power is removed from the microcontroller, data stored in RAM is lost. This type of memory is used to store variables that are generated during program runtime.
EEPROM (Electrically Erasable Programmable Read Only Memory) – This type of memory is ‘non-volatile’. However, reading and writing to the EEPROM is much slower compared to FLASH memory. Things that are more permanent, like sensor data, and device parameters are stored in EEPROM where they can be accessed later.
General Purpose Input / Output (GPIO) pins
The main premise of a microcontroller is to be able to interface with inputs and outputs external to it while having the ability to control them.
There are a huge range of input/outputs that are available which include things like, motors, buttons, Light Emitting Diodes, Sensors to name a few.
The AVR microcontroller has a set of GPIO pins that allow you to connect these input/outputs and control them.
The number of input/output pins largely depends on the physical size of the microcontroller.
The great thing is that any single pin has the ability to be either an input, or an output which can be changed during runtime by the user.
Analog to Digital Converter (ADC)
The GPIO pins control outputs or receive digital input values that are either HIGH (+5V) or LOW (0V).
Some inputs like sensors, provide an analog value at the input which range in value from 0 – 5V.
For example, a temperature sensor might output a voltage at 2.42 volts.
But, a microcontroller is a digital device that deals with digital values.So, how does it interpret these analog values?
Lucky for us, an AVR microcontroller has something known as the Analog to Digital converter.
As the name suggests, it takes these analog voltage values from the sensor and converts it to a digital value which the microcontroller can then interpret.
Timers
Another important aspect of an AVR microcontroller are its Timers.
It is a clock that has the main purpose of measuring time intervals. However, it can either be used as a Timer or a Counter.
When it functions as a Timer, you can think of it as a stopwatch which is used to measure time intervals between two specific events.
When used as a Counter, the Timer can store how many times a certain event occurs (mostly events external to the microcontroller).
The Timer can also be used to generate delays and PWM signals.
Pulse Width Modulation
Imagine driving a car that only had one speed without the ability to slow down or speed up.
This would be quite frustrating and pointless!
Pulse Width Modulation (PWM), is a way that lets you control the speed of a motor by varying the power that the motor receives using PWM.
Your next project might be something like a remote control car, or fan which requires speed control.
AVR microcontrollers have PWM channels on designated pins which you can connect a motor to (in conjunction with a motor controller) and vary its speed.
PWM can also be used to control the brightness of Lights such as Light Emitting Diodes by again varying the power that the light receives.
Interrupts
AVR microcontrollers are fast devices that are capable of fast execution speeds.
But, even they get overwhelmed with tasks! (this is all relative of course).
Due to this, AVR microcontrollers have a feature known as Interrupts.
An interrupt allows the microcontroller to carry on with its normal program tasks, but alerts the microcontroller when certain events/statements occur.
These events can be generated internally (via software) or externally (through special designated External Interrupt pins).
An example of an internal interrupt could be a Timer reaching its maximum value which would trigger a routine specific to that event.
External interrupts routines are generated externally at the microcontroller’s pin when it goes High, Low, or has any change in logic state.
For example, a button could be connected to one of these designated pins and when pressed (either causing state levels to go High or Low) trigger an external interrupt service routine.
Sleep Modes
Many embedded microcontroller applications are remote/mobile and require the use of battery power.
This causes many problems, with the main one being battery power is limited. So, the main issue is to be able to design a system that can last as long as possible avoiding always having to replace batteries.
AVR microcontrollers have Sleep Modes, which give them the ability to enter a state where they consume less power, but can still perform their main operations.
It can have up to five sleep modes!
Idle mode – In this mode, the CPU is halted and stops functioning. However, peripherals such as Serial Interface, Timer/Counter, Watchdog and Interrupts, continue to operate as normal.
ADC Noise reduction Mode – Stops the function of the CPU, but ADC, external interrupts, Timers and watchdog continue to operate.
Power Down mode – External Interrupts, watchdog and two-wire interface are the only things that function power down mode.
Power Save mode – This mode is used when the Timers are set up to run asynchronously.
Stand by mode – The oscillator is allowed to run while all other operations are stopped.
Serial Interface
The last major feature of AVR micrcontrollers is the Serial interface.
Humans communicate with each for many different reasons. Whether it be about new ideas we have, how we are feeling, instructions that need to be taught, passing on knowledge and so on.
Animals, from all areas of life communicate as well.
We can communicate a number of different ways which include verbal or non-verbal.
But, communication is not just limited to just humans and animals. AVR microcontrollers have the ability to communicate with other microcontrollers, and peripheral devices too.
Data can be sent or received.
There are three common communication protocols used by AVR protocols; Serial Peripheral Interface (SPI), Two wire interface (TWI) and Universal Synchronous and Asynchronous Receiver Transmitter (USART).
Choosing the best AVR microcontroller depends on your needs
You might be wondering why I listed all the different features of an AVR microcontroller.
The thing is that AVR microcontrollers come in a range of sizes, and specifications. So, choosing the best AVR microcontroller comes down to your needs/ wants, as well the needs of the application you will be using if for.
Types of AVR microcontrollers
Let’s take a closer look at the AVR family of microcontrollers.
The three most common sets of the AVR family include the tinyAVR, and megaAVR.
Below is a table highlighting things like program memory, peripherals, and number of pins for the three families.
tinyAVR | megaAVR | |
Program Memory | 0.5 – 32 (KB) | 4 – 256 (KB) |
Pin package | 6 – 32 | 28 – 100 |
Peripheral set | Limited peripheral set | Extensive peripheral set |
Within each of these three sets of AVR microcontrollers exist even more variations.
For a list of tinyAVR microcontrollers click here.
For a list of megaAVR microcontrollers click here.
7 Factors that determine which is the best AVR microcontroller 00
Now that we know the two main types of AVR families, as well as the different types of features that they can have, let’s take a look at factors that determine which is the best (remembering to take into account the application the AVR microcontroller will be used in).
Factor #1: Memory
The first factor we will take a look at when considering which is the best AVR microcontroller is Memory.
The main thing we are concerned with is how much memory the microcontroller has.
If you are writing a program that just blinks an LED every 2 seconds you are not going to require much memory. However, if you are writing a program that collects and stores temperature data, you will no doubt require more memory.
So, before buying a microcontroller always consider how much memory you will require.
Factor # 2: Price
The next factor that should be considered is the Price.
We shop for things everyday, whether it be new clothes, airline tickets for travel, food, etc.
When paying for something we look for the ‘best’ option that will not drain our bank account. So, there is a sweet spot where what you buy is good quality while still being affordable.
This applies for AVR microcontrollers as well.
It should be affordable enough while still having all the features and functionalities you require.
Factor #3: Ease of use
You might be a beginner who just wants to start your first project, or you might be an experienced engineer who is doing some prototyping on a new product and needs to meet his/her deadline.
Either way, you do not want to spend all your time setting up, or learning how to use the AVR microcontroller.
So, you want a microcontroller that is easy to use and understand while still being functional.
Factor #4: Community
In life, we rarely do things by ourselves.
People assume many breakthroughs in science, engineering, medicine, were found by one single person.
The truth is, that the person who eventually found the breakthrough relied on past studies, experiments, and knowledge of other great people.
I have learned so much about microcontrollers from the community of engineers, makers, DIYers that exist online and offline.
The great thing about the age we live in is, the Internet and all the resources available at our fingertips.
There are many communities whose knowledge and past experiences you can learn from and help inspire you for your next great AVR microcontroller project.
So, having resources and a community for the microcontroller you are using is really helpful.
Factor #5: Peripherals
This factor really depends on what your project/application requires.
If you are controlling the speed of a motor you will require PWM channels.
Do you need to interface with the real world via sensors? Then you are going to need ADC inputs.
Have to measure time between events? Then you will require Timers.
You get the point.
How many PWM channels, ADC inputs, Timers, GPIO pins etc will determine whether you get a bigger or smaller AVR microcontroller.
Factor #6: Clock Speed
The speed of the internal clock determines how fast the AVR microcontroller executes instructions.
Again, this comes down to the needs of your project.
Clock speed aspect should never be overlooked when trying to find a suitable AVR microcontroller for your application.
Factor #7: Availability
Finally on the list of factors that determine the best AVR microcontroller is Availability.
The AVR microcontroller should be readily available in the place where you are living, or be able to be ordered online and shipped to your residence without you having to sell your left arm.
What’s the use of knowing the best AVR microcontroller if you cannot get your hands on it.
3 best AVR microcontrollers
There isn’t a one size fits all kind of AVR microcontroller for every application, however, there are a handful of AVR microcontrollers that stand out amongst the rest.
The AVR microcontrollers that I have chosen below are due to the fact that they meet many (if not all) of the 7 factors that determine which is the best.
This list of the best AVR micrcontrollers is compiled based on my experiences with them, as well as research I have done online which is again based on the 7 factors.
Let’s take a look at the 3 best AVR microcontrollers.
AT TINY 25
First on the list is the AT Tiny 25 which comes from the tinyAVR family set of AVR micrcontrollers.
Of the three microcontrollers, this is the smallest coming in a 8 DIP (Dual inline package, 8 pins in total).
But, do not be fooled by its size!
This little microcontroller is very powerful and capable of meeting many of your needs.
Below is a table summarizing some of its features
AT TINY 25 | |
Flash Memory | 2K |
EEPROM | 128 bytes |
RAM | 128 bytes |
Timers | Two 8-bit timers |
PWM | 2 channels |
ADC | Four 10-bit ADC inputs |
Serial Communication | SPI, TWI, USART |
GPIO | 6 |
Clock Speed | Max: 20 MHz | Min: 10 MHz |
Sleep modes | 2 |
The AT TINY 25 is great if you do not require a big microcontroller, but still need it to have the ability to perform many of the functions of larger microcontrollers.
AT MEGA 8
Next on the list is the AT Mega 8, which comes from the megaAVR family of AVR micrcontrollers.
This microcontroller is bigger than the AT Tiny 25 microcontroller, and comes in a 28 DIP package.
The AT Mega 8 is a popular microcontroller in the Arduino world being used a lot with many of their boards.
Below is a table highlighting many of its features.
AT MEGA 8 | |
Flash Memory | 8K |
EEPROM | 512 bytes |
RAM | 1K bytes |
Timers | Two 8-bit timers + One 16-bit timer |
PWM | 3 channels |
ADC | Six 10-bit ADC inputs |
Serial Communication | SPI, TWI, USART |
GPIO | 23 |
Clock Speed | 16MHz |
Sleep modes | 3 |
AT MEGA 32
Finally, to top off the list is the AT Mega 32 which comes from the megaAVR family as well.
The AT Mega 32 is a slightly bigger board compared to the AT Mega 8 coming with 40 pins.
It is like the AT Mega 8’s bigger brother that has more memory, PWM outputs, ADC channels etc.
Below is the table summarizing the AT Mega 32’s features.
AT MEGA 32 | |
Flash Memory | 32K |
EEPROM | 1024 bytes |
RAM | 2K bytes |
Timers | Two 8-bit timers + One 16-bit timer |
PWM | 4 channels |
ADC | Eight 10-bit ADC inputs |
Serial Communication | SPI, TWI, USART |
GPIO | 32 |
Clock Speed | 16MHz |
Sleep modes | 3 |
There you have it, the top 3 AVR microcontrollers!
However, I should note again, that these AVR microcontrollers have been selected from my personal experience using them, as well as research done online as they meet many if not all the factors that contribute to a microcontroller being the best.
The AT Tiny 25, AT Mega 8, and AT Mega 32 are AVR microcontrollers that are reasonably priced, easy to use, have a great community/resources, packed with many features and memory.