First available in 1996, AVR microcontrollers (MCUs) are a family of powerful, versatile, and energy-efficient microcontrollers developed by Atmel (now part of Microchip Technology since 2016). While these MCUs find use in a wide range of systems (particularly embedded), probably the most famous use is in various Arduino development boards, providing a straightforward approach to working with the MCUs.
On this page you can learn about a range of AVR MCUs that I have encountered and my experiences of using them.
You can email me at james.boshikoopa@gmail.com
I bought an Atmel AVR ATmega16A-PU as it was the largest package AVR DIP (Dual In-line Package) microcontroller (MCU) I could find on DigiKey at reasonable price, having 40 pins, having a DIP package it's be compatible with standard breadboard and easy to solder. I paid £3.40 ($4.22), which is a lot cheaper than what it's selling on eBay, for example.
You can find the product page, which also has a link to the datasheet at:
A summary of the chip's features:
8-bit enhanced RISC architecture
2.7-5.5V
0-16MHz
32 I/O lines
16lB flash
512B EEPROM
1KB SRAM
JTAG interface
x2 8-bit timers/counters
x1 16-bit timers/counters
RTC
x4 PWM channels
8 channel 10-bit ADC
Two-wire serial interface
USART
SPI
See the datasheet for lots more information.
The ATmega16A is the newer version of the ATmega16, which means it can handle a lower supply voltage of 1.8V, while the minimum for the original ATmega16 is 2.7V. The 'A' model is otherwise functionally identical to the original but can work with the full speed in the lower voltage too and as well as having lower power consumption.
Note that the 'PU' in the chip name means the package is PDIP (Plastic DIP).
While there are currently no official Arduino boards that use the ATmega16 it is possible to add support for the MCU in the Arduino IDE, which makes it easier to test the chip than by other methods as it handles a lot of the low level functionality.
We can use MCUdude's MightyCore:
https://github.com/MCUdude/MightyCore
Which supports a range of MCUs including the ATmega16. It uses the Urboot bootloader which supports most Arduino Uno compatible libraries. Arduino IDE V1.6+ is recommended, I used V2.3.2 as I had that already install:
Instructions on how to install can be found at:
https://github.com/MCUdude/MightyCore?tab=readme-ov-file#how-to-install
I installed MightyCore then selected in the Arduino IDE the Board as ATmega16 (Tools->Board->MightyCore), I left BOD (Brown-out Detection) at 2.7V (Tools->BOD), left pinout as Standard (Tools->Pinout), left clock at 'External 16 MHz' (Tools->Clock), and set Programmer to 'Arduino as ISP' (Tools->Programmer).
To wire up follow:
https://github.com/MCUdude/MightyCore?tab=readme-ov-file#minimal-setup
I used the 'DIP-40 package' image for guidance - you need to save the image, clicking on it doesn't open it, take note.
I breadboarded the MCU as per the schematic and used a Arduino Nano clone I had at hand as an ISP programmer (you can of course use whatever Arduino you want as long as you adjust the wiring accordingly, Nano has the same wiring as Uno). I didn't connect the UART at this point as that will be needed later for uploading sketches.
You are then supposed to use 'Burn Bootloader' from the Tools menu but this will fail, this is because you need to put the ArduinoISP example sketch (File->Examples->ArduinoISP) on the Arduino to be used as an ISP programmer, something not made clear by the instructions. When you upload the ArduinoISP sketch don't forget to set the Board type to reflect the Arduino you're using (in my case Arduino Nano). For the Nano you need to also set the Processor type (Tools->Processor).
After uploading the ArduinoISP sketch we can burn the bootloader (with ATmega16 settings), then do Tools->Burn Bootloader. This should only take seconds, and I got a warning:
Warning: skipping -U efuse:... as memory not defined for part ATmega16
Which is nothing to worry about.
Next we can write a sketch, in my case, I used the standard Blink example. To do so, we need to connect a UART adapter, on the schematic they show both UART and AVR ISP VCC connected together as well as the MCU. I intended to use a SparkFun FTDI Basic FT232RL USB to serial adapter:
https://www.sparkfun.com/products/9716
The adapter provides 5V from USB so I disconnected the Arduino Nano and used the adapter's power connections to power the MCU. Before uploading the Blink sketch I set the Port (Tools->Port) to the adapter COM number in the Arduino IDE. The upload took only seconds, while uploading the LED connected to the ATmega16 PB0 (pin 1) blinked rapidly and then flashed every second as expected of the Blink sketch. I did get in the Arduino IDE:
Warning: no eeprom data found in Intel Hex file C:\Users\james\AppData\Local\Temp\arduino\sketches\BB246FC7F38C2619FC69E7F88DC4F7AC/Blink.ino.eep
Which I don't think is anything to worry about, I think it's just stating the obvious since we aren't using EEPROM data and is not something normally reported when using an Arduino board. But to be safe and as an excuse to further test I used the built-in example eeprom_put (File->Examples->EEPROM) - after uploading I got the same warning. I opened the serial monitor set to 9600 and saw:
Written float data type!
Written custom data type!
View the example sketch eeprom_get to see how you can retrieve the values!
I uploaded the eeprom_get example sketch (which once again gave the same warning), and in the serial monitor it outputted:
Read custom object from EEPROM:
3.14
65
Working!
Which shows the EEPROM is indeed working as it successfully retrieved the values stored in the EEPROM by the previous example sketch.
There is a lot more I could do to test the MCU and I've only tested a very small portion of the chip but at this point I knew the bootloader was working and that I could upload sketches. In the future I can return to the MCU and perhaps make an experimentation board.
All content of this and related pages is copyright (c) James S. 2025