Using Atmega8 / Atmega168 standalone

Early draft. Contribute!

What's this about?

You can use the Atmega8 chip by itself in a breadboard or a prototyping board using just a few extra parts.

Once you've got your app working nicely on your arduino board, you may want to make it smaller or cheaper. If you just want to make it smaller, you might consider a prebuilt Arduino Mini or RBBB, the Mini also gives you a few extra analog and PWM pins. If you also need to make it cheaper you can make your own circuit based around the atmega8 or atmega168 chip, adding just the bare-bones circuitry needed to support the chip. Bare-bones circuit boards and parts are also available here. This page aims to document how to do it yourself.

Is it simple?

Yes. Check out this picture from the ITP arduino-on-breadboard tutorial, which shows the entire circuit for a standalone atmega8 (minus circuitry to talk with a computer). Not too complex. Note that there's less than US $10 of components needed there (not counting the breadboard), even if you're buying singles.

Where do I start?

Watch this video introduction of arduino-on-breadboard by Tom Igoe, bearing in mind that the video isn't just showing atmega8 but also circuitry to allow it to talk to the PC over serial. Your circuit may be simpler than this.

Overview

  • get an atmega8 (or 168) chip. Buy, or take one out of your arduino board.
  • put your program onto it, somehow.
  • build a circuit to support the atmega chip
  • place the chip in the circuit

Building the circuit

A good starting point and the most comprehensive write-up so far is the ITP Physcomp arduino-on-breadboard tutorial which shows how to get an atmega8 up and running on breadboard, and then adds circuitry for a serial-over-USB connection, should you need it.

There are a number of sources:

Nota bene: If not using a serial connection with your Atmega standalone, make sure you pull down the RX pin of the Atmel chip (pin 2) to ground with a 10K Ohms resistor. Otherwise, floating TTL levels might keep the bootloader waiting forever. Cf. forum post Program not starting with external power supply. LLPZ December 06, 2006

About the schematics

TODO: All of the schematics differ slightly (ignoring the usb / serial circuitry) - See forum post Différences modules "prototyping" et "standalone".

  • TODO: walkthrough of a chosen schematic (see notes at end).

Preparing and programming the chip

TODO. This is already covered on the main arduino site:

If you want to use arduino to program your chip, but the chip hasn't yet been prepared for arduino, you'll have to burn the bootloader. See the Bootloader page on main site.

If you don't want to use arduino to program your chip See the external Programmer page on the main site: "If you have an external programmer you can burn sketches to the Arduino board without using the bootloader. This allows you to use the full program space (flash) of the chip on the Arduino board. It also avoid the bootloader delay when you power or reset your board." read more...

Using arduino-prepared chips

Warning: drafted by a newbie. YMMV.
For newbies, there's a chip-preparation & programming approach to consider which doesn't involve any fuse-setting, bootloader installation, or non-standard programming on your part:

You can buy atmega8 and atmega168 chips already made arduino-friendly with the bootloader on them, etc.
You can drop one of these chips into an arduino board, develop and program with the arduino IDE until you're happy, then take the chip out and pop it into your custom circuit.
You can also program one of these chips in-place in the custom circuit, by making use of the tx and rx connections of an arduino NG board with its atmega chip removed. I document how to do this here. (note: those instructions are for the arduino mini. Some things might not apply to you, such as changing the IDE Tools:Microcontroller setting to atmega168). You'll only be able to do this if nothing on your custom circuit is interfering with the Rx and Tx pins of your atmega.

Drawbacks to this approach:

  • Because you'll have the arduino bootloader on the chip, there'll be the 5 second delay at power-up (or reset) while the bootloader pauses to allow any new program to be loaded. It's up to you and your intended application as to whether or not this is acceptable in development and in production.
  • 1k of the available program space is taken up by the bootloader.

Where to buy arduino-prepared atmega chips

Atmega8 vs Atmega168

Note that you should consider using atmega168 instead of atmega8 as the 168 has double the amount of program space, and only costs maybe 10-20% more per unit. You also get some more of the digital pins PWM-enabled.

Most of what's written here is applicable to both chips, unless stated otherwise.

Forum threads:

TODO: collect from these forums.

External resources

TODO: Show the beginner that there are non-arduino resources that they can begin to learn from once they understand how simple atmega standalone is. e.g.

more TODO

  • harvest info from forum threads
  • A walkthrough of the entire circuit on the schematic would be a great educational piece. e.g.

"This is the voltage regulator which does X. without this.... It's a classic configuration of a 7805 voltage regulator IC (the 05 of this family indicates it supplies +5v) with some smoothing capacitors which do Y, and without which, Z occurs. The max you should supply such a regulator with is A volts or else B happens, the least you can supply this circuit with is C volts and must be able to supply D amps. What happens on low voltage, suggestion on how to detect (so your robot can return to recharge). This is the 16MHz oscillator...". - Text video, or even another diagrammatic guide (quickest thing might be to annotate the circuit in flickr with hotspots). TODO: reduce material to one schematic to rule them all, if possible.

  • provide good link to voltage regulator 7805 circuit discussion, because it's a significant fraction of the bare-bones atmega support circuit. Some students feel much better if they can account for all the components on their breadboard. this article is a start.

Citation from Linear Regulator (Wikipedia): "The regulating device is made to act like a variable resistor, continuously adjusting a voltage divider network to maintain a constant output voltage. [...] All linear regulators require an input voltage at least some minimum amount higher than the desired output voltage. That minimum amount is called the drop-out voltage. For example, a common regulator such as the 7805 has an output voltage of 5V, but can only maintain this if the input voltage remains above about 7V." LLPZ December 07, 2006, at 04:16 AM

In progress - neillzero.

Share