We all have a deep fondness to our Arduino with its familiar shades of blue/green, but the time has come to explore other project options. One that involve fewer pieces, fewer parts, and fewer dollars. Building a standalone Atmega328 is far simpler than you might have imagined and can open up a wide range of of new project possibilities.
The shopping list contains parts that are entirely plug and play. No configuration or setup needed! These parts are from Sparkfun using their parts #, but are widely available from other electronic websites.
|1x Atmega328 DEV-10524 – make sure that it has the boot-loader on it. You can put it on, but this one has it and it makes everything far simpler.|
|1x 28 Pin DIP socket PRT-07942 – helpful for reprogramming the chip so that you don’t have to de-solder it every time you need to make a change (breadboard friendly).|
|Various hookup wire and a breadboard with a channel running down the middle. Also a battery pack preferably 9-12V with leads.|
|Power (3 options):|
|A) 1x 5v Voltage Regulator COM-00107 – The Atmega328 needs a regulated voltage to run and 5v is well within its operating range. You will need a 9V+ power supply for the voltage regulator 2x Electrolytic Decoupling Capacitors COM-00523.||B) 4x AA NiMH Batteries PRT00335- They are each 1.2V so *4=4.8V, safely with the Atmega328’s operating range. Also helpful is the fact that they will give you around 2500mAh versus ˜800mAh from a 9v Battery.|
|Clock (2 options):|
|A) 1x 16mHz Ceramic Resonator COM-09420 – No fuss or extra parts. The middle leg goes to ground and the other 2 legs go to Pin 9 and 10.||B) 1x 16Mhz Ceramic Crystal COM-00536 – Used on the Arduino Uno, but requires 2x 22pF Ceramic Capacitors COM-08571|
After the parts arrive we can finally get started! Plug the Atmega328 into the DIP socket and place it onto the breadboard so that the 2 rows of legs are running the length of the breadboard and are separated by the channel. Next for the 5v power supply. If you are using the 4x NiMH batteries then just plug 5v into pins 7,20,21, and 1 (with a 10K Ohm resistor for pin 1). Then ground coming out of pins 8 and 22. We will hold off on pins 9 and 10 for the moment.
If you chose option A then the power pins will be the same, but the method of sending them power will be different(see schematic below). Somewhere separately on the breadboard place the 5v voltage regulator. Put the input voltage on the left most pin, GND is the middle and shared by both sides. Then the 5v output comes out the right side.
Before the voltage regulator also place 1x Electrolytic Decoupling Capacitor with the stripe facing GND and another on the opposite side of the voltage regulator connecting 5V and GND with the stripe also facing GND. At this point you can test to see whether power is flowing smoothly through by connecting an LED and resistor to the 5v and GND.
Hopefully the LED lit up and everything is working perfectly. Now for the last 2 finishing touches before uploading a program.
1. The clock:
A) Connect the two outside legs of the resonator to pins 9 and 10, it doesn’t matter if the left one goes to pin 9 or 10 and the same for the right one. Connect the middle pin to GND.
B) Connect the crystal legs to 9 and 10, again it doesn’t matter which one goes where. Next on the other side of the crystal connect a 22pF capacitor connecting to GND so that the flow of electricity would be Pin9/10>A leg of crystal>Capacitor>GND.
And you are done! Upload the blink sketch to your Atmega328 by placing it into your Ardiuno then upload, plug it back in to the DIP socket and watch the LED flicker on and off.