In this post I will show how to use Arduino in a standalone configuration, ie use the ATmega328 (equipped with a bootloader) in circuit without having to lug around all our Arduino Uno (or the board you have).
The concept is this: I have finished protyping my project with Arduino (such as a RGB Led Lamp) and I’m ready to make the final version of the lamp.
You could you use the Arduino board, but it would be inconvenient not just from the point of view of cost, but also from the point of view of size and consumption … In reality, what we need is just the microcontroller with bootloader and a few external components.
If our Atmega has no bootloader, we need to load it, but first things first … Let us assume that when we already have the bootloader onboard.
To be able to upload the sketch we have to use the connections as shown in the figure:
It important to remove the microcontroller from the board with which we are going to program, otherwise we will program that instead of our Atmega standalone.
As you can see the connections are very simple, you just connect power, TX and RX pins and RESET pin.
At this point from our Arduino IDE we can go to upload the sketch, of course, after selecting “Arduino Duemilanove or Nano w / ATmega328” from the Tools -> Board. And that’s it.
Of course, the same would apply if the Atmega is programmed to work with the 8Mhz internal oscillator. With the difference that we didn’t need the two capacitors and the crystal shown in the figure. To use the internal oscillator, however, we should re-program the bootloader (as we shall see in the next post).
If we have available (and I recommend you to buy it because it is a cheap and really usuful accessory) a USB / Serial converter like the Sparkfun FTDI Basic or Ardino USB-Serial Light, connections would as the following:
It’s nothing complicated, just the connections are almost as before: VCC, GND, RX, TX, while the reset is a bit different because it requires a 100nF capacitor between the pin DTR (or RTS – not to be confused with RST) and Atmega RST.
We have seen how to program a standalone ATmega328 with bootloader preinstalled, in the next post we will see how to load the bootloader on a virgin Atmega328 in both versions: with external 16mhz crystal, and with internal 8Mhz oscillator.