How to remove the 'Arduino' from your Arduino project
In this tutorial, we are going to build a 'stand-alone' circuit that will allow you to run your Arduino code without an actual Arduino board.
The term Arduino actually refers to a system of components that include the board, the microcontroller, the boot-loader ,and the programming environment. It is a system designed to 'protect' the user from a lot of the complication that is part of microcontroller programming.
At the heart of the Arduino board is a microcontroller called the ATMEGA328P. The Arduino board acts like a space suit for the ATMEGA, providing life support and doing its best to protect the chip from damage.
At the end of the day, the Arduino is a development board. While you can make the Ardino a permanent part of you project, once you have finished with the development phase of your design, it is often cleaner and less expensive to replace it with a stand alone ATMEGA microcontroller circuit. This is what we are going to build.
The Arduino board has built in power regulation circuitry that provides a steady 5 Volts to the ATMEGA328P. But, since the Arduino is going bye-bye, we have to build our own power supply circuit. We also need to provide a clock source for the microcontroller. The 16Mhz crystal and 22pF capacitors take care of that.
1 - 9v DC Power Adapter - 500ma or greater (Wall Wart)
1 - DC Power Socket (2.1mm or sized to fit the plug of your power adapter)
1 - LM7805 - 5 Volt regulator
1 - 1N4001 - rectifier diode
1 - 100uF (Micro-Farad) electrolytic capacitor - rated at 25v or more
1 - 10uF (Micro-Farad) electrolytic capacitor - rated at 25v or more
2 - 22pF ceramic capacitors
1 - ATMEGA328P microcontroller
1 - 16 Mhz crystal
Hook-up wire (22 Gauge - Solid)
1 - SPST Switch
1 - 220 ohm resistor
1 - LED
How it works
First take a look at the schematic.
Let's look at what this circuit is doing. The 9 volt power from your adapter is being fed to a 1N4001 diode. This diode will only allow current to pass in one direction so if the adapter is connected backwards, the circuit will be protected. The 7805 regulator then drops the voltage down to 5 volts and holds it there. The 10uF and 100uF smooth out any ripples in the 5 volt supply.
This steady 5 volt power is supplied to the ATMEGA328P chip. The 16Mhz crystal and 22pf capacitors supply a steady clock signal to the microcontroller. Finally, in 10K resistor holds the microcontrollers 'reset' pin high, so the chip will run it's program. It's a very simple circuit.
Choose your Power
A couple of notes about choosing a DC Power adapter. This circuit will accept a variety of power adapters, but 9 volts is a good choice. You could go a little higher but the extra voltage will just be wasted as heat from the 7805 regulator. You may need to add a Heat-Sink if you go too high. If you go lower than 9v you may find the regulator may have difficulty putting out it's full 5 volts.
Also check the current rating of the adapter. I am using a 500mA unit. This is a fair choice as it is the same rating as the USB port that was probably powering your Arduino not long ago. If your project is larger, you may want to go with a 1 amp unit.
Finnaly, check the polarity of your adapter. Most adapters have a symbol printed on the label that shows the polarity of the tip and sleeve of it's power plug. You can see the symbol in the photo below. This one is showing that the sleeve of the plug is positive. You can use either type, just make sure you wire up your jack accordingly.
This video provides a step-by-step guide to circuit construction.
You should now have a funtional ATMEGA chip on your breadboard happily running your Arduino program.
In the next tutorial, we are going to look at programming the microcontroller directly on the board. See you then.