powering your microcontroller’s base project
TRANSCRIPT
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 1/9
Home About Copyright and Disclaimer e-Books Contact Us
Blog Entry
Powering Your Microcontroller’s Base ProjectFebruary 28, 2009 by rwb, under Electronics.
A good power supply is an essential subject to the microcontroller’s base project; it’s like a heart that gives a
life to our microcontroller. Sometimes we take it for granted the important of having an adequate powersupply to our microcontroller project and this can lead to the unexpected result or behavior from the circuit.
In this tutorial we will learn the principal of powering our microcontroller and how we could provide the
microcontroller circuit with a good and yet simple power supply.
I Need More Power
“Mr. Scotty, I Need More Power” one of the famous phrase in the Star Trek movie; as the captain of the
starship USS Enterprise want to increase the starship wrap speed. The same principal also applies to our
microcontroller when we drive the microcontroller with higher clock speed in order to increase the execution
time speed, we certainly need more power. Therefore we have to consider wisely and balancing between the
speed and the power consumption. The following graph is the example of some popular microcontrollers with
their operating voltage and frequency (for detail please refer to their respectively datasheet).
From the above graph, we should always select the save operating area when we powering our
microcontroller, for example using 4.5 Volt will be the safest operating voltage for all of the operating
frequency range allowed by the microcontroller or when we use the clock speed up to 10 Mhz than a 3 volt
power source will satisfied for all microcontroller’s types listed above.
Next to the voltage is the amount of current needed to make the microcontroller to work properly. Nowadays
most modern microcontroller only needs a tiny direct current (in micro ampere order) to operate as
introduced by Microchip with their nanoWatt PIC microcontroller families or Atmel with their pico-technology
AVR microcontroller families. This type of microcontrollers makes them suitable for used as the portable
devices in the remote area where the power is limited to the portable power source such as battery or the
solar cell.
One of the important things to be considered when designing your microcontroller’s base project is the
maximum direct current (DC) allowed to pass through the microcontroller’s Vcc to Gnd pins; by looking at
the microcontroller’s electrical specification on the datasheet this DC maximum current is typically around
90mA to 200mA; remember this is the maximum value; which mean when we reach this value the
microcontroller will likely become permanently damage.
This maximum current is the sum of the microcontroller operating current and the entire load we put
together on the microcontroller’s ports I/O. The following is the pictures of typical load connection to the
microcontroller’s port I/O (the electrical specification is taken from Microchip PIC16F886 and Atmel AVR
ATMega168P datasheet).
Custom Search
Search This Site
Future Post
Controlling the Motor is one of
interesting topics in the embedded
world especially for the robotics
enthusiasts, on the next post we will
learn the basic of motor electronic
circuit as well as how to control it withmicrocontroller.
Therefore don't miss it, stay tune on
this blog !
Subscribe
Posts | Comments
Recommended Books
Feature Product
PICJazz 20PIN Board
Categories
Blogroll
ermicro shop
ermicroblog Amazon Store
ermicroblog on YouTube
ermicroblog video on Metacafe
Archives
ermicroblogMicrocontrollers and Electronics Project Blog
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 2/9
You should always refer to the Microcontroller electrical specification datasheet when you start to connect
devices to the I/O ports as it varies among the microcontroller’s types. I would like to show you some
example; you would easily found in the microcontroller’s project schematic where people will hookup a bunch
of LEDs to the microcontroller’s I/O ports as the following picture:
When the microcontroller ports are use as the current source to the 8 LEDs than the total current pass
through the Vcc to Gnd pins could be calculated as follow:
Itotal = I operating current + (8 x I LED)
Let’s say the resistor value is 330 Ohm, and assuming the LED operating voltage is 2 Volt and the
microcontroller port logical high voltage output is 5 Volt; then the port current to the LED could be calculated
as follow:
I LED = V / R = (5 – 2) / 330 = 0.0091 A = 9.1 mA
If we ignore the microcontroller operating current (because is less than 1 mA) than the total current pass
through the Vcc to Gnd pins could be found as follow:
I total = 8 x I LED = 8 x 9.1 mA = 72.7 mA
As you see from the result; the value is already close to the maximum current allowed by the PIC 16F886
microcontroller’s electrical specification or almost a half of the maximum current allowed by ATMega168P
microcontroller’s electrical specification; now let’s say you want to impress your friends by adding additional
8 LEDs to the other microcontroller’s ports I/O to make a nice chaser LEDs display; than the maximum
current will be easily exceeded.
Therefore is a good practice to run your microcontroller at the half of the maximum current allowed by its
electrical specification and make sure you are sourcing or sinking the microcontroller’s ports within its
electrical specification.
By knowing your microcontroller voltage, operating current and summing all the total current needed by the
other supporting peripheral on the project such as LEDs, Motors, Relay, LCD, etc; now we could determine
the right power supply to the project.
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 3/9
The Battery Power
All the microcontroller circuit needs a direct current (DC) in order to operate and the perfect source for this
current type is a battery. Today modern battery is evolve to be more compact yet more powerful to provide
the power required by the sophisticated gadget such as cell phone, iPod, MP3 player, PDA, camera, etc.
The best widely available battery for the microcontroller project is the AA type battery which available both in
NiMH (Nickel Metal Hydride) rechargeable and Alkaline type; I always recommend this type of power source
especially when you are doing your first microcontroller project. By using 3 AA alkaline batteries or 4 AA
NiMH batteries in series, you will have 4.5 volt or 4.8 volt correspondingly which makes it the perfect power
source for your microcontroller’s project; and if you operate your microcontroller below 10 Mhz, then you
could easily use 2 AA Alkaline batteries in series that will give you 3 Volt power source for your
microcontroller’s project.
You could also experiment with various battery types such as the 3 Volt CR2 lithium used for powering the
photo camera or 3.7 Volt cell phone batteries for powering your project.
The AC to DC Converter
For more permanent microcontroller’s base project circuit; the electricity is the cheapest power source
compared to the battery, but of course we could not use it d irectly as the electricity is designed to be
distributed far away from the power plant; therefore it use the alternating current (AC) and higher voltage
(220 Volt or 110 Volt) in order to be efficient. Most of electronics devices use the direct current (DC) and
lower voltage level to operate; consequently we have to convert AC to DC and the voltage level as well. The
following picture is the typical AC to DC converter circuit:
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 4/9
Before continuing, I would like to remain you about working directly with the electricity, that you should
always take extra precaution and extremely aware to the danger of the electrical shock. From the AC to DC
converter circuit; the transformer is used to step down the voltage level from 220/110 Volt AC to 9 Volt AC,
the diode D1, D2, D3 and D4 work as the AC to DC converter or known as a rectifier; the capacitor is used to
filter the AC component (ripple) from the DC component. The LED and the 1 K current limiter resistor is use
as the power indicator as well as the discharge circuit to the capacitor when we unplugged this circuit from
the electricity power outlet.
From the time diagram above we could learn how this AC to DC converter circuit work; the AC wave form is a
50 Hz sinusoidal wave form and the AC voltage value is always presented in its effective value which is
equivalent to the DC value or we could say that the AC effective voltage value will give the same amount of
energy as the DC voltage value does. The maximum voltage of the AC wave could be calculated as follow:
Vmax = 1.414 x Veff
For the 9 Volt AC effective voltages; than the AC maximum voltage could be calculated as follow:
Vmax = 1.414 x Veff = 1.414 x 9 Volt = 12.73 Volt
On the first-half cycle (red color), the D2 and D4 diode will be on (forward bias) while the D3 and D1 diodes
will be off (reverse bias), this will charge the capacitor and when the AC wave is falling down then the
capacitor will discharge its energy through the load; on the second-half cycle (blue color), the D3 and D1
diode will be on (forward bias) while the D2 and D4 diodes will be off (reverse bias), again this will charge
the capacitor and when the AC wave is falling down, the capacitor will discharge its energy through the load.
This cycle will continue repeating every 100 Hz (twice the AC frequency) and the result we have the DC
output where its voltage value will almost equal to the AC maximum voltage value minus the diode forward
bias voltages. Assuming the diode forward bias voltage is about 0.7 Volt then the DC voltage output value
could be calculated as follow:
V = Vmax – 1.4 Volt = 12.73 – 1.4 = 11.33 Volt
Today is not practical to build this circuit anymore as this kind of circuit is widely available on the market and
usually called as the DC wall adaptor, so it is cheaper to buy it unless you have special requirement such as
you need bigger current or multiple voltage output level at the same time; but for average microcontroller’s
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 5/9
base project the 7.5 volt to 9 volt with 500 mA to 1 A rated DC wall adapter will be adequate.
The Voltage Regulator
As you notice from the AC to DC converter circuit, the DC voltage produce by this circuit is depend on the
load; the heavier the load (more current to the load) means the capacitor discharge time will be more faster
and as a result the DC voltage output level will be drop. The circuit above is called unregulated AC to DC
converter; because it could not maintain its voltage output level, this kind of power source could not be use
in electronic circuit that required constant voltage level in order to operate properly such as in digital and
microcontroller circuit. Therefore we need what is called Voltage Regulator Circuit and at the same time
works as the DC to DC voltage step down.
There are two typical types of close loop feedback voltage regulator widely used today:
The first one is the analog voltage regulator, this type of regulator operate the transistor in its linear region
(current gainer). The current supplied to the transistor base lead is depend on the voltage different between
the reference voltage and output voltage apply to the error amplifier input; for example when the output
voltage is greater than the reference voltage, than the error amplifier will make the transistor to conduct
less, this mean the voltage drop across the collector and emitter (Vce) will be increase this will make the
output voltage to decrease and vice verse. With output voltage being continuously compared to the reference
voltage (close loop feedback) by the error amplifier, this kind of circuit could maintain its voltage output level
constantly. The disadvantage of using this type of voltage regulator is the power dissipation (power lost as a
heat) on the transistor is high especially when we want to use 5 Volt output from 11.33 volt from the
unregulated DC source or drain lot of current from it.
The second one is the most efficient voltage regulator as this type of voltage regulator operates the
transistor in its saturate region or known as a switching voltage regulator. The working principal is the same
as the analog one, but instead of using the constant current to the transistor base lead; this voltage
regulator type use pulse current or known as PWM (Pulse Width Modulation) to the transistor base lead and
this make the transistor to turn on and off according to the PWM duty cycle supplied by the error amplifier.
Therefore by changing the PWM duty cycle we could change the average voltage drop across the collector
and emitter (Vce). The inductor (L) is used to release its energy to the load through the diode (D) when the
transistor is turn off; and when the transistor is turn on then the transistor will supply the current to the load
and the inductor will store the energy in the electromagnetic form; in other word the inductor and diode will
ensure that the load will always get a constant current when the transistor is turn off.
Now as we understand the basic of how this voltage regulator work, its time to make our own voltage
regulator. Today there are plenty choices of the voltage regulator IC on the market and we will just explore
some of them.
5 Volt Analog Voltage Regulator
The classic, widely available and the most popular one is the LM7805 or 7805 IC series, almost every
microcontroller’s base project schematic use this IC, although it’s not very efficient in term of power
dissipation but its cheap and widely available than we still consider it as our choice; but if you have more
budget you could consider to replace it with the low dropout 5 volt regulator IC such as LM 2940, below is
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 6/9
the LM 7805 and LM 2940 schematic.
Below is the picture showing the LM 2940 IC circuit is use to power to the microcontroller’s board.
For the 3.3 volt low dropout voltage regulator you could use the LM 3940
5 Volt Switching Voltage Regulator
This is my favorite voltage regulator, although it’s required more component compare to the analog one and
of course more expensive but the result is worthy. The LM 2576-5V is the 5 Volt switching regulator and it’s
also available in 3.3 Volt, the following is the schematic of this switching voltage regulator:
The bridge is use to ensure the correct polarity supplied to the LM 2576 IC, below is the JazzMate 2576-5V
board from the ermicro powering the microcontroller board.
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 7/9
The other advantage of using the switching voltage regulator, that it’s more immune to the noise compare to
the analog one especially when you control the device that generate noise such as DC motor with the
microcontroller.
Adjustable Voltage Regulator
The LM317 is the classic and widely available adjustable voltage regulator which is suitable especially for the
experimenter where we need to change the voltage output regularly for example to test the brown out
voltage level of the microcontroller. The basic schematic of this regulator is shown on this following picture.
The output voltage value could be calculated using this following formula:
Vout = 1.25 x (1 + (R5/R4)) + (Iadj x R5)
Ignoring the adjustment current (Iadj, is about 100uA) then the maximum voltage output from the above
schema could be calculated as follow:
Vout = 1.25 x (1 + R5/R4) = 1.25 (1 + 10/3.3) = 5.03 Volt
The following picture shows the LM 317 IC circuit powering the microcontroller’s board.
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 8/9
DC to DC Step-Up Regulator
The Maxim MAX756 is the sample of easy to use DC to DC step-up switching regulator; this chip is used toincrease the typically low input DC voltage 1.1 volt – 1.8 volt to the output DC voltage of 3.3 Volt or 5 Volt at
maximum 200mA load (300mA on 3.3 Volt output). This means you could easily power your microcontroller
project using just a single AA/AAA battery. This kind of step-up power is widely use on digital and
microcontroller circuit that powered by low input voltage battery such as micro alkaline 1.5 volt battery. The
basic schematic for 5 volt output from 1.5 volt battery is shown on this following picture:
The output voltage of Maxim MAX756 could be selected from 5 volt or 3.3 volt by putting logical low or high
on pin 2 (3/5), it also supply the low output indicator detector to the circuit if needed through the pin 4
(LBO). The following picture shows the Maxim MAX756 IC circuit powering the microcontroller’s board using
just 1 AA alkaline battery (1.5 Volt).
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820
9 20/02/2014 11:36
8/12/2019 Powering Your Microcontroller’s Base Project
http://slidepdf.com/reader/full/powering-your-microcontrollers-base-project 9/9
21.02.11 #1
21.02.11 #2
10.08.11 #3
10.08.11 #4
The Final Thought
You should always be aware of the power dissipation (power lost as heat) when you are working with the
analog voltage regulator; therefore it would be wise to put the heat sink to the IC especially when you drain
lot of current from it. Also another consideration; it would be better to separate the power circuit (voltage
regulator) from your microcontroller board as it will be more flexible for you to use many type of the power
source.
Bookmarks and Share
Related Posts
Some Cool Electronics Stuff from Your Discarded DVD Player
Diode for reducing the voltage output
Introduction to the Embedded System with PICAXE Microcontroller
Make Your Own Arduino Shield Cradle
PICJazz 20PIN Learning and Development Board
4 Responses to “Powering Your Microcontroller’s Base Project”
Comment by zdk_user.
Congratulations on your very informative article!
Do you think it is possible to get a symmetrical +-5V supply
from 2 AA batteries and a couple of MAX756 ? If not, what
would you recommend ?
Many thanks in advance!
Comment by rwb.
Thank you. You could get more information about how to make
the symmetrical step-up DC to DC converter on Maxim
Application Notes AN1213 (used MAX5026) and the Linear
Technology LT1615 DC/DC Converter datasheet.
Comment by benyjogja.
Nice project.really nice.
great article.
I want to ask you if I use this source using MAX756 for Mini LineFollower Robot and driving a motor?May we use heatsink for
remove heat dissipation? Or you’re not recommend it(use
Max756)?thanks a lot.
Comment by rwb.
Remember the MAX756 maximum current on 5 volt is less than
200mA and on 3 volt is less than 300mA. Yes you could always
use heat-sink to reduce the heat.
Leave a Comment
You must be logged in to post a comment.
Copyright © 2008-2014 By ermicro. Powered by Word Press.
wering Your Microcontroller’s Base Project | ermicroblog http://www.ermicro.com/blog/?p=820