Breadboard Arduino / Stand Alone ATmega328P
Here is my Arduino on a breadboard. There are many online guides for creating a breadboard Arduino. All are basically the same and follow the same connections. Some use pre-programmed chips, others use blank chips. My intention was to use a new blank ATmega chip (no boot loader) and use an Arduino Nano as an ISP programmer.
The pin numbers on the ATmega328P chip are not the same as on the Arduino. For example, pin 19 on the chip is pin 13 (the built in LED) pin on the Arduino.
1 x ATMEGA 328P-PU
1 x 16 MHz crystal
1 x 220 ohm resistor
1 x 10K ohm resistor
1 x LED (Green)
2 x 22 pF capacitors (code 220)
Various jumper/breadboard wires
Place the Atmega 328P chip on the breadboard and add the other components and wires as per the above photo.
Pin 1 is the reset pin. When this goes low (to ground) the chip resets. To stop the ATmega 328P from continually resetting we need to keep the pin high (+5V). We do this by using a 10K ohm pull up resistor connected to the +5V supply. We then add a tactile switch between pin 1 and ground. Now, when the switch is pressed we pull pin 1 to ground which causes the chip to reset. This is just like the tactile switch on an Arduino.
Pin 7 is VCC and this goes to +5V
Pin 8 is ground so it connects to ground.
Pin 9 and 10 are for a crystal or resonator. I am using a 16MHz crystal which is the same as the Arduino. The crystal also needs a couple of 22pF capacitors. Connect the crystal to pins 9 and 10. Connect the first capacitor between pin 9 and ground, the second capacitor between pin 10 and ground.
Pin 22 is another ground. So connect to ground.
Pin 21 is AREF, the Analog reference pin for the ADC. Connect to +5V.
Pin 20 is AVCC. This is the power supply to the ADC, connect it to +5V.
Pin 19 is the Arduino D13 pin. On the Arduino this has a LED connected to it. So add a 220ohm resistor + LED between the pin and ground.
If you find the chip is not operating correctly then you can add 0.1 uF decoupling capacitors to the power rails on both sides of the breadboard. Connect the capacitors across the GND and VCC lines (ideally the capacitors should be as close to the ATmega chip as possible). I have never needed to add these but I know people who have had stability issues and adding the capacitors has solved the problem.
On new Atmega328P chips, without a boot loader, the chip is set to operate using the internal clock at 1MHz. To get it to work at 16MHz we need to program special registers called fuses. The fuses hold values or flags that are used to allow you to change some of the default settings in the chip. The external 16MHz crystal will be ignored if the fuses have not been set to tell the chip to use it. Setting fuses is covered by my next post Arduino Nano as an ISP Programmer
To see if the bread board circuit worked I used a chip from an Arduino already programmed with a modified blink sketch. This is not necessary but this was my first attempt and I wanted to confirm everything worked. After confirming the circuit worked I replaced the programmed ATmega with a new blank one.
I started looking into how to use a stand alone Atmega chip with the idea of using them instead of a full Arduino in the DropControl and CamControl circuits. I then found Arduino Mini Pro clones cheaper than I can buy the components to make my own so I reverted to using full Arduinos (not only cheaper but easier to use). For the dropController project, due to the large program size, I use an Arduino without the boot loader and use my Arduino as ISP to program it.