In this tutorial, I am going to show you how to migrate from an Arduino development board to a standalone microcontroller (Atmega328p) on a breadboard. I will use an Arduino Uno board to program the Atmega328p on the breadboard instead of an external FTDI.
- Arduino Uno Board
- 1x Atmega328p
- 1x 16 MHz crystal oscillator
- 1x 10k ohm resistor
- 1x 220 ohm resistor
- 2x 22 pF ceramic capacitors.
- A Breadboard
- Jumper wires
Burning the Bootloader
This topic is an extra part in case you have an Atmega328p without the bootloader. If this is the case, you need to burn the bootloader or you can’t load your sketches into the microcontroller.
You can do this using an Arduino board as an in-system program (ISP). If the microcontroller already has the bootloader on it (because you remove it out of an Arduino board or ordered an already-bootloaded ATmega), you can skip this section.
To burn the bootloader, follow the next steps:
- Upload the ArduinoISP sketch onto your Arduino board.
- Wire up the Arduino board and microcontroller as shown in the next diagram.
- Select “Arduino as ISP” from Tools > Programmer
- Run Tools > Burn Bootloader
You should only need to burn the bootloader once. After you’ve done it, remove the jumper wires connected to pins 10, 11, 12, and 13.
Uploading Using an Arduino Board
Once your Atmega328p has the bootloader on it, you can upload programs to it using the USB-to-serial converter (FTDI chip) on the Arduino board. To do that, remove the microcontroller from the Arduino board (as shown in the figure below) so the FTDI chip can talk to the microcontroller on the breadboard instead.
The schematic below shows how to connect the RX and TX lines from the Arduino board to the Atmega328p on the breadboard. To program the microcontroller, do the normal procedures (you can see this in the video at the beginning of this tutorial).
ATMEGA328P on a Breadboard
Now you can remove the TX, RX and Reset cables and you can observe the microcontroller working alone on the breadboard. Note that in this part Arduino is used only as a power source.
Don’t forget to put the crystal oscillator as close as you can from the microcontroller.