USB to Serial Converter
18.432 MHz Crystal Oscillator 18pf 30ppm
22 pF Multilayer Ceramic Capacitor
16 MHz Crystal Oscillator 20 pF Through Hole
4x4 Keypad with Adhesive Backing
Quad Buffer Line Driver (Through Hole)
USB AVR Programmer
SPDT Slide Switch 3 pin 30V
Handheld Auto Ranging Digital Multimeter
There are three main DC voltage sources available to supply power for our microcontroller
projects: Batteries, wall adapters or the USB port of a computer. Generally, the
power level requirement is dictated by the requirements of the devices that you
use to build the circuit. These devices consist of the actual microcontroller and
any peripheral hardware connected to it in some way. Peripherals may be sensors
or other integrated circuit devices (ICs). So then, what do I mean by "dictated
by the requirements of the devices?" To answer that question, let's start with a
discussion of the power requirements of actual microcontroller.
Most microcontrollers can only accept voltage supplied within a specified range,
and often this voltage is the determining factor for the operating speed of the
system clock. In the case of the Atmega32 the manual states that it can receive
voltage in the range of 4.5-5.5 volts. In terms of the voltage requirements for
this device, that's not a large range. Therefore it might be somewhat difficult
to add other peripherals that use different power requirements. Generally speaking
though, the Atmega32 was made to receive 5 volts with leeway of 0.5 volts to either
side, so that's what you have to deal with in order to use this device in a circuit.
Fortunately its replacement (the Atmega324) can accept a greater voltage range.
For example, the Atmega324A can accept a voltage in the range of 1.8-5.5 volts,
with the lower portion of that range available for use in low-power circuits. The
Atmega324p has a range of 2.7-5.5 volts, which still allows the use of standard
peripherals that require either 3.3 volts or 5.5 volts.
As noted when selecting a microcontroller, you must also be conscious of the other
components that will be used in the circuit. Try to find components that will match
the voltage range of your microcontroller, so that you will not need to provide
a voltage source at two levels. For example, if you have the older Atmega32 and
you want to use an accelerometer that only accepts 3.3 volts, you will need to provide
two voltage levels; one (4.5-5.5v) for the microcontroller, and another (3.3v) for
So where do we get the power for our circuits? Fortunately, there are a few options
available to us. We can either use batteries, a wall adapter, or the USB port from
the computer. Keep in mind that if you are using a wall adapter, then its output
voltage must be in direct current. Lets investigate each potential power source
a bit further.
There are many types and sizes of batteries, each with their own voltage rating.
But to complicate matters a bit, they also have variable periods of operation in
terms of the time that they can supply a circuit at their rated output. The amp-hour
rating of a battery is a rating that indicates the amount of energy a battery can
supply over a given period of time. When considering the small capacity batteries
typically used in microcontroller circuits, we can also express this rating in terms
of milliamp-hours (mAh), which is essentially how long (in hours) the battery will
last if its current is being drawn from a load of 1 milliamps. If a battery is rated
for 1000 mAh, it can theoretically supply a circuit requiring 100 milliamps for
10 hours, or a circuit requiring 50 milliamps for 20 hours. However since small
batteries usually won't last very long when powering circuits containing a microcontroller
in continuous operation, they should probably only be used for in situations where
a power source cannot be furnished by other means. Rechargeable batteries may be
a good option in such installations however, especially when they are used in a
way that allows them to be recharged from a renewable source.
So the next question we need to consider then, since different battery types supply
different voltages, is how to get the voltage we want?. This is relatively straightforward
actually. Often all you need to do is to connect batteries together end-to-end (in
"series"), until you reach the output voltage level you need. For example, if you
are using batteries that give an output voltage of 1.5 volts each (a standard voltage
for batteries like the common household AA, AAA, C and D-cell units), you can connect
them together in series and just add the voltages from each battery. For example
if two AA batteries are used in series, then you can expect a supply of about 3
volts; although you will probably see slightly more than that if the batteries are
new. But you may be wondering--how then can we get a 5 volt supply? That's a bit
of a problem actually, as there is no good way to get 5 volts from a battery power
supply without using other components to regulate the voltage (as discussed below).
If you were to add another battery to the 3 volts from the first two, then you will
get 4.5 volts--which is too little. However if you then add another 1.5 volt battery,
you get a whopping 6 volts. Since that is outside the rated operating range of the
microcontroller, we might very well destroy it unless we can somehow "regulate"
that voltage to be in the desired range.
To briefly review, two batteries are connected together in series by connecting
the positive (+) pole of one battery to the negative (-) pole of the next. That's
These adapters are also often called "wall-warts," for obvious reasons. They are
big and bulky, and stick out like a wart! If you are using a wall adapter, then
you need to select one that has an output voltage matching the needs of the devices
in your circuit. If you will be using a voltage regulator (discussed below), then
you will need an adapter with an output voltage above that needed by your components.
All of the wall adapters that I have found or salvaged from my disposed electronics,
have the input and output information specified (printed) someplace on the case.
The input voltage for each adapter should of course match the power type in your
country. For example, here in the US the power from a wall socket is in the range
of 110-130 volts alternating current (AC). This is generally in the form of a sine
wave, where the flow of current rapidly alternates is first in one direction, and
then in the other. One other thing to look for on the wall adapter case is the output
voltage, which will also be listed. For the purpose of our needs in circuits containing
microcontrollers, the output voltage must be in the form of direct current (DC).
This is an easy way to get a relatively smooth form of 5 volts of direct current.
If your components can accept 5 volts, then this is usually a good power source.
It is quite easy to tap into this voltage--just get out one of the many USB connectors
that you probably have laying around your house, and strip the cable until you see
four wires. You want the two wires that are either red or black, as the other wires
in the cable are data lines that will not be needed for our purposes. Of the two
wires that we're interested in, the black is the ground wire (0 volts) and the red
wire is the 5 volt supply line. All you might need to do is to add a capacitor or
two to smooth out the voltage, and you'll be good to go!
As mentioned above, you may need a voltage regulator if you are using batteries,
or if you can't find a wall adapter with the correct output voltage. While there
are many regulators out there on the market, I generally use one or two of the following
models: 7085, Max 603, or Max 604.
This is a very popular "high-dropout" voltage regulator that is probably being used
in many of the electronic gadgets in your home. This regulator outputs 5 volts,
as long as the input voltage supplied to it is at least 2 volts higher than the
5 volts expected output. This 2-volt excess is called the dropout voltage. Although
the regulator can accept 7 volts input to produce 5 volts of regulated output, it
may be safer to provide a minimum of 8 volts input, in case there is a "ripple"
(inconsistency) in the input voltage. You can also use input higher voltages, but
you should not go higher than 30 volts--as the regulator will breakdown above this
This voltage regulator also outputs 5 volts for the 603 (3 volts for the 604), but
has a much lower dropout voltage. This IC device is intended for use with batteries
and the 6 volts from four "AA" batteries will allow 5 volts of output (using the
Max 603). Don't use an input voltage of more than 11.5 volts though, as the magic
blue smoke will escape with anything above that! In other words, you'll destroy
the voltage regulator. These regulators can even provide many other output voltages,
if properly configured to do so using various resistors as will be discussed in
the video for this tutorial.
You will notice in the video that I use a few capacitors. Since I've gotten a few
requests to explain this, I have made another video on the subject. In short, the
capacitors are used to smooth the "not so perfect" (pulsating) DC voltage. As you
can see in the other video, there is a capacitor used before and after the regulator.