loading

In this instructable you will learn how to use the Arduino ATMEGA328 microcontroller chip as a stand-alone microcontroller.

They cost only 2 bucks, can do the same as your Arduino and make your projects extremely small.

We will cover the pin layout, how to make it ready for the Arduino software by burning a bootloader and how to upload sketches.

Watch the rest of this instructable to find out how you can make your Arduino projects smaller and cheaper in no time.

Step 1: Parts List

  • 1 Arduino
  • 1 ATMEGA328P-PU chip. I got mine here:
  • Breadboard
  • Wires
  • Optional: LED and 330 ohm resistor for testing

Step 2: Download and Install Library

An Arduino board comes standard with a 16MHz external oscillator.

We don't really need this 16MHz oscillator as the ATMEGA328P-PU has a 8MHz oscillator build in.

In order to make this chip work as a stand-alone microcontroller at 8MHz, we have to download and install a library for our Arduino environment.

To do this, click the link that match your Arduino version to download the zip file.

It will be eater 1-6-x.zip, 1-5-x.zip or 1-0-x.zip

Next we have to find the Arduino sketchbook folder by clicking on File → preferences → “Sketchbook Location”. In my case “C:\Users\tomtomheylen\Documents\Arduino” this can be different in your case.

Copy the location and go to “this pc”, paste it in the bar and press enter.

If you see a folder named “hardware”, open it.

If not, make a new folder named “hardware” by right clicking and select “new → folder” and type “hardware”. Now open it.

Move the breadboard folder from the zip archive to the “hardware” folder.

Restart your Arduino IDE and go to “Tools → board”.

If everything is OK, you should see in the list “Atmega 328 on a breadboard (8MHz internal clock)”.

The most difficult part is done now so let's have some fun pumping life in that ATMEGA328.

Step 3: Burn Bootloader

These ATMEGA328 microcontroller chips usually come empty. To make them work with the Arduino IDE, we have to do something what's called “burning a bootloader”. It is a tiny bit of code we burn on the chip so it will understand the Arduino software.

To do this, connect your Arduino to your computer and go to “File → examples → ArduinoIsp” and select “Arduino Isp”. Upload this sketch to your Arduino and disconnect from your computer.

Next we connect the Arduino with the ATMEGA328 as you can see in the image.

Note the half circle on the chip. Make sure it is on the correct side.

Now connect your Arduino and in the Arduino IDE go to “tools → Programmer” and select “Arduino as ISP”.

Next go to “Tools → Board” and select “Atmega 328 on a breadboard (8MHz internal clock)”.

Now go to tools and select “Burn Bootloader”.

Your bootloader is burned and your chip is ready to upload sketches!

In case you have an error message, unplug your Arduino and repeat the previous steps.

Step 4: Uploading Sketches

To upload a sketch you have to remove the ATMEGA328 chip from the Arduino board and connect to the breadboard as shown in the image.

You can also use a USB to serial programmer like the FT232RL to do this. I have made a mini instructable on this here:

I have connected a led with resistor on the board to test the blink sketch.

Here is how to use this image for the
pin layout.

So for example if you initialize pin 13 in the IDE, it represents pin 13 on the Arduino board or pin 19 on the ATMEGA328 chip.

Congratulations, you made it! You can now start soldering your own minified Arduino projects for next to nothing.

Step 5: A Few Helpful Tips

I will end this instructable by giving you a few more more helpful tips:

If you solder a project, you need to use a 28 pin DIP socket and add the ATMEGA328 after soldering the project.

I got mine here

It is good practice to solder some malevor female header pins to the 3 first legs so you can still change or upload sketches if needed.

If your micro controller is behaving weird, you can add a 10 to100 uf capacitor in between + and -.

Make sure when you order the chip that it is the ATMEGA328P-PU.

Step 6: Final Note

Did you like this instructable, please click the Favorite button and subscribe.

Also check out my "How to fix Chinese Arduino clones" instructable.

See you in the next Instructable.

Thanks,

Tom Heylen

Facebook: https://www.facebook.com/OfficialTomHeylen

Donate to help me keep doing this work: https://www.paypal.me/TomHeylen/2usd

