Download PDF Parts List View on YouTube

Introduction

The Arduino Uno is probably the most popular Arduino board, and for good reason.  It’s relatively small, very inexpensive (especially clone boards) and has a wealth of support code and documentation. It’s also likely the first Arduino board you started working with, for some of you it may even be the only Arduino board you own.

You’ll find that the majority of projects and demonstrations that I perform on this website and on the YouTube channel use an Arduino Uno. It’s also my favorite Arduino board.

But the real value of the Arduino Uno is as a development or prototyping board.  With an Arduino Uno and a solderless breadboard you can quickly bring ideas and concepts to life, its connectors work well with jumper wires and the wealth of code available for the Arduino platform makes development tasks a breeze.

After you finish you’ll have a working project but it may not be a practical one to use in the real world. It has no enclosure and as it consists of an Arduino Uno, a solderless breadboard and various wires, modules, and components. It’s actually pretty fragile.

Now it’s the time to move that project off the breadboard and into something more permanent. And there are many ways of doing just that.

From Prototype to Production

After you finish your prototype you’ll want to give consideration for making a practical, permanent version of it.  You have a lot of choices and the correct one will depend a lot upon the nature of your project.

  • Will your project be used in harsh environments, like outdoors in the rain or snow?
  • Does your project need to be fit into a specific enclosure or existing object (i.e. a toy)?
  • Will it be AC or battery powered?
  • Will you ever need to reprogram or update it?
  • Will you be the only person using it or does it need to be designed so that anyone can use it, regardless of their technical abilities?
  • Will you be mass-producing your project, or is it just a one-off run?

The answers to these questions will determine the best way to take your prototype and turn it into a permanent device.

Once you have determined the design requirements for the finished project you will want to start planning how to build the final product. You might be creating a printed circuit board for your device or, if it is just a one-off run, you may just decide to wire it up on perfboard.

From Arduino Uno to ATmega328

One big thing that you’ll need to factor into your decision is the Arduino Uno itself. It may be perfect for your permanent project, but again, it may not be.

Fortunately, you have several alternatives to using a full-sized Arduino Uno in your project.

Arduino Uno Alternatives

The Arduino Uno is a wonderful device. With a generous helping of digital I/O ports, 8 analog-to-digital converters, I2C, Serial and SPI interfaces and onboard voltage regulation it is suitable for powering a wide variety of devices. It has a built-in USB port and onboard LEDs and can provide both 5-volt and 3.3-volt low-current power supplies for your peripheral devices.

But it’s a bit large. Not huge, but not small either. Yes, it can fit inside an Altoids mint container (the classic DIY enclosure) but you won’t have room for very much else.

It’s not very expensive, but it also isn’t very cheap either. Maybe not a concern for a one-off device but if you are mass-producing them then the cost of an Uno board (genuine or clone) can become a major factor in your devices price point.

Even if you don’t plan to mass-produce your project you may not want to give up your Uno board, especially if you only own one of them.

The Arduino Uno is an excellent prototyping device, and in many cases, it can also be used in a final product. But there are alternatives.

  • The Arduino Nano – This small board can do everything an Arduino Uno can, it even has two additional analog to digital converters. It has a mini USB connector instead of the bulky Type B connector used on the Arduino Uno. Cost wise it’s a bit less expensive.
  • The Pro Mini – This is an even smaller version of the Nano and shares the same features, except for the USB port which it lacks. To program it you’ll need an FTDI adapter. Great when your project will never need reprogramming. It is also less expensive than the Uno and is also available in 3.3-volt configuration for use with batteries and low-powered logic chips.
  • The ATmega328 – This is the solution you’ll be reading about in this article.  It’s the microcontroller that powers the Arduino Uno, and it can be used all on its own.

Each of these alternatives has its own advantages (and disadvantages), there is no universally correct choice.

The ATmega328

The ATmega328 is a single-chip microcontroller with the following features:

  • 8-bit RISC (Reduced Instruction Set Computer) processor core.
  • Runs at clock speeds from 1MHz to 20MHz.
  • 32Kb Flash Memory.
  • 2Kb SRAM (Static Random Access Memory).
  • 1Kb EEPROM (Electrically Erasable Read Only Memory).
  • 23 GPIO (General Purpose Input-Output) lines.
  • 32 general purpose registers.
  • I2C, SPI, and Serial interfaces.
  • 10-bit Analog to Digital converters – 6 in DIP package, 8 in surface-mount package.
  • Internal and External Interrupts.
  • Available in DIP and Surface Mount packages.

