Hello everyone,
In this post I’m going to show you how to use a Atmega328p-PU as standalone i.e. without using any development board like Arduino. In fact in very similar way you can also use other micro controllers.
To flash custom hex files to a microcontroller, at very first the microcontroller must have bootloader installed. If you bough a spare microcontroller like Atmega328P-PU and it did not came with any bootloader pre-installed, then you can use your Arduino (with pre-installed bootloader) to load bootloader into the blank chip. You can also program your standalone microcontroller chip using Arduino without using any extra Programmer.
Points I will cover
- How to use Atmega328P-PU μC without any development board like Arduino
- How to install bootloader on a blank Atmega328P-PU using Arduino Uno
- How to program Atmega328P-PU using Arduino Uno and without using any AVR Programmer
What you need
- Arduino Uno with bootloader installed
- Atmega328P-PU with/without bootloader
- Breadboard
- 10 kΩ resistor x 1
- 220 Ω resistor x 1
- Green 0.5MM LED (you may use any color) x 1
- 16 Mhz Crystal Oscillator x 1
- 22 pF capacitors x 2
- Momentary tactile push button x 1
- Some jumper wires
1. How to use Atmega328P-PU μC without any development board like Arduino
Simply implement this schematic on a breadboard and you gets your standalone Atmega328P-PU ready with minimal components.
Your implementation will be looking like this.
2. How to install bootloader on a blank Atmega328P-PU using Arduino Uno
Remove all the wires and extra components (if any connected) from the Arduino Uno and follow the steps below.
- Step 1: Install Arduino IDE on your computer.
- Step 2: Go to Tools menu -> Port -> choose appropriate port.
- Step 3: Go to Tools menu -> Board -> choose Arduino/Genuino Uno.
- Step 4: Go to Files menu -> Examples -> choose ArduinoISP sketch.
- Step 5: Go to Sketch menu -> Click on Upload.
- Step 6: Make the following connections using jumper wires.
- Connect pin-1 (RST) of breadboard μC to pin-10 on Arduino.
- Connect pin-17 of breadboard μC to pin-11 on Arduino.
- Connect pin-18 of breadboard μC to pin-12 on Arduino.
- Connect pin-19 of breadboard μC to pin-13 on Arduino.
- Connect VCC of breadboard to 5V on Arduino.
- Connect GND of breadboard to GND on Arduino.
- Step 7: Go to Tools menu -> Programmer -> choose Arduino as ISP.
- Step 8: Go to Tools menu -> Click on Burn Bootloader.
Now, bootloader is installed on your Atmega328P-PU and you can use it without any development board.
3. How to program Atmega328P-PU using Arduino Uno and without using any AVR Programmer
- Step 1: Open or create any sketch in Arduino IDE.
- Step 2: Go to Sketch menu -> Click on Upload Using Programmer.
- Step 3: Remove all the connection that were made on Step 6 of above steps to install bootloader.
Congratulations!!! You have just installed a bootloader on a blank Atmega328P-PU and you have also flashed it with your own sketch just using an Arduino Uno without using any AVR Programmer or USB to Serial board.
References
- http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf
- https://store.arduino.cc/usa/arduino-uno-rev3
- https://easyeda.com/arp14/Standalone-Atmega328P-PU
- https://www.instructables.com/id/Stand-Alone-Arduino-ATmega328p/
- http://blog.biophysengr.net/2012/06/writing-sketches-to-atmega386p-pre.html
If you have any query or suggestion, please comment below.
Thank you very much.