Curiosity and the Challenge: The reasons I’ve listed
so far are all very practical — in fact, they sound a little too
practical. So, I think I need to come clean: The biggest
motivator for me to start working with microcontrollers
was a primeval desire to learn more. I wanted to know
how that Arduino board worked, and I wanted to build
one myself. I was so impressed with the Arduino and what
I was achieving, that when I saw I could build my very
own I just had to do it. And I haven’t looked back since!
Let’s Set a Course
Over this series of articles, we’ll steer a course from
the Uno to working with the raw AVR microcontroller.
We’ll tackle a number of topics that will enable you to
gain greater control (and flexibility) in your projects. The
first step is to create a stand-alone microcontroller to work
with — essentially, we’ll be building our own simplified
Uno. For this article, we’ll stick with the familiar Arduino
IDE, and save the leap to a lower-level development
environment for next month.
Build Your Own Arduino Uno
At first, I didn’t believe that I could really build my
own Uno. The Uno was a mystical blue square of genius —
how could a newbie like me create my own? It actually
turned out to be less challenging than I thought.
In tackling our simplified Uno here, we’ll include only
the most important elements: the regulated power supply
and the microcontroller itself.
The Uno has an ATmega328P-PU microcontroller
which is a popular 28-pin MCU from Atmel (see
Resources.txt). It comes with 32 KB of program memory,
2 KB of RAM, and 1 KB of EEPROM. In the world of
computers, this is unbelievably small. However, in the
world of microcontrollers, it’s a very decent size. We’ll see
as we progress that some MCUs only have 1 or 2 KB of
While we’re comparing, another big difference to PCs
is the speed. The ATmega328P has a top speed of 20
MHz — 150 times slower than a common computer. For
microcontrollers, this is a reasonable speed and, in fact,
you’ll often intentionally slow it down further.
Most microcontrollers need a few simple supporting
components to work and the ATmega328P is no different,
so we’ll include these in the build. The cost?
ATmega328P’s are readily available from most online
electronics stores for less than $4.
Power to the MCU
Microcontrollers are fussy about how they’re
powered. They need to be fed a constant clean voltage —
any ripples, spikes, or variations in the voltages upset their
internal workings and could cause them to behave
unpredictably. The 5V that an off-the-shelf AC/DC
converter (commonly called a wall wart) provides is
generally not clean enough for the MCU — and is often
not as close to 5V as we’d like. We therefore need to
include a regulated power supply on our breadboard.
The ATmega328P can run on a wide range of voltage
— from 1.8V up to 5.5V — but we’ll stick with the 5V that
the Uno runs on.
Less Talk, More Action
Let’s get going on the build! Check out the schematic
in Figure 4.
We’re going to start with the power supply first so we
have power to test the rest of the board as we build it. I
wedged the power supply out of the way on one end of
the breadboard, so I had loads of space left to connect
other components at a later stage.
The mainstay of the power supply is a voltage
regulator. There are a wide range available with different
characteristics, but for this project I chose a simple L7805
linear regulator. It’s not the most power efficient, but for
prototyping it works perfectly (refer to the sidebar).
In addition to the voltage regulator, we need a couple
of capacitors to help keep the voltage stable — think of a
March 2015 39
There are a range of voltage regulators available which can
simplistically be divided into switching and linear regulators. We'll
work with linear regulators as they are easier to use and need
simpler supporting circuitry. When choosing a voltage regulator, the
main parameters to normally look at are the dropout voltage, input
voltage range, output voltage, and the maximum current.
Dropout Voltage: This shows how much of the input voltage is
"lost" within the regulator. It is an important number to look at when
considering the voltage that is fed into the regulator. A 5V regulator
with 2V dropout voltage needs an input of at least 7V in order to
achieve the 5V output. A class of regulators called low-dropout
regulators have a lower dropout voltage, meaning firstly that they
don't need such a high input voltage, and secondly that they're more
Input Voltage Range: I normally look at how I'll be powering my
project, and then what input range my regulator needs to be able to
handle. I'll try to use a voltage source as close to the output voltage
as possible (taking dropout voltage into account, of course).
Output Voltage: This is a pretty obvious parameter to look at, but
one does need to make a choice whether to go with a fixed voltage
or a variable voltage regulator. For our purposes, a fixed 5V regulator
does the trick and is simpler to use.
Maximum Current: This is an important number to look at, as
regulators can range from as low 20 mA (current that low is not
useful for our project). The ATmega328P can supply a maximum of 20
mA per pin (with certain overall limits), so a regulator with a
maximum output over 800 mA is more than sufficient. If you want to
power other components off your regulator, then it may make sense
to get a slightly higher current regulator.