The ATmega328 was originally developed by Atmel.  Atmel was purchased by Microchip Technology in 2016 and now holds the patent to the ATmega328.

The original Arduino Uno and its clones used the 28-pin DIP (Dual Inline Package) version of the ATmega328. Other clones and boards like the Nano and Pro Mini make use of surface mount versions, this explains why the Nano and Pro Mini have two additional analog to digital converters.

We will be working with the 28-pin DIP version for our experiments. It’s an ideal chip for most experimenters as it fits nicely on a solderless breadboard and on a perfboard.

Of course, if you are creating printed circuit boards for your project you may also use the surface mount version of the ATmega328 to reduce the size of your project even further.

ATmega328 Pinouts

Let’s take a look at the pinouts of the 28-pin DIP package version of the ATmega328.

ATmega328 Pin Functions

As you can see from the diagram above the ATmega328 has several pins that have two, or even three, functions. You can change the functions of these pins programmatically within your sketch, the same is true of the Arduino Uno (which makes perfect sense as the Uno is based upon the ATmega328).

When converting your design from an Arduino Uno to a raw ATmega328 chip it is helpful to be able to relate the pinouts on the ATmega328 to the connections on an Arduino Uno.  The following pinout diagram has been relabeled to show the Arduino Uno equivalent functions:

ATmega328 Arduino Pin Equivalents

An example might be helpful to help you equate the pins on an Arduino to those on an ATmega328.  For that reason, I’ve put together a very simple project that can be quickly prototyped on an Arduino Uno. We will then look at what is required to move our simple project to an ATmega328.

Star Wars Arduino Code & Project

For my simple project I decided to build a “music box” with a Star Wars theme!  

The design is very simple and the sketch, which I will show you in a moment, was readily available on GitHub. It took just a few minutes to put the prototype together, but nonetheless, I think it will serve to illustrate how to move code to the ATmega328 quite well.

After building this you’ll realize that using an entire Arduino Uno is a real overkill, as only three digital I/O pins are put to use. It also would lend itself well to being mounted into a Star Wars toy or a custom 3D-printed enclosure.

Star Wars Music Box Hookup

Our “music” box only requires a few components:

  • An Arduino Uno (which we will be replacing with a stand-alone ATmega328).
  • Two LEDs. If you want to use more LEDs you’d need to add a driver transistor to prevent pulling too much current. Otherwise, any two LEDs will suffice, I used a red and green one.
  • Two dropping resistors. I used 220 ohms for each of these but any value from 150 to 330 ohms will work fine.
  • A Piezo Buzzer. This might be the only part that you don’t have in your parts drawer, it’s readily available from Amazon, eBay or just about any electronics store. It is very inexpensive.

Gather together the required components and hook them up as per the following diagram:

Arduino Music Box Hookup

As you can see this is a very simple project to hook up. Make sure to observe proper polarity on the LEDs and on the Piezo buzzer.

Star Wars Music Sketch

Once you have the “music box” hooked up you’ll need a sketch to make it work.

I took the easy road and used an excellent sketch that has been on GitHub for over 6 years. It is the Arduino Song sketch by Nick Sort, you can take a look at it here:

<INSERT ARDUINO MUSIC SKETCH>

The sketch is both brilliant and simple. If you are musically inclined you could modify it to play a different song.

The sketch begins by defining constants that represent the musical notes. Each note is given a value that represents its frequency, for example, an “A” is assigned a value of 440Hz (this is “A above Middle C”, a common tuning reference).

If you plan on playing a different song you could extend the range of notes, keep in mind that the piezo buzzer used in the sketch doesn’t have a very wide frequency response.

After defining the musical notes we define three integers to represent the pins that the piezo buzzer and two LEDs are connected to.

Finally, the last definition is an integer used as a counter, this will be used to determine which LED to flash while the tune is playing.

In the Setup section we simply define the I/O pins as outputs.

Before we move on to the Loop it will be helpful to jump down and examine a function that is the key to making all of this work.

The beep function takes two inputs, both integers. The first input is the note as defined at the beginning of the sketch. The second input is the duration of the note in milliseconds.

In the function, the Arduino tone function is used to play the desired note on the piezo buzzer for the desired amount of time.

Next, the counter is examined to see which LED to turn on. The LEDs alternate, when the counter variable is an even number the first LED is illuminated, otherwise the second one is used. The LED is turned on for the same duration of the note and then turned off. The result is that the LEDs follow the music.  

After that the noTone function is called to reset the piezo pin so that it goes silent and is ready for the next note.

A 50-millisecond delay is added to provide a break between notes.

And finally, the counter is incremented by 1 so that ton the next iteration the opposite LED will be flashed.

Now that you understand the beep function understanding the rest of the sketch is pretty easy.

You’ll notice two additional functions, firstSection and secondSection. These functions just call the beep function many times, they each represent a repeatable pattern of musical notes used in our song.

Back to the loop. It looks just like the firstSection and secondSection functions. It just keeps calling the beep function, as well as the two section functions, with the occasional time delay.

This is how we play our song!

Load up the sketch and listen to the buzzer. If you are a Star Wars fan you should notice a rather raspy version of “The Imperial March”, also known as Darth Vader’s Theme.

May the force be with you!

Now that we have our project working let’s see what is involved in rebuilding it with an ATmega328 instead of an Arduino Uno.

Building an “Arduino” with ATmega328

If you look closely an an Arduino Uno board you’ll notice that aside from the ATmega328 there really are not very many components. Most of the “extra” parts have to do with either the USB to serial interface or with the internal 5-volt and 3.3-volt regulators.

In actual fact, you can put together a functional equivalent of an Arduino Uno using only an ATmega328 and five parts. You can even wire on up without any additional parts if you are willing to run it at a lower clock frequency.

But before we get out our ATmega328 chip and start breadboarding we need to discuss one important aspect that we haven’t covered yet – the bootloader.

The Arduino Bootloader

A “bootloader” is code that is burned onto the ATmega328 chips EEPROM. This code is loaded when the processor is powered up or reset and it sets up things like the clock frequency and a number of the internal registers. It also gets the ATmega328 ready to accept programs from the Arduino IDE on its serial RX and TX pins.

The Arduino Bootloader is essentially what makes an ATmega328 into an “Arduino”. It is open source code that is already available in your Arduino IDE, and you can use the Arduino IDE to load a bootloader into a blank ATmega328 chip.

You might not need to do this though. You can purchase an ATmega328 with the bootloader already installed. That is what I did for this project. Look for an ATmega328 chip that has the letters “PU” at the end of the part number, i.e. ATmega328P-PU.

If you do need to burn your own bootloader there are many resources that will show you how, including the one on the official Arduino website. You can also get dedicated devices that burn bootloaders automatically, useful if you have dozens or hundreds of chips to set up.

Personally, I always purchase the chips with the bootloader already burned, they are only slightly more expensive than blank chips and the extra cost is worth it, at least to me it is.

ATmega328 build Hookup

Assuming that you have an ATmega328 with a bootloader burned onto it you are now ready to wire it up. You will need a few extra components for your “homemade Arduino”.

  • A 16MHz crystal.
  • A 10K resistor.
  • Two 22pf capacitors
  • A 10uf capacitor. This is actually optional and is used just for power supply filtering.

The wiring is shown below:

ATmega328 Wiring

As you can see the wiring is very simple. If you are going to create a printed circuit board for your project eventually the only consideration is that you should try and keep the crystal and two 22pf capacitors reasonably close to the chip.

Of course, you’ll also want to hook up the two LEDs and the piezo buzzer to it, as follows:

  • The LED /dropping resistor connected to Arduino pin 13 is connected to pin 19 on the ATmega328.
  • The LED /dropping resistor connected to Arduino pin 12 is connected to pin 18 on the ATmega328.
  • The piezo buzzer connected to Arduino pin 8 is connected to pin 14 on the ATmega328.

You will also require a 5-volt DC power supply.

ATmega328 on breadboard

Now that we have our ATmega328 wired up we are ready to load our sketch onto it. There are actually several ways to do this, I will cover three of them.

Loading the Program – Using Arduino

You can use an Arduino Uno to load the sketch onto the ATmega328, but only if you have the right kind of Arduino Uno.  Let me explain what I mean by “right kind”:

The original Arduino Uno, as well as several clones, use a 28-pin DIP version of the ATmega328. The same type of ATmega328 that we are going to be programming.