<p>thanks!</p>
Can i program atmega328 without removing microcontroller from arduino i mean to program like attiny with arduino isp
<p>http://www.fedevel.com/welldoneblog/2015/04/how-to-flash-arduino-bootloader-without-a-programmer/</p>
<p>if you have problems recognizing it in atmel studio with that method you probably have a libusb issue, this answers that </p><p>http://zadig.akeo.ie/</p>
<p>Hi tomheylen, I'm having some difficulties with burning the bootloader. The error is as follows &quot;avrdude: Yikes! Invalid device signature. Double check connection and try again, or use -F to override this check. Error burning bootloader&quot;. What is going on here? Thanks in advance! </p>
<p>I got as far as unzipping the files and putting them in a ..Arduino\hardware folder, then got distracted by something else. Later when I returned to Arduino projects I started seeing this message in red - &quot;Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB&quot; when compiling any sketch. One cure is to delete the above folder. </p><p>I don't notice anyone else reporting this, but I'm a novice so maybe everyone else said to themselves &quot;Oh yeah&quot; and applied the necessary tweak. Could anyone tell me what the tweak is? I hate red messages, even if they are warning/information.</p>
<p>Hi Tom. I have made several single chip arduino based on your instruction. Thanks a lot. However, I got some other annoying problems: <br>&quot;avrdude stk500_cmd() protocol error&quot;<br>&quot;avrdude: stk500_recv(): programmer is not responding&quot;</p><p>Sometimes it works, sometime not. Restart/unplug many times then suddenly it works again. So how can I solve this?</p>
<p>Thanks for putting this together. Will be great to integrate this chip directly onto a PCB with a few other components my project needs. Sometimes 'integrated' is much more helpful than 'smallest'. Great instructable.</p>
<p>I am using IDE 1.6.8 and tried same but here is error I am facing ...</p><p>avrdude: Device signature = 0x0000ff<br>avrdude: Expected signature for ATmega328P is 1E 95 0F</p>
<p>I don't have this type of Arduino board that can pull out the micro processor. Is there any way to upload sketches 'without' removing the onboard micro processor?</p>
You can use a FT232RL chip. Cost less than 2 dollar. It is a USB isp programmer. Here is the link: http://s.click.aliexpress.com/e/VbQvJYJA2
<p>...does that mean you can use it to program the ATM328 WITHOUT needing a full Arduino to hand? Including the bootloader? Because that would make this method MUCH more practical for cash starved noobs like myself.</p><p>(Price and ease of using the Nano aside, it WOULD be much cooler to be able to wave a bare old-skool style microchip at someone and say &quot;I programmed this!&quot; before clipping on a button cell and some LEDs or the like and having it run through a pretty flashing pattern, vs an obviously manufactured board with them built in that connects to a powerbank :D )</p>
<p>...does that mean you can use it to program the ATM328 WITHOUT needing a full Arduino to hand? Including the bootloader? Because that would make this method MUCH more practical for cash starved noobs like myself.</p><p>(Price and ease of using the Nano aside, it WOULD be much cooler to be able to wave a bare old-skool style microchip at someone and say &quot;I programmed this!&quot; before clipping on a button cell and some LEDs or the like and having it run through a pretty flashing pattern, vs an obviously manufactured board with them built in that connects to a powerbank :D )</p>
Hi Hoanphom, I need to have some beers with some friends now. So I will be back with you tomorrow. It is quiet easy but I like to provide a clear working answer.
<p>No problem. Thank you. This is very useful when I need to keep the battery as long as possible. Just ordered both components. I'm really appreciate a lot with some simple wiring between the ATMEGA328P-PU and the FT232RL.</p>
<p>Hi sorry for the late reply. I got this question alot so I made a mini instructable for it. Here it is:</p><p>https://www.instructables.com/id/How-to-Connect-a-FT232RL-Programmer-to-the-Arduino/</p>
<p>Thank you so much :-)</p>
I have bad experience with chips from china specially 328p, now that is so popular. I rather spend little more and buy it on farnell, DK, mouser etc. Also for 2$ you can get arduino clone from china. <br>Anyway the AVRs are overpriced, compare (original) arduino board with STM32 board and you'll see the difference!
I didn't read all of this but dont you somewhere have to modify the fuse bits to go to/from internal/external oscillator? Also I read somewhere that the internal osc may work with the serial port but bc of its inaccuracy sometimes needs calibration. I prefer to add xtal, caps and a 5 pin header so I can re-program my sketch in-circuit. The greatest savings is in not having to include the serial chip in the design. I have a dedicated chipless old Uno that acts as a programmer, one Avr Dragon for the fuse bits and then some home-made shield for burning the bootloader.
<p>Hi Tom Heylen,</p><p>Thanks a lot. I did it and it works ok. I have a question. What modification do I need to do If I want to use the 16MHz oscillator? I appreciate your help.</p>
<p>You need to connect a 16Mhz oscillator between pin 9 and 10 with 2 x 22pf capacitor. And then select board &quot;Arduino Uno&quot; in the IDE.</p>
<p>Just out of curiosity, can the enabling of the internal 8MHz clock be done with the ATmega168 microcontroller using the same Atmeg328 on a breadboard file and following the same procedures as described?</p>
<p>Not sure. I have never worked with an atmega168. Give it a try. </p>
<p>Hi Tom, are the Atmega328P chips from china/aliexpress actually good? If so, maybe it's worth waiting for the slow boat to get them in bulk, instead of from Mouser for 3-400% of the cost...</p>
<p>Make sure to order the ATMEGA328P-PU. They come by airmail and usually takes around 2 weeks. Look at the link in parts list. That are the ones I got and they work perfect.</p>
<p>This is a very simple - yet tremendously useful - Instructable you have written. The ability to use an ATmega chip embedded in a compact circuit can be extremely useful. Instead of integrating the USB port, all the header pins, 5v regulator, and all that, you could just have an ATmega right on the PCB. I love this idea. I'll still use an arduino for experimenting, but in permanent applications the bare ATmega chip will suffice.</p>
<p>Thanks. </p>
<p>You can indeed pull the chip from an arduino (if you have that type) and replace it with another chip to burn the boot loader, however it is easier to just buy a chip with the bootloader already burned, they do sell them that way, skip a step, but it may cost you a few cents more. I have also pulled the chip and replaced it with one that needed fixing and managed to reburn the bootloader and get it going again. That is the fantastic thing about arduino, you can do most anything you can dream up buy just doing a bit of research.</p>
<p>If you can do all these functions using the socket already on the Arduino, would it work to convert that socket into a ZIF (perhaps plugged into the original socket), and you're done? Would that work?</p>
<p>That would likely work, yes. You won't be able to use shields with it, and if you are plugging it into the original socket, you are likely to widen the contacts so that you can't use just a chip with it afterwards, as the flat pins on the ZIF socket go the other way than the DIP pins.</p><p>Images are CC BY-NC-SA 3.0 <a href="https://sparkfun.com/" rel="nofollow"> https://sparkfun.com/</a></p>
<p>Guess things are a bit more expensive in the UK, Jullian did this last year and it cost him 5 bucks. Nice redo of Jullian's project though, you can see his video on the subject here: </p><p>https://www.youtube.com/watch?v=sNIMCdVOHOM</p><p>I built two of these last year, the first I managed to burn up the second time I used it, my own fault by hooking it up backwards.</p>
<p>Great ideas, and a MUST about the socketing of chips. I've burned out a few of the more expensive chips by soldering them into a circuit - never again.<br><br>I also must admit to trying to test a circuit and wondering why it won't work! (Because I forgot to insert the chip into the socket! Joke was on me!). But they all worked fine once the chip went in.<br><br>Great instructable!</p>
<p>Thanks for the great instructable. I am building a thermal flashlight and will will attempt to use this method to not tie up an arduino. BTW the current price for the chips is $1.46 each. All of the other components I already have. For me, this is a $1.46 arduino.</p>
Great to hear. The atmega328 as a stand-alone give you a lot of opportunities for future projects.<br>Would be great if you post a picture when your flashlight project is finished. Cheers Tom
<p>Thanks Tom. Would also be great to have an instructable on using the atmega (or programmed Arduino) without connection to the computer.</p>
<p>Just connect pin 7 and 8 on the atmega328 to a 5v power supply and you are ready to go. Make sure to connect pin 7 with 20.</p>
tomheylen <br><br>while uploading a sketch you xan remove the old one and insert the new ic .<br><br>same case in burning burning bootloader
I was thinking about this too

About This Instructable

60,101views

751favorites

License:

Bio: I like to make stuff in my free time. Especially programming, cooking, electronics etc. Lately I'm making tutorials about stuff I made the last ... More »
More by tomheylen:Long range, 1.8km,  Arduino to Arduino wireless communication with the HC-12. How to connect a FT232RL programmer to the Arduino ATMEGA328 for uploading sketches $2 Arduino. The ATMEGA328 as a stand-alone. Easy, cheap and very small. A complete guide. 
Add instructable to: