How to run ATmega168 or 328 at 3.3v?

Okay so I want to be able to use a few ATmega168s or 328s without the use of an arduino board.

What external programmer would you guys recommend? Something cheap, and USB, preferably.

And, on the SFE site they say the 328 (and 168) needs to be connected to a 16MHz crystal or resonator. I know the 16MHz boards run on 5v, and the 8MHz boards run on 3.3v. If I hooked it up to an 8MHz crystal, would I only need 3.3v?

EDIT: Ok, so I can't get a regulated 3.3v for my application.

If I brought it down to 4MHz, would the power requirements drop too? Is there a different ATmega that uses less power (maybe 2v? 1.5v?) that I can still code using the Arduino IDE?

What about the ATmega8? I might be able to use one of those. Might.

What external programmer would you guys recommend? Something cheap, and USB, preferably.

I just got this one and am VERY pleased... http://www.pololu.com/catalog/product/1300

And, on the SFE site they say the 328 (and 168) needs to be connected to a 16MHz crystal or resonator

I've been running a 328 using the internal oscillator at 8MHz and 1MHz. I've read that the internal oscillator can be off by 5% but can be calibrated to about 1%. For what I'm doing it works very well uncalibrated.

If I hooked it up to an 8MHz crystal, would I only need 3.3v?

I have mine running directly from two AA batteries.

Note: I've read that the supplied voltage must match the programmer's voltage. So, when I need to program, I switch from the AA batteries to a 5V power supply. The Pololu programmer has solder pads to bring out the USB 5V (@100ma).

If I brought it down to 4MHz, would the power requirements drop too?

It depends on the application.

Is there a different ATmega that uses less power (maybe 2v? 1.5v?) What about the ATmega8?

The minimum voltage on the ATmega8 is 2.7V. I believe Atmel has processors rated to run down to 1.8V. I've used the following to sort through the various options. Unfortunately, they don't have a search for voltage so you'll have to select processors then check the Volts column in the grid. http://www.avrfreaks.net/index.php?module=Freaks%20Devices&func=devCompare

that I can still code using the Arduino IDE?

Using the Pololu programmer I've been able to program a 1MHz (or 8MHz or 16MHz) 328 using the Arduino IDE. I have not yet tried to get Serial working. My suspicion is that it will not work well because of the uncalibrated oscillator.

The Lilypad series uses the internal oscillator at 8MHz. Serial should work just fine, although you may run into trouble at higher speeds.

-j

Well, just last week I tested 168 and it stops working at about 2,8V. All above 3V shold be fine, but I didn't test serial! I used only atmega 168 with a oscilator and and a LED to blink. I compared normal operation vs. watchdog. It goes like this: @5V operation = 19mA sleep = 66,7 uA

@4V operation = 12mA sleep = 62 uA

@3,5V operation = 10mA sleep = 60uA

Regards, Peter

I just got this one and am VERY pleased... http://www.pololu.com/catalog/product/1300

Looks good. Excuse me for being a bit noobish, but where does the other end of that cable plug into? I'm guessing I would I need a breakout board for the ATmega to connect the cable to the right pins? Would I need something like http://www.sparkfun.com/commerce/product_info.php?products_id=29

It depends on the application.

Well, it will be run off of a regulated 2v power source on a device that gets its power from 2 AA batteries. I'll need to drive 4 leds, and that's about it.

Using the Pololu programmer I've been able to program a 1MHz (or 8MHz or 16MHz) 328 using the Arduino IDE. I have not yet tried to get Serial working. My suspicion is that it will not work well because of the uncalibrated oscillator.

I don't need serial, so that's perfectly fine.

I also read on Atmel's site that the 328 (or 168, not sure which) can run from 1.8v to 5.5v. I'm guessing the 5.5v is when it's run at 20MHz (It's max), and the 1.8v would be at 1MHz. How would I drop the clock speed down to about 2MHz?

edit: According to the specs sheet (http://www.atmel.com/dyn/resources/prod_documents/doc8025.pdf)

Page 370, Figure 29-94. I can run the ATmega 168 at 4MHz using 1.8v. Awesome. How would I drop the internal clock down to 4MHz? I would need to set CKDIV8 to CKDIV2 I think.

The device is shipped with internal RC oscillator at 8.0MHz and with the fuse CKDIV8 programmed, resulting in 1.0MHz system clock. The startup time is set to maximum and time-out period enabled. (CKSEL = "0010", SUT = "10", CKDIV8 = "0").

So...how would I change this to only 4MHz? Haha.

I've dumped almost everything I know on the subject so I may not be much help. But I'll try...

[Pololu Programmer] Looks good. Excuse me for being a bit noobish, but where does the other end of that cable plug into?

If you have one of the following from Evil Science, there's a place on the board for the 6-pin connector. http://evilmadscience.com/tinykitlist/74-atmegaxx8

In my case, I mostly followed the instructions below with three exceptions: 1. Mine is powered either from a MintyBoost to get 5V or directly from 2-AA batteries; 2. I don't have a serial connection of any kind; 3. I don't have that clever little "AVR Programming Adapter" so I stuck six wires directly into the 6-pin female connector and then stuck the other ends into the appropriate holes on the breadboard. http://www.arduino.cc/en/Main/Standalone

These were also very helpful... http://www.ladyada.net/learn/avr/index.html http://www.engbedded.com/fusecalc/ http://www.pololu.com/docs/0J36/all#1 http://www.evilmadscientist.com/article.php/avrtargetboards

I'm guessing I would I need a breakout board for the ATmega to connect the cable to the right pins?

That would certainly save some time and reduce the annoyance but it is not required. The whole thing can be built on a breadboard.

Would I need something like http://www.sparkfun.com/commerce/product_info.php?products_id=29

It looks like that one has the 10-pin connector. You will not be able to directly connect the 6-pin programmer to that board. I've read that a 6-pin to 10-pin adapter is easy to make.

Well, it will be run off of a regulated 2v power source on a device that gets its power from 2 AA batteries. I'll need to drive 4 leds, and that's about it.

It also depends on what the application does. I remember reading a proof on the AVR-Freaks forum where running a faster clock can, for certain applications, consume less overall power. It's important to remember than halving the clock means it will take twice as long to do a given amount of work.

I'm guessing the 5.5v is when it's run at 20MHz

Those two limits aren't related. In the datasheet, look under "28.3 Speed Grades". For the 168P, 20MHz is available at 4.5V.

Page 370, Figure 29-94. I can run the ATmega 168 at 4MHz using 1.8v. Awesome

That figure is labeled "Figure 29-94. Active Supply Current vs. Frequency (1-20 MHz)". I think you're looking in the wrong place for Voltage vs Frequency.

The "28.3 Speed Grades" section does show 4MHz @ 1.8V but only for the 168PV processor (the "V" is important).

How would I drop the internal clock down to 4MHz? I would need to set CKDIV8 to CKDIV2 I think.

I don't think you can. It's my understanding that the internal clock options for the 168P are 8MHz, 1MHz, and 125KHz. CKDIV8 is a simple "switch". If it's turned on the clock is divided by 8. If it's turned off the clock runs as-is.

Definitely helpful, thank you.

Regarding programming, I read the Arduino page and I can just pop my chip into my Arduino USB and program using an external programmer that way, so that's definitely what I'll do.

And I checked out the speed grades section. So, I need 168PV chips. How exactly would I bring it down to 4MHz? Just an external crystal?