Comparison of ATmel chips

I’ve got a few projects I’m working on thinking about that just don’t make sense with an arduino, both for size and cost reasons.  This post was originally going to be about how to program and ATtiny with the arduino IDE (don’t worry, I’ll get to this soon).  As I was writing it, I started comparing chips and realized the distinctions weren’t as cut and dry as I thought.  So instead, this post will be a comparison of some of the popular Atmel chips: the ATmega328 used in the Arduino Uno, the ATmega2560 used in the Arduino Mega, the ATtiny84, ATtiny85, and ATtiny2313.

When I started this comparision all I knew was that the ATtiny series was tinier than the ATmega series.  To quote a favorite TV character: Hello and/or Duh!  I also assumed that since the tinys were much smaller, they would be slower, have less inputs, and be much cheaper.  The majority of these were not correct.  I didn’t compare surface mount versions of these chips since I’m not at that skill level yet.  Surface mount components drastically change the difference in size between the largest and smallest of these chips and make it much more compelling to go for the larger chip.

Similarities

While these chips have many differences, they also have a few similarities.  Most importantly, they all operate at 1.8 – 5.5 volts.  They also all have an 8MHz internal oscillator (some chips default to 1MHz but can be changed by setting a fuse).  It’s also important to note that they can all run up to 20MHz when using an external oscillator.  8 MHz is fast enough to do serial but issues may arise since the internal oscillator is only 10% accurate.  I2C and other synchronous communication should be fine as long as they obey the maximum and minimum durations.

Differences

The image below shows the sizes of the ATtiny85, ATtiny84, ATtiny2313, and ATmega328 respectively (Sorry about the poor quality – I’ve never been great at Photoshop, I prefer working with vector images).  The size difference is pretty obvious and that alone is a good reason to pick just the right chip for the project you’re working on.  I didn’t include the ATmega2560 since it isn’t available in a through hole mount.  This size difference is due both to the number of IO pins as well as the  circuitry inside.

Image

The chart below shows all of the data I was interested in when looking at these chips.

ATtiny2313 ATtiny84 ATtiny85 ATmega328 ATmega2560
Cost

$3.13

$3.53

$2.65

$3.70

$16.75

Pin Count

20

14

8

32

100

Max IO pins

18

12

6

23

86

Flash Memory

2 Kb

8 Kb

8 Kb

32 Kb

256 Kb

EEPROM

128 bytes

512 bytes

512 bytes

1 Kb

4 Kb

ADC channels

0

8

4

6 (8 on SMD)

16

PWM channels

4

4

6

6

15

Timers

1 8bit

1 16bit

1 8bit

1 16bit

2 8bit

2 8bit

1 16bit

2 8bit

4 16bit

SRAM 128 bytes

512 bytes

512 bytes

2 Kb

8 Kb

Hardware Serial No

No

No

Yes – 1

Yes – 4

Hardware I2C No

No

No

Yes

Yes

External Interrupts 2 (8 PCINT)

1 (12PCINT)

1 (6 PCINT)

2 (23 PCINT)

8 (32 PCINT)

Here we can see that the only correct assumption I made was that the tiny series has less pins.  I was really surprised that the difference in price was so small between the ATmeg328 and ATtiny85.  I expected the ATmega328 to be much more expensive since it has more pins and flash.  I can only assume that it’s cheaper because of its popularity and benefits from economies of scale.  I also find it interesting that while the ATtiny2313 is larger than the ATtiny84, it has less flash memory, less EEPROM, and no Analog to Digital Converter.  But I guess if you’re only interested in IO pins, this might be the chip for you.

For my purposes, the ATtiny85 is perfect since I only need a few IO pins and am most concerned about size and cost.  The next post will cover how to program the ATtiny from the arduino IDE using an arduino as a programmer.

EDIT: 5/3/2013 – Updated chart to detail the type of timers and include SRAM.

EDIT: 5/15/2015 – Updated chart to include External Interrupts, I2C, Hardware Serial, and updated cost.  Cost is at a volume of 1 unit as found on DigiKey with the through-hole version (except for 2560).

Advertisements

2 thoughts on “Comparison of ATmel chips

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s