Scotty, We Need More Power!
By Michael Parks, Mouser Electronics
In almost every episode of the classic science fiction television show “Star Trek”, regardless of the impending disaster, the day would always be saved when Captain
Kirk called down to Chief Engineer Scotty and demanded more power! The circuits aboard the fictional U.S.S.
Enterprise must be very robust to handle rapid spikes in electrical current to provide that power, assuming of
course it is electrons that power the 23rd-century starship. For engineers and makers still stuck in the
21st-century, there is no doubt that electrons power the circuits in our embedded electronics projects. One cannot
just assume that their chosen embedded platform can source or sink the current needed to make everything work. Good
design, picking the right space components, and carefully
reading the datasheets are required to ensure your project works reliably and safely.
Figure 1: Source: http://www.belfasttelegraph.co.uk/
Let’s look at two design considerations when building your next embedded project.
- What you need to do when a certain component needs more current than your microcontroller’s GPIO pins can
source?
- How do you protect your microcontroller when interfacing with an inductive load such as a stepper motor?
Driving Large Loads
Many microcontrollers' GPIO pins can source very little current, in the neighborhood of 40mA give or take
(datasheets are an engineer’s best friend). Be sure to read the datasheet of your particular MCU. In certain
applications this is enough current, but sometimes you will need more current than your microcontroller’s GPIO pins
can source. One example is driving infrared
LEDs that need to be seen over large distances or interfacing with larger motors. Therefore, you may need to
tap into an external power source that can safely source the current required. One simple way to do this is to use a
PNP transistor (A PN2222 is a good part to try first and a few
current limiting resistors. The GPIO pin will now simply drive the base junction of the NPN transistor, which will
in turn allow a larger current from the external source to flow from collector to emitter and drive your load. Just
remember that you must connect the grounds of your microcontroller and the external power supply. Also be sure to
select a base resistor value that drives the transistor into saturation.

Figure 2: Using a NPN transistor to allow a microcontroller
to handle larger current requirements.
Protecting Against Inductive “Blowback” Voltage
Inductive loads, such as stepper motors , can present a
nasty little side effect due to the physics of current passing through an inductor. On principle, an electrical
generator and an electrical motor work on the same concept of electromagnetics, though in reverse from one another.
So imagine you have a motor running and suddenly you cut power to it. Inside the coil energy was being stored in an
electromagnetic field and now that fielding is collapsing. The inductor, faced with this collapsing field, wants to
keep the current flowing, which induces a huge voltage spike. This voltage can be several hundred volts, even in low
power applications. Because this voltage forms across the coil in the opposite direction of the voltage you applied
to run the motor, (thus the term “blowback”
voltage if it is handled improperly, the induced voltage can potentially destroy the GPIO pin circuitry or
even your entire microcontroller. Blowback voltage is also sometimes called back electromotive force, or back EMF
for short.
Enter the “flyback” diode, a fast switching protective diode (a 1N4001 is a decent choice) that is placed across the coil so as to be reverse-biased during
normal use. Then when the motor is switched off, the flyback diode allows the blow voltage to safely deliver its
current through the resistance of the coil, preventing damage to more sensitive electronics. For additional safety,
you can insert an optocoupler chip in between your GPIO pin and the transistor to electrically isolate your
microcontroller (4N35 is a solid choice).
Figure 3: Use of a "flyback" diode to prevent blowback
voltage from an inductive load.
To make things very easy when interfacing with motors, you can also use chips such as the L293D H-Bridge motor drivers to drive your motor that include the
protective diodes inside the chip. Be sure to order a L293D and not the L293, which lacks the protective diodes.
Michael Parks, P.E. is the owner of Green
Shoe Garage, a custom electronics design studio and technology consultancy located in Southern Maryland. He produces
the S.T.E.A.M. Power Podcast to help raise public awareness of technical and scientific matters. Michael is also a
licensed Professional Engineer in the state of Maryland and holds a Master’s degree in systems engineering from
Johns Hopkins University.