tonilopezmr / tonilopezmr.github.io

My web portfolio.
https://tonilopezmr-github-io.vercel.app
Other
4 stars 1 forks source link

Atmega328 microcontroller #32

Open tonilopezmr opened 5 years ago

tonilopezmr commented 5 years ago

This microcontroller it is used by Arduino and we can load programs into the microcontroller using the Arduino board connected with USB to the computer and using the Arduino IDE to code the atmega328 programs.

Schematic

image

Atmega328 it has an internal 8Mhz clock, it needs a 10k resistance between Vcc and pin 1. In the pins 9 and 10 you need to add a 16Mhz crystal quartz clock with two 22pF ceramic capacitors connected to Gnd, this is the connection on the breadboard.

image The led it's optional

AREF which means Analog reference it's the reference used for the analog input pins and the AREF will be the top of the input range.

Program Bootloader

For load programs into an Atmega328 you need to add first the bootloader, then you will need an Arduino which has the Programmer code to load the bootloader into an Atmega328 microcontroller connecting it to the Arduino board. Thanks to Nick Gammon here is a custom programs to put into the Atmega328 using Arduino IDE.

First, add the programmer program to the arduino board. You need to go to his GitHub account and go into Atmega_Board_Programmer then open the Atmega_Board_Programmer.ino with the Arduino IDE and run it into the Arduino.

Once you have the programmer code into the Arduino board you need to connect the Arduino board to the Atmega328 you want to add the bootloader like this picture:

image

Then you can go to the Arduino monitor and change the baud configuration to 1152000 then you will se the instructions to load the bootloader, (press U for 16Mhz then G to run the bootloader and if you want to load more bootloaders into another atmega328 then press C to repeat the process)

References

Make Your Own Arduino Board | Atmega168/328 IC How To Make Your Own Arduino Board at Home! Nick Gammon resources Best way to burn arduino bootloaders tutorial How to burn bootloader into Arduino micro From Arduino to a Microcontroller on a Breadboard