This chip was mounted in an IC socket and thus can be removed. And the ability to remove the chip from its socket provides us with two methods of using the Arduino Uno to program an ATmega328 for our stand-alone configuration.

  1. We can program the chip in the Uno, then remove it to use in our project.
  2. We can remove the chip from the Uno and use the Uno to do the USB to serial conversion to program our ATmega328 on a breadboard.

Of course, if your Arduino Uno clone uses a surface mount chip then you’re out of luck. But fear not, there is a third method of programming an ATmega328 that doesn’t require an Arduino Uno at all.

First, let’s examine the two methods I just listed in a bit more detail.

Method 1 – Using ATmega328 from Arduino

This is the easiest method of them all.

Simply use the Arduino Uno as you normally would and program your sketch onto it.  Then carefully remove the ATmega328 from your Arduino Uno and use it on the breadboard, wired as we have seen earlier.

Chip Puller with ATmega328

The ATmega328 holds your sketch in its Flash Memory. So when it is powered up it will start running it, just as if it were in an Arduino Uno.

It really doesn’t get any easier than that. Of course this method, while simple, has a few obvious disadvantages:

  • You now have an Arduino Uno without an ATmega328.
  • The IC socket on the Arduino Uno is not really made for repeated removals and insertions. Eventually, you will degrade or damage it if you do this a lot.
  • You run the risk of damaging the ATmega328 if you aren’t careful.

The last point can be avoided by using a chip removal tool and by observing anti-static precautions. Be very careful to examine the ATmega328 to be sure that you haven’t accidentally bent one or more pins when removing it or inserting it into the IC socket or the breadboard.

Now let’s look at the second method of using an Arduino Uno to program an ATmega328.

Method 2 – Using Arduino as a Serial Connection

The second method also requires an Arduino Uno that has a 28-pin DIP version of the ATmega328. As with the first method you’ll need to remove the processor from the Arduino board. Unlike the first method, however, you will just be putting the ATmega328 aside. After we are done you can put it back into the IC socket.

This method will make use of the USB to serial converter that is built into the Arduino Uno. The outputs of this converter are always available on pins 0 and 1 of the Uno’s digital I/O connecter.  With this method we will just send those outputs to our ATmega328 on a breadboard.

Method 2 Hookup

To start off you will need to wire up an ATmega328 on a breadboard exactly like you did before, with the crystal, two 22pf capacitors, 10k resistor and the (optional) 10uf electrolytic capacitor.

You will then connect the Arduino Uno, without its onboard ATmega328, to your breadboard as shown in the following diagram:

ATmega328 Wiring using Arduino Uno

Again remember, although it isn’t shown in the diagram above you need to have all of the other wiring to the ATMega328 as well. This diagram only shows the additional connections you need to make using the Arduino Uno!

What you are doing is tying the RX (receive) pin of the Arduino Uno to the RX pin on the ATmega328 (pin2). You are also connecting the TX (transmit) pin on the Uno to the ATmega328 TX pin (pin 3). And, finally, the Reset pin on the Arduino Uno is connected to the Reset pin on pin 1 of the ATmega328.

Remember, there is already a 10k resistor attached to pin 1, you need to leave that in place.

You can use the 5-volt output and Ground connections on the Arduino Uno to power your breadboard, you don’t need a seperate power supply.

Programming Method 2

There seems to be a lot of conflicting advice on the web regarding how you setup the Arduino IDE to program your ATmega328 using this method. Some suggest that you change the board type.

I have not found that to be necessary. I just leave my Arduino IDE set exactly as it was when programming my Arduino Uno normally. And it worked every time.

So once you have this setup load your sketch up to the ATmega328 and you should be good. In my case I loaded our Star Wars Music sketch up to the ATmega328 and it worked just fine.

Arduino as programmer on breadboard

When you are loading your sketch you should notice that a few of the LEDs on the Arduino Uno wil blink, just like they do normally. It’s a good indication that everything is working properly.

This method has many advantages over the first one, the main advantage being that you can still use your Arduino Uno after you are done.

But what do you do if your Arduino clone uses a surface mount chip, or if you just don’t want to pull the chip out of the socket on your board? Let’s look at another method that doesn’t use an Arduino Uno at all.

Loading the Program – Using FTDI Adapter

The third, and final, method we will look at for programming an ATmega328 requires a couple of additional components.

  • An FTDI adapter.
  • A 100nf capacitor.

The first of these components requires a bit of explanation.

