Introduction: Bootloading and Mounting Arduino Atmega328 - I Made It at TechShop

Picture of Bootloading and Mounting Arduino Atmega328 - I Made It at TechShop

This Instructable shows how to bootload and mount an Atmega328, Atmega328p or Atmega328p-pu for any project. This is a great way to save money by purchasing Atmega328 DIP package microcontrollers instead of using the Arduino development board itself. I put this together at techshop to be able to bootload microncontrollers for future applications they don't do a ton in electronics or programming but you can make some sweet gagets / enclosure there: http://www.techshop.ws!

You can purchase bootloaded Atmega328s from places like sparkfun but it's usually quite cheaper to get a non-bootloaded microcontroller. The Atmega328p-pu used in this instructable was purchased from tayda electronics for 3.50$, its a good place to buy many electrical components. All components except the wires and the arduino itself was purchased from http://www.taydaelectronics.com

I didn't make the code for the bootloading, I'm using the code offered at https://github.com/WestfW/OptiLoader

For required parts you will need:
Atmega328 Bootloading

1 - Arduino Uno with a bootloaded Atmega328
1 - Atmega328, Atmega328p or Atmega328p-pu
1 - 16MHz crystal
2 - 22pF Capacitor
1 - 10k ohm resistor
1 - breadboard
wires
Mounting Flashed Atmega328
1 - Atmega328, Atmega328p or Atmega328p-pu
1 - 16MHz crystal
2 - 22pF Capacitor
1 - 10k ohm resistor
1 - breadboard
5v DC power source or
DC power source above 5v with voltage regulator (Step 6)
wires
(optional parts)
1 - LED
1 - 220 ohm resistor
1 - pushbutton
1 - 10k ohm resistor
1 - 0.1uF capacitor


Step 1: Bootloading Schematic

Picture of Bootloading Schematic

With the parts required, this is the schematic for bootloading the Atmega328.

In some cases the 16Mhz crystal circuitry is not required if the Atmega328 registers are set to use the internal clock. But if you include the circuitry it wont matter either way. (so I just recommend including it anyways)

A possible issue: as you can see the VCC to the Atmega on the breadboard is powered by Digital pin 9. This could be a problem since it can only supply so much current to the breadboard. So do not add any other circuitry to this otherwise it may not work. The VCC is connected to pin 9 so the code can easily reset the microcontroller for programming.

Step 2: Bootloading Program

Picture of Bootloading Program

I'm using code from the source https://github.com/WestfW/OptiLoader

You need to make a program with a .ino file (arduino file) also a .h file (header file) and copy the code from the website.

I also included a zip file that has the program already.

Once you have this project made verify and upload to your Arduino.

If you want some feedback while the Atmega328 is being bootloaded you can connect a serial terminal to the Atmega328s serial TX pin (pin 3). To do this you will need a RS-232 to USB cable, and a terminal program like docklight or X-CTU. (This is not required)

Once the Atmega328 is bootloaded you can test it by taking the Atmega328 from the Arduino and replacing it with the recently bootloaded one. Try uploading a program to the new Atmega328 and see if it works! I would suggest uploading the blink program since no circuitry is required to see if its working.

Step 3: Bootloading Atmega328

Picture of Bootloading Atmega328

That should complete it for bootloading yourself a new Atmega328!

If bootloading was unsuccessful you can reference the https://github.com/WestfW/OptiLoader readme. You can also try switching the pin 9 to VCC for powering the Atmega328.

I have done this bootloading multiple times with many microcontrollers. I would recommend getting the Atmega from tayda electronics  and getting the Atmega328p-pu. The Atmega328 is a higher power chip than the p/p-pu model so if your using that model the current from pin 9 may not be enough.

Step 4: Mounting a Flashed Atmega328

Picture of Mounting a Flashed Atmega328

This part of the instructable is for mounting a Flashed Atmega328 (the chip has been bootloaded and programmed by the Arduino). 

In this instructable the blink program is flashed on to my Atmega328p-pu.

