Friday, March 18, 2016

Checking Out the New Atmel ATtiny102/104

In this post I will discuss my experiences with the Atmel ATtiny104 Xplained Nano kit, and compare this new microcontroller from Atmel with other ATtiny devices.

The Atmel ATtiny104 Xplained Nano evaluation board.


I love microcontrollers, and I do my best to keep up with new devices being released from the major manufacturers. Recently, I saw that Atmel had released new ATtiny devices, the ATtiny102 and ATtiny104. I decided to order one of their Xplained Nano kits for the ATtiny104 and check it out. The board costs $4.50 USD and is available from Digikey right now. Other distributors have it on order.

Update (4/5/16): Mouser now has the kit in stock as well.

Let's be honest, the cool box is worth the price of admission. 


First step in researching any microcontroller: look at the datasheet. Let's get a few of the basics out of the way first. The ATtiny102 is an 8-pin device that comes in SOIC and UDFN packages, and the ATtiny104 is a 14-pin version of the device that comes in SOIC only. The larger device has extra GPIO, and extra channels on some of the peripherals such as the Analog-to-Digital Converter (ADC), but otherwise they are identical.

 Pinouts of the ATtiny102 and ATtiny104 in SOIC packages.

As I read through the key features of the new microcontroller, I immediately saw some parallels to the ATtiny4/5/9/10. I played around with the ATtiny10 quite a bit when it first came out, and recently developed a super tiny breakout board for it. However, I saw some very interesting additions to this new device, such as a hardware USART. I decided to make a table comparing the key features of the ATtiny102 and ATtiny10 (8- and 6-pin devices respectively). I also included the classic ATtiny85 in the comparison that has served me well in numerous projects. The ATtiny85 is well-known and loved by many embedded developers and electronics enthusiasts alike, and it even has coveted Arduino support to help make the device accessible to all.

Comparing the key features of the ATtiny102, ATtiny10, and ATtiny85.
(Unit costs shown are from Digikey, 3/18/2016)

We see many similarities between the ATtiny102 and the ATtiny10, especially in the amount of FLASH, SRAM, instructions, and general purpose working registers. However, the new device has some key upgrades. The most important of these is probably the hardware USART, which can also work in an SPI Master mode. While the ATtiny10 is very capable at collecting data from sensors and the like, it has almost no way to pass that data on to another device for processing. It is meant to handle simple, embedded tasks on its own. Given the tiny board space occupied by the SOT-23-6 chip and the low cost, it does very well in that regard.

The hardware USART on the ATtiny102 opens the device up to many more projects and potential uses. You can pass data on to another microcontroller, or even transmit it using a wireless module that accepts data over serial and handles the wireless transceiver functions on its own. Additionally, the ATtiny102 has some upgrades on the ADC front. Importantly, it has 10-bit resolution, where as the ATtiny10 has an 8-bit ADC. Besides an extra ADC channel, you also have three internal voltage references in the new device which can improve the accuracy of your measurements, especially when powered from varying supply voltages.

Comparison with the ATtiny85

In many regards, the ATtiny85 is a more robust device. The extra FLASH, SRAM, working registers, and instructions are crucial when developing more complicated solutions. Tasks we take for granted on many AVR devices such as floating point arithmetic and string manipulation are very difficult to implement on the ATtiny10 and ATtiny102/104. The ATtiny85 also comes in a DIP package, which is important to many electronics hobbyists.

However, the lack of a hardware USART on the ATtiny85 has always been a limitation. You can do software serial, but a hardware peripheral is very welcomed when available. Also, the ATtiny85 only has 8-bit counters, where as the smaller ATtiny devices have single 16-bit counters.

Finally, the ATtiny85 costs more, even when purchased in volume. The price difference doesn't seem large on the table above, but component cost adds up when using many of the devices in a solution, or designing something that will be produced in quantity.

ATtiny104 Xplained Nano

Atmel did a great job on their evaluation board for the ATtiny104. The board has a programmer and debugger built in! Simply plug it into your computer with a USB cable and it connects directly to Atmel Studio 7 for programming. I encountered no issues working with the board in Atmel Studio, though I did have to update the program before using the board.

My favorite feature of the Xplained Nano board is that you can connect to the USART on the ATtiny104 over USB and talk to it with a serial terminal. This is HUGE for prototyping and development when you need to read out your data for debugging and verification. The serial link is available as a simple COM port, and I found that I could keep it connected to my terminal program even when re-programming the chip.

The ATtiny104 Xplained Nano has a user button and LED on board, and breaks out all pins of the microcontroller. Additionally, you have some options for taking current measurements and running the ATtiny104 at supply voltages other than 5V USB.

Check out the official documentation on the evaluation board for more info:

ATtiny104 Xplained Nano User Guide
ATtiny102/104 Getting Started Guide

Wrap Up

I enjoyed working with the ATtiny104 evaluation kit, and I plan to order some bare chips when they are available from distributors. This new microcontroller from Atmel does have limitations as I discussed above, and other AVRs may be better options for your project. But if you have worked with the ATtiny10 before and just wished it had a USART, or if you need a low-cost chip for simple embedded tasks in a project, I think this is a good device to consider.

Thanks for reading!

- Dan W.

1 comment:

  1. This is very good and easy to understand. The price of these tinys is attractive also. Thanks for doing all this