FTDI Adapter

The FTDI Adapter is a USB to serial convertor that is commonly used to program an Arduino Pro Mini and other microcontrollers that do not have a USB port. The “FTDI” abbreviation comes from the original manufacturers’ name, a Scottish company called Future Technology Devices International.

These adapters allow you to convert USB level signals to TTL level, which is usually 5-volt logic levels. Some designs also allow the use of 3.3-volt logic, usually selectable using either a jumper or a solder pad on the circuit board.

FTDI Adapters

I show a couple of these adapters in the above image. One interesting thing about the two adapters I’m showing here is that the connectors on them are wired backward to each other, in other words one of them is actually upside down!

When using your FTDI adapter pay attention to the markings on the connector to be sure that it is connected correctly.

FTDI Adapter Wiring

The following diagram shows how you connect an FTDI adapter to your breadboard with an ATmega328. Once again I’m not showing the ATmega328 breadboard components but remember they still need to be there!

ATmega328 Wiring using FTDI Adapter

Note that the DTR (Data Terminal Ready) lead on the FTDI adapter connects to the Reset pin (pin 1) on the ATmega328 through a 100nf capacitor.  If your FTDI adapter does not have a lead labeled RTS then look for one called DTR (Data Terminal Ready), in this case it should perform an equivalent function.

Once again remember to leave the 10k resistor that is already attached to poin 1 on the ATmega328 in place, as well as all the other ATmega328 components.

Also, note that unlike the previous method which used the Arduino Uno the FTDI method requires you to reverse transmit and receive. So the RX output from the FTDI adapter connects to the TX pin (pin 3) on the ATmega328 and the TX output from the FTDI adapter is attached to the RX pin (pin 2) on the ATmega328.

Again you may use the VCC and GROUND outputs from the FTDI adapter to power your breadboard instead of using a seperate power supply.

Programming with the FTDI Adapter

Once again I found I didn’t need to make any changes in my Arduino IDE, it just worked as it always did. One thing to note however is that the computer in my workshop is LINUX (Ubuntu 16.04) and if you are using a Windows computer you may need to install a driver to use the FTDI adapter.

Otherwise I kept the board type as an Arduino or Genuino Uno and it worked correctly.

You can observe the LEDs on the FTDI adapter when you upload code to it, you should see some activity here. And your ATmega328 should work as it did before.

This method of programming an ATmega328 has a lot of advantages once you get it working, the primary one being that it is completely independent and does not require you to modify an Arduino Uno.

Conclusion

The ATmega328 chip is an ideal solution when you want to make a permanent version of your latest design.  If you are planning to mass produce your design it is a perfect method to reduce both size and cost.

I hope you enjoyed this tutorial. I’d be interested to hear how you have taken your Arduino Uno designs and “shrunk” them down onto an ATmega328.

 

Parts List

Here are some components that you might need to complete the experiments in this article. Please note that some of these links may be affiliate links, and the DroneBot Workshop may receive a commission on your purchases. This does not increase the cost to you and is a method of supporting this ad-free website.

COMING SOON!

 

Resources

Arduino to Breadboard – The official instruction from Arduino for burning a bootloader and putting an ATmega328 chip on a breadboard.

Arduino Star Wars Sketch – The original sketch by Nick Sort on GitHub.

Microchip – Manufacturers of the ATmega328.

Future Technology Devices International – Developers of the FTDI adapter.

 

 

From Arduino Uno to ATmega328 – Shrinking your Arduino Projects
Summary
From Arduino Uno to ATmega328 - Shrinking your Arduino Projects
Article Name
From Arduino Uno to ATmega328 - Shrinking your Arduino Projects
Description
Learn how to transfer your Arduino Uno projects to an ATmega328 chip so you can create a permanent version in a custom enclosure. Uses a Star Wars music box as an example.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:
Subscribe
Notify of

56 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Bj D
5 years ago

Excellent video!! Thanks for putting this up, provides me with what I need for my project. I was wondering how to avoid using the whole UNO for it, now I have the solution. Question – can the ATMega be powered by a 9-volt battery, or is only 5-v?
Thanks

pagasus98
5 years ago
Reply to  Bj D

you could use avoltage divider,which is basicaly just a resistance of high enough value like 10k 0r 100k

walter
3 years ago
Reply to  Bj D

