Using empty UNO board to program external ATmega328

I wasn't sure if this could be done, but apparently it can.

I pulled the atmega328 out of the UNO board. Put it into a circuit on a breadboard (with crystal and two caps) to drive a stepper motor circuit. Then I jumpered the reset pin on the ATmega328 to the reset pin on the UNO. I also jumpered the RX pin and TX pin similarly. Finally I also jumpered a ground to ground in the same way.

I did not use D0 or D1, so there was no conflict with external circuitry on those pins. The ATmega328 is powered externally at 5v and the UNO board is powered through the USB cable.

I was able to upload sketches just as if the ATmega328 was still in the UNO and it ran great. It never failed to upload new sketches or run them.

My question is, can I rely on this method, or is there a potential conflict between the UNO's crystal clock and the ATmega chip's external crystal clock? In other words, if the two clocks were to be too far off in frequency, would longer sketches possibly fail to upload correctly?

I would think you should be able on counting on it to work long term. There is always going to be slight speed variation between crystal to crystal and even more so between resonators. And the new Uno bootloader program works at yet a high baudrate then prior boards. However USART characters 'resync' their bit sample timing with each new start bit, so there is still tolerance for slight speed mismatch.

Thanks for the reply.
Well, that is good news.

Also, I should mention in case anyone tries it...

If the UNO is unplugged from the computer, it has no power on it and tends to drag down the reset line, even with a 10k pull up on the Atmega328's reset pin, so I had to disconnect the reset line from the UNO to get the breadboard circuit working when the UNO is powered off.

It may even require powering off the ATmega328's circuit to get the reset to work again... not sure why, just something I noticed.

Can this technique be used to program an ATmega328 with a non-Uno bootloader?
For example, can I use an Uno board (minus microcontroller chip) as a USB-to-Serial programming interface for something like the Arduino Pro-Mini? (The Pro-Mini board uses the ATmegaBOOT, whilst the Uno uses Optiboot, AFAIK)

If the UNO is unplugged from the computer, it has no power on it and tends to drag down the reset line, even with a 10k pull up on the Atmega328's reset pin

That's possibly solvable by adding a 100nF in series, so that only fast downwards edges pull it down.

tim7:
Can this technique be used to program an ATmega328 with a non-Uno bootloader?
For example, can I use an Uno board (minus microcontroller chip) as a USB-to-Serial programming interface for something like the Arduino Pro-Mini? (The Pro-Mini board uses the ATmegaBOOT, whilst the Uno uses Optiboot, AFAIK)

I also used this method (empty UNO board to program ATmega328 chip) to program a 328 chip which had the older Duemilanove bootloader on it. The only difference in programming was that I had to choose "Duemilanove and ..." as the board type (even though the actual board was an UNO).

One difference in the bootloaders is that at power-up, the optiboot loaded chip starts the sketch instantly. The Duemilanove-bootloaded chip waits one second. However, both boards wait a second after a reset press, before running the sketch.

I'm not sure what a Pro-Mini is, exactly. But if it doesn't have the USB port, there may be a way to use the UNO to communicate with it. At least the bootloader difference shouldn't be an issue.

MarkT:

If the UNO is unplugged from the computer, it has no power on it and tends to drag down the reset line, even with a 10k pull up on the Atmega328's reset pin

That's possibly solvable by adding a 100nF in series, so that only fast downwards edges pull it down.

Thanks for the heads-up.

i am new to the whole arduino controller, but so far i enjoy it. So i can remove my ATmega328 from the UNO board and put it onto a bread board with my program loaded onto it and add the crsytal and two capacitors and have it work just like the UNO would work? Thank you

Yes.

Yes, but I should add one note...

In one of the tutorials, it shows the Aref pin connected directly to 5v. You should not do that, it is dangerous. If you are not using the external reference for analog inputs, you should leave that pin unconnected. If you are using the external reference, you should use a 5k resistor to connect an external voltage to that pin. That will prevent the chip from burning in case the internal reference is selected accidentally in the sketch.

Look up the tutorial for external reference if you are going to use that feature.

Thanks for the tip. What is a good FTDI programmer with USB to program an ATMega328 chip?

I have been using this one to program prominis since August.

Have seen complaints about the newer model and it surface mount connector cracking traces & stuff.
The thru-hole has been solid for me. I put mating 0.025" square pins on my prominis.

Thank you for the link! I am trying to program a chip to read RFID card tags. I have an ATmega328 chip and also an UNO arduino. I dont understand the marking on the UNO. Does 1 on the UNO also correspond to 1 on the ATmega328 chip and so on? I cant seem to figure out out how each pin numbering on the UNO corresponds to the ATmega328 chip.

Here is the 168/328 pin mapping to D0, D1, etc.