Question about standalone atmega328

I looked on the forums, but couldn't find any details on this... maybe i'm just not that good at the search function...

I'm wanting to know if it is possible to program the arduino exactly like you want for a project, then remove the chip and put it on a custom board and use the functionality you progrogrammed through the main board. My understanding is that as long as you put a 16 mhz crystal oscillator between 9 and 10 (with the required caps going to ground), you can accomplish using the analog and digital pins as you would on the main board.

So the question really is... can i just program the chip as normal, remove it from the board, put a crystal between 9 and 10, and it boot correctly to detect input/create output as it would on the main board?

Below is the schematic that makes me think this is possible. Can someone confirm?

Have you got a programmer to put the bootloader into the chip, or did you buy one with it ready loaded?

Yes, standalone projects are very common and popular using the Arduino platform. The key is to purchase new 328 chips that have the arduino bootloader program already burned into the chip:

Your schematic example is a little simplistic. There are usually a few .1ufd caps wired from the chips power pins to ground. Also a pull-up resistor is usually used from the reset pin to Vcc, although if you aren't going to install a reset switch this is not really required. If you search around this forum you should find many example schematics for standalone operation. Also a 3 terminal resonator can be used in place of the crystal and padding caps: Ceramic Resonator 16MHz - COM-09420 - SparkFun Electronics

Good luck

I'm no expert on this, but I did get a standalone AtMega up and running using the schematic for the Realt Bare Bones Board:

I used one of the AtMegas with the preburned bootloaders from Sparkfun as I don't have time at the moment to figure out how to burn a bootloader onto a chip myself.

With the above schematic, I was able to add the software reset cap and hook the board up to the SparkFun 5v basic breakout, and it seems to work perfectly, even if I normally run the chip off less than 5v.

What application are you using this Mega328 for?

Whatever you do (unless you want a possible headache later if the ATMega fails), don't solder the chip directly to the PCB; install it into a 28-pin socket (0.100 pitch).

If you can't find 28-pin sockets for whatever reason, you can place two 14-pin sockets (0.100 pitch) in a row to make up a 28-pin socket.

This is because should the ATMega fail or is damaged in some manner, removal and will be much easier if it is socketed vs. if it isn't. In the case of not being socketed, typically you have to spend some interesting time desoldering it, working the pins out, in in extreme cases, cutting away the pins and desoldering each pin one-by-one, then spend time cleaning up the PCB to (usually) install a socket and a new chip (provided that all the desoldering and cleaning steps haven't lifted pads/traces in the process).

sure you can do what you say, just check the crystal frequency has to be the same

It's certainly possible... but I found it so much easier to build the final project based on the ADAFRUIT Boarduino. I just treat it like a Basic Stamp.

Thanks all for your help/suggestions/info. This seems to be a VERY active board with many helpful contributors.

AWOL, I have a chip with the arduino bootloader already loaded, but am going to investigate how difficult it will be to load the bootloader onto it myself. I have a usb -> TTL adapter, so i believe i can do it as long as i figure out the instructions.

retrolefty, I'm assuming the .1ufd caps from power to ground are just for power filtering to make sure it is a filtered power source?

retrolefty, A reset pin is not going to be used.

RobotSimple, I don't have a specific application yet, Just making sure i understand what is conceptually capable. I may use it with the parallax RFID reader i picked up from radio shack today (on clearance for $10) to make an RFID reader that shows the card ID on a LED display (and maybe more functionality with it... not sure what all i want it to do yet).

crOsh, I didn't think about the potential need to swap chips... Great suggestion.

if you have a chip with a bootloader on it already, you can load an arduino sketch onto it mimicking an avr isp programmer

from there you can do all sorts of fun including bootloading your own chips

otherwise you may be able to bit bang a bootloader onto the chip, but IMO its just better to mess around with a spare, if nothing else so you can undo (most) issues