The ATMEGA328P chip itself can operate with a wide range of supply voltage. The data sheet says 1.8 to 5.5 V. Of course, you do have to consider the other circuitry you have attached to the chip, and ensure input and output levels are compatible. If you wish to use a 9V battery, or anything with a voltage higher than the 4.5V from 3xAA cells, then you’ll need to use a voltage regulator between the battery and the ATMEGA328. That voltage regulator would most likely be either 5V or 3.3V, and that choice will depend, again, on what other stuff… Read more »

Davi
5 years ago

It would be really interesting if you made a voice recorder with arduino for the house automation, if you say “turn the lights on” the arduino reads it and the relay activates the light bulb. Thank you for all the help with my projects by the way, I’m a big fan of your work.

Khalid Mian
4 years ago

When try to upload the program I get error messag Sketch uses 3102 bytes (9%) of program storage space. Maximum is 32256 bytes. Global variables use 80 bytes (3%) of dynamic memory, leaving 1968 bytes for local variables. Maximum is 2048 bytes. avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x32 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x32 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x32 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 4… Read more »

Tim
4 years ago
Reply to  Khalid Mian

I had the same problem then some people said to change the board type. Looking at the list I decided to try the “Board Arduino Duemilanove or Diecimila” it worked perfectly.

John
4 years ago

Can you put the code please

Pham Thanh Tung
4 years ago
Reply to  John

const int c = 261; const int d = 294; const int e = 329; const int f = 349; const int g = 391; const int gS = 415; const int a = 440; const int aS = 455; const int b = 466; const int cH = 523; const int cSH = 554; const int dH = 587; const int dSH = 622; const int eH = 659; const int fH = 698; const int fSH = 740; const int gH = 784; const int gSH = 830; const int aH = 880; const int buzzerPin = 8;… Read more »

Y K M
2 years ago

I’m new to Arduino. I just bought Arduino ATMega 328 and necessary components.
I’ve understood circuit and connections. Please guide me how to programme these codes of various projects , explained in this video, using my laptop. I don’t have any previous knowledge about programming.

Angelo
4 years ago

I enjoyed all the information, thanks again

Yes , Excellent video

Xa Quan
4 years ago

I don’t understand when and why we need to use Resistor, Capacitor…. I understand the purpose of each these components but I don’t understand why sometime the Resistor was place after the LED or Capacitors place parallel with the Crystal like in this article.

Austin
3 years ago
Reply to  Xa Quan

It would benefit you to look into the use cases for these types of components, and how they work. For example, it doesn’t matter whether the resistor comes before or after the LED – That’s just the nature of the resistor – it resists current throughout all of the components connected in series with it. The capacitors in this case are a little more advanced – their use involves creating a phase shift which allows the oscillator to behave the way we want – as a clock input. I wouldn’t worry too much about this. The reason he added these… Read more »

Akali
4 years ago

Hi,
I was looking for this plus ur presentation is excellent.
I only have two questions
1) is it possible not to use the capacitors at pins 9 and 10.
2) if Qn 1 is no, can I use an internal oscillator.

1234gh
3 years ago
Reply to  Akali

You can use the internal 8MHZ RC oscillator (described in the Arduino website link in this article).

4 years ago

Nice tutorial – Star Wars Arduino Code & Project

thanks again

4 years ago

Very good tutorial – thanks again

Derrick Lau
4 years ago

An excellent tutorial! I reproduced the circuit at home, but for some reason cannot load the sketch, even after downloading your hardware zip file. What was your Programmer setting on the Arduino IDE?

Concerned Citizen
2 years ago
Reply to  Derrick Lau
Developer
4 years ago

Hello
I have controller ATMEGA328 but without -PU at the end. Can i able to flash my controller using Arduino?
I tried but i could not flash it using Arduino.
Please suggest.

Concerned Citizen
2 years ago
Reply to  Developer

See https://dronebotworkshop.com/arduino-uno-atmega328/#comment-5009
Maybe this helps you.

Note that Walter points out the PU suffix does not necessarily mean a bootloader is pre-installed either: https://dronebotworkshop.com/arduino-uno-atmega328/#comment-3877

Bob Selfe
3 years ago

I have built a gadget using a MEGA2560 that uses 7 LEDs to project 2 different messages, the time and room temperature onto the walls either side of it, reflected off spinning mirrors, also repeated on a TFT display The position of the wall display, and the text width, clock setting and motor are controlled using the TV remote control. I replaced the MEGA2560 with a Uno, and although the program fitted in the memory, it wouldn’t run as there was only 48 bytes left for local variables! Once I copied the character set onto the EEPROM, it worked fine.… Read more »