Note: The capacitor connected between VCC to Ground isn't needed and it isn't included in the schematic. (it's a 1uF capacitor)

Step 5: Mounting Atmega328 Schematic

Picture of Mounting Atmega328 Schematic

Here is the schematic for mounting the Atmega328 onto a breadboard, in most cases if your making a project you will be mounting this onto a PCB or a prototyping board. 

The LED connected to digital pin 13 is not needed, but works as a good test to check and make sure your circuit works.

The circuitry for the RESET (pin 1) is also optional, if you dont want to include a reset button you must directly wire that pin to VCC. 

As you may notice there is no power source, this is because its optional what way you want to do it. The power to this circuit MUST be 5v. If you have a power source higher than 5v you can include a 5v voltage regulator in the circuit. (circuit example on next step).

Also in some cases if your using the analog pins you need to connect pin 21 to VCC.

The second picture is a schematic of the breadboard layout, the circuit is exactly the same. The external circuitry depends on what you have connected to the pins for your projects.

Step 6: Mounting Atmega328 Voltage Regulator

Picture of Mounting Atmega328 Voltage Regulator

Here is a circuit example of using a voltage regulator.

ONLY NEEDED if your DC source is above 5v.

You can purchase a 5v Voltage Regulator from here:
http://www.taydaelectronics.com/ic-integrated-circuits/voltage-regulators/lm7805-l7805-7805-voltage-regulator-ic-5v-1-5a.html

The C1 and C2 capacitors depend on the voltage regulator your using. The Voltage Regulator's datasheet should tell what values the capacitors need to be. These capacitors are usually around 0.5uF to 0.1uF.

Step 7:

Picture of

Here is the pin mapping for the Atmega328. (it says Atmega 168 but its also the same for Atmega328).

This picture is useful to reference if your not familiar with the pin layout of a DIP package.

Step 8: Conclusion

In most cases you will be mounting the Atmega328 onto a prototyping board and soldering it for projects. I suggest you get a 28 PIN DIP Socket for the microcontroller so it can be removed. You can purchase them here:
http://www.taydaelectronics.com/connectors-sockets/sockets/dip-sockets/28-pin-dip-ic-socket-adaptor-solder-type.html

I hope this instructable was helpful, following these processes is quite simple you just need the required parts! If you have any questions or problems feel free to ask or make suggestions!

LED Blink Test Youtube video:
http://www.youtube.com/watch?v=rGIme3vQol4&feature=youtu.be

Comments

sellena made it! (author)2016-03-03

Thank you for the project! My result is a little caos but it work!

ksnanda (author)2015-06-09

Nice instructions.

I have a TQFP package type of Atmega328p that's mounted on a PCB. The PCB also has other SMD components. How do I upload my sketch to this?

Any guidance is really appreciated.

HirenT1 (author)2014-10-11

HirenT1 (author)2014-10-11

Ultra_Saucy (author)2013-07-21

Quick question. So to actually program the atmega328p you have it in the arduino, and then you remove it for use?

perez1028 (author)Ultra_Saucy 2013-07-24

I'm not sure what you mean by program, if your talking about bootloading then no, but if your talking about flashing the atmega328 with a project (step 4-8) then yes.

The first part of this instructable is to show how to bootload a atmega328 that doesn't have an arduino bootloader installed (will not work in a Arduino). To bootload you will need 2 atmega328s one that is bootloaded and the one you want to bootload. The bootloaded atmega328 goes in the Arduino and the code given in a later step is flashed onto that atmega328. The atmega328 that needs to be bootloaded goes on the breadboard shown in step 1.

Steps 4-8 is for mounting an atmega328 that is bootloaded and a program has already been flashed to the atmega328 via the Arduino dev. board.

About This Instructable

26,782views

56favorites

License:

Bio: Computer Engineering Undergraduate
More by perez1028:Multiplexing with Arduino - Transistors    (I made it at techshop)Bootloading and Mounting Arduino Atmega328 - I made it at TechShop
Add instructable to: