Using the ATmega328P standalone

About the post

In this article I would like to show how you can operate the heart of the Arduino UNO, the ATmega328P, standalone. There is more than one way to skin a cat and I’ll show you some of them:

Each of these paths has its advantages and disadvantages. Take a look at it and decide for yourself what you might want to try.

A few points in advance

Why operate the ATmega328P standalone?

The ATmega328P (PU)

Arduino boards are without question very comfortable when it comes to developing projects. You don’t have to worry about the power supply, an oscillator is already attached to it, you don’t need a programmer and you have the labeled pin headers. But if you immortalize your project in solder and wire at the end, the Arduino becomes unwieldy. Then it is better to operate only the ATmega328P with a minimum of peripherals. Space requirements, power consumption and costs (< 2 euros) are lower.

What you need for this post


To reproduce the examples of this article, you need an ATmega328P, or more precisely an ATmega328P PU. The “PU” describes the design (28 PDIP). The ATmega328P is also available as an SMD.

Then you must actually buy an ATmega328P and not the ATmega328 (without “P”). Both versions are almost identical. The “P” stands for Picopower, which means that the P variant can do more in terms of power management. More importantly, the models have different signatures. The signature is immutably bound to the microcontroller (carved in silicon ;-)) and is checked by the Arduino IDE before uploading sketches or burning the bootloader. If you use the non-P variant, the Arduino IDE goes on strike.

The Arduino UNO

It is important for some sections of this article that you have an Arduino UNO with the ATmega328P-PU and not one with the ATmega328P as SMD.

Other components

What else you need depends on which examples you want to try yourself. I assume that you already have breadboards, cables, LEDs and resistors. In any case, I recommend the purchase of:

  • 16 MHz oscillators
  • Capacitors: 22 pF, 0.1 µF

Sometimes this is offered as a kit, e.g. here, here or here. Depending on which examples you want to try out, you will need the following components:

  • FTDI232 USB-to-Serial Adapter
  • a second Arduino UNO or an Arduino Nano
  • USBtinyISP programmer
  • additional capacitors (100 nF and/or 10 nF)

Pinout of the ATmega328P vs Arduino UNO

Before we really start, here is a comparison of the Arduino pins with the pins of the ATmega328P which might be useful for orientation:

Pin designation ATmega328P vs. Arduino UNO
Pin designation ATmega328P-PU vs. Arduino UNO

The Arduino UNO as a programmer

In this part of the article I have mainly based on instructions from Tom Heylen on the Instructables pages (here) and on a tutorial on the Arduino pages (here). Tom Heylen also has a good video. However, I take things a little further in my article and will also handle some typical errors.

Preparing the Arduino IDE

First, you need to teach the Arduino IDE how to deal with the bare ATmega328P. To do this, follow these instructions:

  • download this zip file. It should work with the Arduino IDEs from version 1.6 onwards. For me, it worked fine with version 1.8.10. Otherwise, take a look at the Arduino website.
  • create a folder named “hardware” in your Arduino Sketchbook directory, if not already there. Check in File — > Preferencesif you don’t know which directory it is.
  • unpack the downloaded zip file in the hardware directory.
  • restart the Arduino IDE and check whether you can find the entry “ATmega328 on a breadboard (8 MHz internal clock)” in the boards menu (but not yet select):
Select “ATmega328 on a breadboard”

Turn the Arduino into an ISP programmer

Select the ArduinoISP sketch from the examples of the Arduino IDE and upload it to the Arduino UNO. The Arduino UNO must be still selected as board in this step.

Choose ArduinoISP from the examples

Then you build a circuit according to the plan shown below. For orientation: the semicircular recess on the ATmega328P shows you the side where pin 1 and pin 28 are located (see also Pinout scheme above). On the Fritzing scheme, pin 1 is at the bottom left. 

ATmega328P : Burning the bootloader with the Arduino UNO
ATmega328P: Burning the bootloader with the Arduino UNO

AVCC is the separate power supply for the A/D converters and the Port C pins. Theoretically, AVCC would not have to be connected in this step. However, it is generally recommended.

In the “Tools” menu, you choose “Arduino as ISP” as the programmer – do not to confuse it with “Arduino ISP”. Now the bootloader can be transferred via ISP (In-System Programming).

Burning the bootloader

What is a boot loader?

Simply put, the bootloader controls how the sketches find their way into the memory of the microcontroller, i.e. how they are uploaded. The choice of the board in the Arduino IDE also determines the clock frequency when burning the bootloader and also whether an internal or external oscillator should be used. The ATmega328P uses an external 16MHz oscillator in its Arduino UNO environment. But we want to operate our standalone solution first with the internal 8 MHz oscillator. Therefore, select as board: “Atmega328 on a breadboard (8 MHz internal clock)”.

The burning process

In the Tools menu, select “Burn Bootloader”. The following warning message ignores it:

Ignore warning of the Arduino IDE
Ignore the warning

Potential problems

You will receive the following error message if you use a wrong microcontroller, e.g. the ATmega328 (“without P”).

Error message: wrong microcontroller

Once I also received the following message:

Error message: Invalid Device Signature – also occurs when the clock setting is incorrect

Here I had used the correct ATmega, but unfortunately the wrong oscillator was preset (8 MHz, external). With Atmel Studio I could fix it, but in this setup it’s a problem. If you get the error message and don’t have Atmel Studio, try variant 3.

Variant 1: Arduino UNO only / 8 MHz

You can now transfer the sketches using the new bootloader via the serial pins RXD and TXD of the ATmega328P. Since PCs usually no longer have a serial port (the older ones, including me, still remember…), you need a USB-to-serial adapter.

Removing the ATmega328P

The good news: the Arduino UNO has such an adapter because it uploads sketches to its internal ATmega328P similarly. By the way, the adapter is the square IC above the oscillator and left to the RX/TX LEDs. The bad news: The ATmega328P, which sits on the Arduino UN, disturbs and must be removed. What??? Yes, read correctly. But it’s less dramatic than you think. It is best to take such IC extractor pliers, which are available for a few euros:

IC extractor pliers

The most important thing is to pull out the ATmega328P evenly so that the pins do not bend. But even if you bend one, you usually get it bent back. And if you should destroy the ATmega328P, it’s not dramatic if you have a spare one. I will show you how to prepare a fresh ATmega328P for use in the Arduino UNO.

Wiring and sketch

Now set up the wiring as shown below. We need the LED on PD7 (equivalent to Arduino Pin 7) for the example sketch.

ATmega328P with Arduino UNO as programmer
ATmega328P with Arduino UNO as programmer

Then upload the following blink sketch. You still need to select “ATmega328 on a breadboard (8 MHz internal clock)” as board. The selection of the programmer is irrelevant.