rukun gupta
3 years ago

I recently got a arduino Uno board. But the pin 6 of atmega328 Ic is not connected to board. But when I did blinking led experiment with digital pin 4 it was working fine. I’m pretty sure that pin 6 is not connected with board. And on internet it was written that pin 6 of atmega328 is digital pin 4 of Arduino Uno board. Then how is it working? Should I replace the board or just work with it only?

Steve Tobias
3 years ago

I am trying to subscribe to the newsletter as well as learn from this project as I have some ATMEGA chips and 16MHz crystals. But my problem is that I cannot subscribe to the newsletter as the link takes me to a blank page with a sad face (on my Samsung phone).
Will try again on com p iter later

Anthony Kenney
3 years ago

I completely love your way of explaining things, learning from what I read here was easy to understand and very clear. I vote you to the top of the board of education as I have never experienced better learning and/or understanding from any other page. I will definitely bookmark this page for future reference. Well done and thank you from here in Cape Town, South Africa.

walter
3 years ago

In this article, you mention that you can buy the ATMEGA328P pre-programmed with the Arduino bootloader, by specifying a device with the part number ending in PU. Sorry, but I do not think that is correct. PU is a standard Microchip part number suffix, shown in their data sheet. (I can send a clip if you wish.) For DIP-28 devices the suffix is PU for -40+85C parts, and -PN for -40+105C parts. Not related to any pre-programming. Otherwise, your videos and web articles are absolutely spectacular. I’m a long-time Arduino user, but I still learn useful things from your presentations.… Read more »

ajaib
3 years ago

Excellent video!
You are liked by the way you explain in all your articles and videos.
We understand very easily.
Thank you

Richard
3 years ago

Hi

Richard
3 years ago

Hi, New to this, but having trouble with the orange FTDI board. Didn’t say anything about connecting it up to Windows 10 PC ie Drivers needed and what to select when on the Arduino IDE Tools\ Board etc. I Have tried looking for drivers and I think I have found some. But using a new Amega328P-PU chip it comes up with an error AVRDUDE stk500 recv() programmer not responding? when down loading the Blink program. The RX TX flash on the FTDI board on switch on but only the Tx flashes on upload. On my Elegoo the onboard Led flashes… Read more »

Concerned Citizen
2 years ago
Reply to  Richard

Your reply is over a year old, but hopefully this helps someone else. I just solved the same problem for myself by first flashing a bootloader. The most likely problem is that the Atmega328P(U) you have does not have a bootloader installed. If you have another Arduino (e.g., an UNO), it is relatively straightforward to install one using 6 jumper cables: https://support.arduino.cc/hc/en-us/articles/360012048080-How-to-burn-the-bootloader-between-two-Arduino-UNO You can follow the wiring from https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP Pins 11 to 14 on the arduino board correspond to pins 17 to 19 on the Atmega328. Make sure to select “Arduino as ISP” as the programmer when flashing the bootloader.… Read more »

TdRb
3 years ago

Loved the video and successfully burnt blink sketch onto A328 several times using Arduino board as per above setup and using different blink rates to be sure the process was reproducable. I then went on to successfully burn same onto a pro mini using FTDI FT232RL. However cannot get FTDI to respond to the bread board A328 setup. I see the FTDI blink 3 times then nothing. Have tried reseting via push button from DTR and have checked double checked and triple checked that setup is okay. My Chip is a A329PU but had no bootloader on it so burnt… Read more »

Yuke
3 years ago

Can i use this project for
My ac motor, because i dont want arduino board
but without arduino board can i run the ac motor
i have uploaded the code in the board, please reply….

Mustafa
3 years ago

nice

R Taylor
3 years ago

I found the simplest way to work with the standalone atmega328p is to get an inexpensive programmer shield for the Uno. The shield has a zero insertion force socket for the chip, and using the TinyCore sketch for the Uno (Arduino as ISP) burning the various bootloaders (all clock speeds available) and loading sketches is easy. No wires or breadboards, it couldn’t be simpler.

Look up “AVR ISP Bootloader Shield” on BangGood or Aliexpress, mine cost 9 Australian dollars and works reliably.

