How to choose cheapest AVR for a task

Are there any good resources out there for choosing the cheapest AVR that fits a set of requirements?

I'm currently working on a project that requires 4 PWM outputs, 3 other outputs, 1 analog input, and probably 8kb of program memory (it seems I'd have to write some existing libraries in order to get <4kb, and I don't really have the time for that). Right now I'm testing this out with an ATTiny84, but these seem to be relatively expensive, the cheapest I see them is for ~$2.50 on Ebay vs $3 for a full ATMega328.

"Cheapest" in monetary terms overlook your investment in time which directly translate to the probability of greater frustration.

Consider the Atmega328P-PU for projects..., same uC as the UNO. In 25 qty, these are just $2.10 and will support anything code-wise that an UNO, Nano, or Mini will. Clones of the Mini are easily found on eBay for $3-$4 and will save you construction time and the need to stock 16MHz crystals, load caps, voltage regulators...

I develop on the UNO or Nano and then, if the project warrants, I move the code to a naked 328 or Mini clone. A regimented software development cycle with standard Arduino hardware will provide the widest use of existing libraries and the ability to request assistance from forum users with similar test environments!

Ray

are the mini clones like this one http://www.ebay.com/itm/Pro-Mini-atmega328-5V-16M-Replace-ATmega128-Arduino-Compatible-Nano-NEW-/131053554958 completely compatible with the code from an arduino uno?

I am for the mini clone.
ebay 1112526853 only 2.77

the cost of the chip and crystal and reset button would cost more.

mrburnette:
"Cheapest" in monetary terms overlook your investment in time which directly translate to the probability of greater frustration.

Consider the Atmega328P-PU for projects..., same uC as the UNO. In 25 qty, these are just $2.10 and will support anything code-wise that an UNO, Nano, or Mini will. Clones of the Mini are easily found on eBay for $3-$4 and will save you construction time and the need to stock 16MHz crystals, load caps, voltage regulators...

So one of the reason's I'm looking at the ATTiny's is that I'm trying to fit this into as small as space as possible and will be imbedding it into a PCB I'm working on. I've got some Atmega328P-PU's I've used elsewhere and could just copy the appropriate bits from my Eagle sketches for those, but the ATTiny84 is half the size. One day I'll get around to learning to use SMDs and setup a reflow toaster, at which point a SMD ATMega328 would be an obvious choice.

I develop on the UNO or Nano and then, if the project warrants, I move the code to a naked 328 or Mini clone.

I hadn't seen how cheap the Mini clones were on eBay. Looking at them, once I've added a crystal+capacitors and a reset switch to the attiny it would probably take about the same amount of space as the Pro Mini. I'll order a few of those and try it out.

random_vamp:
Right now I'm testing this out with an ATTiny84, but these seem to be relatively expensive, the cheapest I see them is for ~$2.50 on Ebay vs $3 for a full ATMega328.

Mouser's prices for ATtiny84A-PU:

1:      $1.41   
10:     $1.28   
25:     $0.896  
50:     $0.832  
100:    $0.80

austinphilp:
are the mini clones like this one http://www.ebay.com/itm/Pro-Mini-atmega328-5V-16M-Replace-ATmega128-Arduino-Compatible-Nano-NEW-/131053554958 completely compatible with the code from an arduino uno?

Yes.

random_vamp:
Are there any good resources out there for choosing the cheapest AVR that fits a set of requirements?

I'm currently working on a project that requires 4 PWM outputs, 3 other outputs, 1 analog input, and probably 8kb of program memory (it seems I'd have to write some existing libraries in order to get <4kb, and I don't really have the time for that). Right now I'm testing this out with an ATTiny84, but these seem to be relatively expensive, the cheapest I see them is for ~$2.50 on Ebay vs $3 for a full ATMega328.

I gave up using Tiny84s when the $3 Pro Minis appeared on eBay.

But... it all depends on how many you want to build, if you're using your own PCB, etc.

For small quantities? Simply not worth the effort of (re)writing libraries, etc. A Pro-Mini is 100% Arduino Uno compatible and that saves a LOT of time.

Are there any good resources out there for choosing the cheapest AVR that fits a set of requirements?

Well, the major distributors have "parametric search" where you can specify things like "6 to 20 IOs, 8k of program memory, DIP14, DIP16, DIP18, DIP20 packages", and then sort the results by price.
Digikey says the tiny84 is it, as far as AVRs go. And it's about $1.63 in tens. Tiny861 is another alternative.

Understand that prices are subject to random influences, and subject to significant changes over short periods of time.
I wouldn't use eBay as an indication of chip pricing unless that's really the only place you intend to buy chips (which is a bad idea, too.) Certain "popular" chips become artificially expensive, and everything is distorted by postage issues (some eBay sellers seem to make their profits by mailing things cheaply, so that you can buy one chip for $3 including postage, whereas a real distributor will frequently have postage fees that start at $7+ (minimum sized UPS package.) But, like I said, that's "distorted" from real pricing.

fungus:
.......
I gave up using Tiny84s when the $3 Pro Minis appeared on eBay.
.......

Same for me, with the exception for power saving.

I am fascinated by stand alone chips in sleep mode!

Peter_I:

fungus:
.......
I gave up using Tiny84s when the $3 Pro Minis appeared on eBay.
.......

Same for me, with the exception for power saving.

I am fascinated by stand alone chips in sleep mode!

Grab a hot soldering iron and poke the power components off the Pro Mini PCB and they sleep perfectly. It only takes 30 seconds to do.

All you need to keep is the crystal and the two capacitors right next to it. You can also keep the Pin13 LED if you want that.

fungus:
Grab a hot soldering iron and poke the power components off the Pro Mini PCB and they sleep perfectly. It only takes 30 seconds to do.
All you need to keep is the crystal and the two capacitors right next to it. You can also keep the Pin13 LED if you want that.

I hadn't thought of that!
Now I have to try that too.

Peter_I:

fungus:
Grab a hot soldering iron and poke the power components off the Pro Mini PCB and they sleep perfectly. It only takes 30 seconds to do.
All you need to keep is the crystal and the two capacitors right next to it. You can also keep the Pin13 LED if you want that.

I hadn't thought of that!
Now I have to try that too.

If you're using FTDI programmer you have to run a wire across from the FTDI connector to the Vcc pin after you remove the power components.