void setup() {
  pinMode(7, OUTPUT);

void loop() {
  digitalWrite(7, HIGH);   
  digitalWrite(7, LOW);    


Done! The sketch is uploaded, so now you can remove the Arduino UNO and run the mini-project with a suitable voltage source independently.

Variant 2: Arduino UNO and FTDI232 / 8MHz

If the procedure with pulling the ATmega328P from the UN is too tricky or too annoying eventually, then you can try a separate USB-to-serial adapter like the FTDI232. You can find it for a few euros e.g. here. You must choose one which has a pin named “DTR” because it controls the reset.

FTDI232 USB-to-serial adapter
FTDI232 USB-to-serial adapter

Installing the FTDI232 Adapter

Before you can use the FTDI232, you need a driver for it. You can get it here at FTDI (Future Technology Devices International). If you are using Windows, then after following the link, select “setup executable”:

FTDI232 driver for windows
FTDI232 driver for windows

Download and execute the installation file. After the installation and connection of the adapter is complete, it should appear in the device manager like this or similar:

The FTDI232 adapter in Windows devices manager
The FTDI232 adapter in Windows devices manager

Wiring and uploading

Even when using the FTDI232, you can’t avoid the first step of variant 1, the burning of the bootloader via ISP. But after that you can upload sketches with the adapter without having to repeat the procedure. You connect the adapter as follows:

Programming ATmega328P with FTDI232
Programming ATmega328P with FTDI232

Note that this time RX is connected to TX and TX to RX. Connect DTR to RESET via a 100 nF capacitor. Place a pull-up resistor between RESET and VCC. The rest of the connections remain the same: GND to GND and VCC (adapter) to VCC / AVCC of the ATmega328P.

To upload, select “ATmega328 on a breadboard (…)”. The programmer doesn’t matter. But don’t forget to choose the right port.

Variant 3: Arduino UNO and FTDI232 / 16 MHz

Maybe you need 16 MHz? No problem. For the burning of the bootloader you use the following circuit:

Circuit for burning the bootloader for 16 MHz operation

Compared to variant 2, the following has been added:

  • a 16 MHz oscillator on XTAL1 (PB6 / Pin 9) and XTAL2 (PB7 / Pin 10)
  • XTAL1 and XTAL2 are each connected to GND with a 22 pF capacitor
  • between VCC and GND there is a 100 nF capacitor (but does not necessarily have to if you have a stable power supply)

Burning the bootloader works like this:

  • as usual upload the ArduinoISP Sketch from the examples to the Arduino UNO
  • then choose the Arduino UNO as a board (or stay with it)
  • select “Arduino as ISP” as programmer
  • Then select Tools — > Burn Bootloader

Upload sketches

After that, you can easily upload sketches with the FTDI232. For this purpose, use the following circuit:

Circuit for uploading sketches using FTDI232
Circuit for uploading sketches using FTDI232

Note: here again, TX is connected to RX and RX to TX. Also put a 100 nF capacitor between DTR and RESET and a pull-up resistor between VCC and RESET. As board, you choose the Arduino UNO, the programmer is irrelevant. And don’t forget to change the port if necessary.


In operation without the FTDI232 you must of course keep the 16 MHz oscillator:

Standalone circuit for the ATmega328P

Programming the ATmega328P in the Arduino UNO

Another pragmatic idea: why not program the ATmega328P directly in the Arduino UNO? There you have the comfortable pin headers and at least during the project development you don’t have to deal with the oscillator and the reset wiring. Only when your project concept is in place do you extract the ATmega328P and add the necessary peripherals, e.g. power supply and oscillator. 

But then I don’t have a functioning UNO anymore!?

No problem. Plug a new ATmega328P into the Arduino UNO. Then you take the second Arduino UNO or another board and burn the Arduino UNO bootloader. In this example, I’ll take an Arduino Nano as the programming device:

Wiring for burning the bootloader on the ATmega328P

What you have to do shouldn’t be a surprise anymore:

  • the board that serves as a programming unit gets the ArduinoISP Sketch uploaded
  • then wire as shown above; only the programming Arduino is connected to the PC via USB
  • In the Arduino IDE choose as board “Arduino UNO”
  • Programmer: “Arduino as ISP”
  • then select Tools — > Burn Bootloader

Done, the UNO is restored. Alternatively, you can of course burn the bootloader as above with variant 3 and then plug the ATmega328P into the UNO.

Programming using the USBtinyISP


The beauty of this variant is that you don’t have to change the wiring to burn the bootloader and upload the sketches. Everything is managed with ISP programming. The downside is obvious: you need a USBtinyISP first. But this is available for < 10 Euros on Amazon, eBay and Co. Something more serious is that – due to a lack of serial connection – the serial monitor does not work.

The USBtinyISP programmer

Useful helpers

Another disadvantage is the confusing, 6-pole ISP connection. It is easy to make a mistake in wiring:

Therefore, it is best to get a breadboard adapter and the corresponding connection cable:

To find such adapters, search for “ISP breadboard adapter” in online stores. The cable can be found e.g. under the search term “IDC ribbon cable 6 pin female”.

Driver installation

Then you need a driver for the USBtinyISP. You can find it here on the Adafruit pages. Start the installation and tick the boxes as follows:

Driver Selection for USBtinyISP

The USBtinyISP should then appear in the device manager like this:

Wiring and uploading

Circuit for 16 MHz operation

As a board you select the Arduino UNO and USBtinyISP as programmer. Don’t worry about “Port” being grayed out – that’s the way it is. Then burn the bootloader. 

Select USBtinyISP as programmer

There is an important point to keep in mind when uploading the sketches. Uploading by clicking on the icon (arrow to right) or choosing “Upload” from the menu does not work. You must select “Upload with Programmer” in the menu.

Very important: only “Upload with Programmer” works

That should work. If you want to operate the ATmega328P at 8 MHz, you just have to choose “Atmega328 on a breadboard…” as a board and burn the bootloader again.

Full control: Atmel Studio

You only gain full control of the ATmega328P with the free Atmel (Microchip) Studio software. Some time ago I published a post about this subject. You can find it here. I wrote the post using the example of programming an ATtiny85, but you can check if you would like that all. The software needs a bit of getting used to, you need a programmer and you typically use “C” as a language. However, you will also be richly rewarded, e.g. with:

  • Control of the fuse bits
  • Advanced oscillator settings
  • You can program virtually any AVR microcontroller
  • The “C” programs are usually much faster than their Arduino counterparts
  • Debugging function


The background of the post image in which I inserted the ATmega328P is from Harut Movsisyan on Pixabay.

6 thoughts on “Using the ATmega328P standalone

  1. Hi Wolfgang, I noticed in the stage where the 328PU is flashed to 8MHz internal and we use an empty arduino board as a USB to UART adapter, you have the LED ballast resistor wired to the 328PU’s pin 13 but the table says pin19, which is the correct pin for the LED when wiring directly to the chip. I’m experienced enough to figure this out but newbies, or near-newbies, may have trouble. Good idea to fix it.

    Other than that, great explainer! Really helpful.


    1. Hi, yes you are right. This was a copy-paste error. Will change it immediately. Thank you!
      Cheers, Wolfgang

  2. Hi
    I burnt the bootloader into atmega328 and then i used the usb to serial converter with dtr and when i start upload ,arduino ide compiles the sketch and when starts uploading the atmega on bread board blinks led attached to pin 19 ,ide show uploading but after some time the uploading fails ,can any body help me.



  3. your blog has helped me immensely. The detail and clarity in your posts are unmatched. Big respect to you for putting these out

Leave a Reply

Your email address will not be published. Required fields are marked *