Joseph T Tannenbaum
3 years ago

Sounds much better with a small speaker instead of the buzzer. 🙂

Prabhat ranjan
3 years ago

Hello Sir,
Your videos are really amazing and they really very useful for my projects. Nowadays I am trying to upload sketch on atmega328 PU controller which I have purchased from market. I am trying to follow
the way you are doing. I am using Arduino UNO board for the purpose, I gently removed the available controller from the board and used the purchased IC and bread board, made the connections. But every time I am getting the error. The problem comes only when I am using the Atmega328pu IC which I have purchased from outside.

A.Zand
3 years ago

Hi Dear Sir,
your site has not a list of the projects that you have the film in youtube..

Steve Tobias
3 years ago

Using the shield is there a way to copy the sketch onto a 328 IC’s. I have only used the shield to burn bootloaders onto the new chips

thomas
3 years ago

thanks! amazing!

Wisdom Mbaga
3 years ago

Thank you so much for this helpful and very informative tutorial

Silvestre
3 years ago

Just amazing tutorials. Thank you very much Walter for your time & sharing your experience and knowledge.

A Friend
2 years ago

So, can we still use the RX and TX ports of the ATMEGA328? Because I need to use ATMEGA328 in my project and it needs to be in touch with another ARDUINO through the serial ports.

aaron
2 years ago

I carefully bread boarded the stand alone Atmega328 with 16 mhz crystal,22 caps,10 K resistor to reset pin 1 etc, …I programmed the chip using a Uno shield, then insert the chip. But the circuit seems frozen…I can see the LCD1602 display my code, so I know it has my sketch- but bread boarded circuit doesn’t seem to be actively clocking. Anyone run into this issue?

Last edited 2 years ago by aaron
Helbot
2 years ago

Thank you! This webpage has taught me a lot and has started to fill in the gap in my knowledge about programming for production.

Farzad
2 years ago

Great channel, well-taught. Thank you very much. While I know I can’t build most of what you are presenting, I am very interested in electronics and I build stuff, but mostly analog. One day hopefully I can take advantage of the higher technology you are using to build my projects.

seema
2 years ago

when i load the sketch by second method .each time it shows error while uploading.After a lot of effeort the code is uploaded. why so

2 years ago

Can someone provide a link to some options for FTDI adaptors? There are various items that look similar, but I want to make sure that I locate the correct item! Thanks

Khaled Albanna
2 years ago

good work, Thanks

Getachew
2 years ago

This is the resource I have been searching for. Thank you.

Troy Yanda
1 year ago

with the 328 alone do I still have the ability to write in INPUT_ PULLUP or will i have to put in a resistor into the project? Thanks Bill

Vijay Sulakhe
1 year ago

Excellent video and explanation…
Can I use Atmega168 or Atmega8 in place of 328?

Muftawu Mohammed
1 year ago

Thank you very much Sir. You made it very easy to understand and I really love your presentation.

ALEXIOS TSETSONIS
1 year ago

What setup do we use for uploading with ftdi ? I refer to the programmer and the board…!

Abdul Sadiq
1 year ago

I wanted to build my own Arduino board using atmega3pu, I tried uploading on the breadboard using FTDI adapter but it’s not working, i followed your tutorial include using same FTDI adapter and others but still not uploading, whenever I tested the atmega-328 on an Arduino and it works perfectly, I used Arduino on a breadboard it works for a while then also stopped uploading; Please what do I do, cause I needed the atmega328 to customize my projects

Michael Cochran
11 months ago

I really enjoyed the video and it was just what I was looking for. I have an upcoming project that this is perfect for, but I am concerned with my power supply options. Do you have any suggested schematics for a power supply circuit?

shmuel attias
7 months ago

hello
I built the flash led circuit with an atmega328P chip from an arduino bord sketch download and verified on bord , like in your video and it doesn’t work. I made about 3 attempts including solderingon a print without success. the crystal & 22pf capacitor from arduino vendor …the LED is not blinking …30 years of electronics for nothing … What could be the reason? like something is missing to ignite the circuit .
some help will be great .
best regards

D... W...
3 months ago

Thank you very much for this! Did you find a U.S. source for the 16mhz crystal.
The Crystal used for the original UNO R3 is part# X49SD16MSD2SC from YXC
But I don’t know if there is a dealer within the U.S. who sells these.
Can you advise?
Sincere thanks