You are on page 1of 13

let's make Explore (/tag/type­id/) Publish (/about/create.

jsp)

Classes (/classes/)
Featured: share what you make (/halloween/)   (/halloween/)  (/id/intel/) Intel IoT (/id/intel/)
(/)
 (/tag/type­id/category­technology/channel­leds/) LEDs (/tag/type­id/category­technology/channel­leds/)

 (/tag/type­id/category­costumes/) Costumes (/tag/type­id/category­costumes/)

NAC Global Electronic
Component Design
Services &

Semi Distribution
Company.

Build Your Own Battery Power Supply  by
Lucas Reed (/member/Lucas+Reed/) in electronics (/tag/type­id/category­technology/channel­electronics/)

 Download h (/id/Build­Your­Own­Battery­Power­Supply/) 7 Steps .


  Collection   I Made it!  Favorite   Share  

(/file/FTZHW7QIPZPGFQ9/)

Have you ever needed to power a project that's not near an outlet? Have you
needed to test using different voltages? Are you curious about analog circuits
and power? Using Autodesk Circuits and a lead­acid battery, you can create a
circuit that will act as a variable power supply, outputting a range of voltages
from 5V to 20V.

After creating the power supply you could drive motors using variable voltage,
power microcontrollers, logic circuits, LED strings, analog circuits, and much
more.

This is a good way to learn how basic electronic components can be put
About This Instructable
together, like a puzzle, to accomplish a task. It will also leave you with an
awesome mobile power supply to test your projects with!
8 22,721 views License:

 392 favorites
Lucas Reed
(/member/Lucas+Reed/)
Follow 85

(/member/Lucas+Reed/)
More by Lucas Reed:

  (/id/Make­an­

Step 1: MOSFET Basics
Optical­Disk­Display/)  

(/id/Simple­and­Fun­Proximity­Alarm/)

  (/id/Laser­Painting­

With­Motion­Control­and­Arduino/)
(/file/FZEYDTOIPYA4EVT/)

MOSFETS are incredibly useful devices that are used in everything from basic
electronic projects to your computer's CPU! MOSFET is short for Metal Oxide
Field Effect Transistor. They can be used in logic circuits (binary circuits: high or
low, 1 or 0, 5V or 0V), amplifiers, as switches and more. There are equations
that dictate how the transistor acts but we will focus on using a MOSFET as a
switch.
MOSFETS have three pins: gate, drain, and source (check your device for the
pin­out, the pin arrangement). When a voltage is applied to the gate pin, current
will begin to flow through the source and gate. The gate voltage required to
allow current to flow is called the 'threshold voltage'. This value is specified by
the datasheet of the 'FET. If you apply a voltage less than the threshold voltage,
the 'FET will be in 'cutoff mode' and no current will flow. Apply enough voltage
and the MOSFET will enter saturation mode, allowing current to flow. This
behavior allows us to use a MOSFET as a switch. You can use an Arduino (or
another voltage source) to apply a voltage to the gate of a MOSFET, thereby
'turning on' the device and allowing current to flow, just like you would control a
light switch.

MOSFETs come in two varieties: N­MOS and P­MOS, which stands for n
channel MOSFET and p channel MOSFET respectively. The n and p dictate the
material that makes up that type of 'FET (this goes into semi­conductor physics).
N­MOS: Current flows from drain to source
P­MOS: Current flows from source to drain
The simulation below uses a N­MOS as a switch to light up an LED. The
function generator turns the MOSFET on and off. Vary the frequency to change
how fast the LED. Vary the amplitude. This controls how 'open' the MOSFET is.
It changes how much current we allow to flow. When does it cut off completely?

View on Autodesk Circuits

Start Simulation Code Editor

FUNC1
P1 T1 R1 D1
Function

Finishing

­ +

MOSFETs tend to get hot while running (especially if using high current), so
make sure to not touch the device while it's running. Be careful to not exceed
the voltage or current capabilities of the device, it will release the magic smoke
(aka it will break).

ADVERTISEMENT
Get Free 10pcs Prototype PCB
Free prototype PCB
—2­4 days shipping,
Register now!
$10 coupon

Step 2: How to Boost Voltage

(/file/F4JFBZVIPZPGFQ7/)

A boost circuit is great when you need a higher voltage source than the battery
you have on­hand. For example, charging a Lead Acid battery requires 12.9V,
some automotive parts require 16V, and some projects require 14V. Motor
speed can also be controlled by the applied voltage. Due to the physics behind
the the conservation of energy, a boost circuit can be a little tricky, but it's a great
example of an analog power circuit.
The conservation of energy implies that energy cannot be created or destroyed,
only transferred. In the case of our boost circuit, this means that power must be
conserved. So if we boost up the voltage, we effectively decrease the amount of
output current we can pull ('output' meaning: the current being pulled after the
voltage has been boosted). To compensate for this, the battery must work
harder to supply both the boosted voltage and the requested amount of output
current.
Power = voltage * current

Let's look at an example of how power is conserved. We start with 5V pulling 1A
which equates to a 5­watt power draw. We want to boost that up to 10V. Power
must be conserved, since we doubled the voltage, we only get half the output
current, 0.5A. If we wanted to have 1A output current, we would need to provide
2A into the boost circuit.
So far these concepts have been ideal, not taking into account the real world
losses. All components and circuits are at least somewhat in­efficient. An
example of this is heat. Components will sometimes release energy is the form
of heat. What does this mean for our circuit? If we want to double the output
voltage, we will have to supply more than double the input current. Use the
example above. In the real world, to get from 5V @ 1A to 10V @ 1A, we would
need to input more than 2A. The higher you boost the voltage, the more
inefficient the system, the greater the power loss to heat. 'Power loss' in this
case does not mean that we are breaking the laws of physics, it means that the
power is getting diverted to other forms of energy like heat.

Step 3: Components and Tools

(/file/F7LS80CIPYA4DSK/)

Now that you know the physics behind a boost circuit we can begin building. You
will need the following items:

Components:
1x long breadboard (https://www.amazon.com/Solderless­BreadBoard­tie­
points­200PTS­Haobase/dp/B0195V3682/ref=sr_1_2?
rps=1&ie=UTF8&qid=1467242355&sr=8­
2&keywords=breadboard&refinements=p_85%3A2470955011#Ask)
2x 10K ohm potentiometers (http://www.digikey.com/product­
detail/en/bourns­inc/3386P­1­103TLF/3386P­103TLF­ND/1232547)
1x 2200uF 50V capacitor (http://www.digikey.com/product­
detail/en/panasonic­electronic­components/ECA­1HHG222/P5576­
ND/245175)
1x 2200uF 20V capacitor (http://www.digikey.com/product­
detail/en/panasonic­electronic­components/ECA­1EHG222/P5545­
ND/245144)
1x 220uF 50V capacitor (http://www.digikey.com/product­detail/en/panasonic­
electronic­components/ECA­1HM221/P5183­ND/245042)
1x 22nF 25V capacitor (http://www.digikey.com/product­detail/en/vishay­bc­
components/K223K15X7RF5TL2/BC1080CT­ND/286702)
1x 10mH inductor (https://www.amazon.com/Toroid­Common­Inductor­
Choke­40mOhm/dp/B00EZC627Y/ref=sr_1_2?
ie=UTF8&qid=1467240431&sr=8­2&keywords=10+mh+inductor)
1x Diode (1N5189) (http://www.digikey.com/product­search/en?
keywords=1n5819fsct­nd)
1x 5V regulator (http://www.digikey.com/product­detail/en/fairchild­
semiconductor/LM7805CT/LM7805CT­ND/458698)
1x 9V regulator (http://www.digikey.com/product­detail/en/fairchild­
semiconductor/LM7809CT/LM7809CT­ND/1923049)
1x 2.4K ohm resistor (http://www.digikey.com/product­detail/en/stackpole­
electronics­inc/CF14JT2K40/CF14JT2K40CT­ND/1830359)
1x 1.8K ohm resistor (http://www.digikey.com/product­detail/en/stackpole­
electronics­inc/CF14JT1K80/CF14JT1K80CT­ND/1830356)
1x 430 ohm resistor (http://www.digikey.com/product­detail/en/stackpole­
electronics­inc/CF14JT430R/CF14JT430RCT­ND/1830341)
1x 1M ohm resistor (http://www.digikey.com/product­detail/en/stackpole­
electronics­inc/CF14JT1M00/CF14JT1M00CT­ND/1830423)
1x 100K ohm resistor (http://www.digikey.com/product­detail/en/stackpole­
electronics­inc/CF14JT100K/CF14JT100KCT­ND/1830399)
1x Arduino or equivalent (https://www.adafruit.com/products/1086)
1x 12V 5Ah lead acid battery (https://www.amazon.com/ExpertPower­
EXP1250­Alarm­Battery­Terminals/dp/B0010Z4MDK/ref=sr_1_3?
ie=UTF8&qid=1467242192&sr=8­3&keywords=5ah+lead+acid+battery)
Solid core wire
Note: The capacitor values do not need to be exact since they are being used
for decoupling. The inductor value and resistor values should be close to the
listed values. SparkFun (https://www.sparkfun.com/), Digikey
(http://www.digikey.com/), and Amazon (https://www.amazon.com/)are all great
places to find components. It can also be very helpful to have a resistor kit
(https://www.amazon.com/E­Projects­EPC­102­Value­Resistor­
Kit/dp/B00E3JGGF2/ref=sr_1_8?ie=UTF8&qid=1467241390&sr=8­
8&keywords=resistor+kit) and a wire kit (https://www.amazon.com/Electronix­
Express­­Hook­Wire­Solid/dp/B00B4ZRPEY/ref=sr_1_1?
ie=UTF8&qid=1467242246&sr=8­1&keywords=solid+core+wire).
Tools:
1x multimeter
Wire strippers
USB cable for uploading Arduino sketch
1x power supply (optional)
1x small Philipps head screw driver (optional depending on the
potentiometer)

Step 4: Design and Simulate the Circuit

(/file/FQXLB0QIQ2O2YQJ/)

A good way to visualize circuits is as blocks. Each block does a specific task.
Put the blocks together and you get a fully functional circuit. The circuit
schematic (first picture) shows the battery power supply circuit. Look a little
closer and you will notice that it is made of a few blocks. Scroll over each of
these to see their function:
Battery: This is the 5Ah 12V lead acid battery to power our circuit. Lead acid
is a good choice for this circuit because it can source high current. In other
words, the circuit draws a lot of current when powering up and to maintain
the boosted voltage. That's one reason why cars use them! Lead acid
batteries also run at 12V which makes boosting the voltage easier.
InputFiltering: These two capacitors help smooth out power line going into
the boost circuit. This helps reduce fluctuations and ripple that could cause
issues in a circuit expecting a steady 12V.
Microcontroller: An Arduino or other device to control the boost circuit and
keep it within its limits.
Control Knob for Boost Circuit: A voltage divider and potentiometer allow
the user to control the voltage output from the boost circuit. The two resistors
on the right drop the voltage down to 5V. This needs to happen because the
Arduino can only read signals up to 5V. Now that voltage divider has reduced
the voltage to 5V, we use a potentiometer to vary the voltage between 0V
and 5V. The Arduino reads this in.
Regulating Circuit: This circuit's job is to reduce the voltage depending on
the use input from the potentiometer. 5V regulators generally regulate
voltages to a static 5V. It does this by matching the output pin to be 5V higher
than the GND pin. Generally the GND pin is connected to the common GND
(battery ground). To make the regulator something other than 5V, we can
apply a voltage to the GND pin. So for example, if we put 3V on the GND pin,
the 5V regulator will make the output pin 5V, to give us a 8V output. So to
make our circuit output anywhere from 5V to 12V we add a voltage divider
that varies the voltage on the GND pin. Depending on the position of the
potentiometer, the output of the regulating circuit will be between 5V and
12V.
Boost Circuit: This is the part of the system that increases the voltage. It
induces voltage spikes (short and sharp increases in voltage) and then
smooths them out into a stable power line. This can be modeled using
complex equations and concepts but we will take a high level conceptual
look. Remember that inductors do not like changes in current, MOSFETs can
act as switches, capacitors smooth voltage ripple, and diodes only allow
current to flow in one direction. We start by having the Arduino continuously
turn the MOSFET on and off very rapidly, which causes the middle node (in­
between the inductor, diode, and MOSFET) to be pulled down to ground
(0V). This causes a rapid and continuous change of current (positive and
negative). The inductor, which hates changes in current, will then induce a
spikes to try and counteract this (positive and negative). So this this leaves
us with a bunch of rapid spikes. These spikes then go through the diode to
only allow the positive ones to pass. The capacitors then take these positive
voltage spikes and smooth them out. This leaves us with a boosted and
stable voltage source.
Boost Feedback: We want the Arduino to know what the system is
outputting, that way it can ensure the voltage stay at the user­chosen
voltage. The Arduino can read in voltages from 0V to 5V. We use a voltage
divider to drop the output voltage from a potential 20V to 5V. The Arduino
can now read this value in and interpret it.
Load: For the components to do their job, they need a minimum amount of
current flow. The 430 ohm load is meant to constantly pull a little but of
current so the circuit can run without an external load. This means we can
run the system and pick our desired voltage without having to have our
load/or project plugged in yet!
That's a lot of information! Remember to look at it one block at a time. Each part
is manageable. Put the blocks together and you have your battery power supply!
NOTE: THE OUTPUT FOR THE BOOST CIRCUIT AND THE REGULATING
CIRCUIT ARE IN DIFFERENT PLACES. THIS IS SO THE SYSTEM DOESN'T
FIGHT TO RAISE AND LOWER THE VOLTAGE AT THE SAME TIME. THE
LEFT KNOB CONTROLS THE BOOST CIRCUIT, THE RIGHT KNOB
CONTROLS THE REGULATING CIRCUIT.
The simulation below shows the boost circuit:
View on Autodesk Circuits

Start Simulation Code Editor

L L1 D D1

CC3 CC4

RR_L
CC1 CC2
U2

RR1
RR3

TM1
P12V 5Ah Lead Acid Bat t ery 3

Voltage
RR2

Voltage
RR4
2
1

RP1

Finishing Time

Time Meter1

D12 / A11

D11

D10 / A10

D9 / A9

D8 / A8

D7

D6 / A7

D5

D4 / A6

D3 / SCL

D2 / SDA

GND

RESET

D0 / RX

D1 / TX

SS

MOSI
Meter2

Arduino U U1
Micro

RESET1

GND1

MISO
AREF
3.3V
D13

NC1

VIN

SCK
NC
A0

A1

A2

A3

A4

A5

5V

The leftmost multimeter shows how much current the system draws. You will
notice that as you boost the voltage, the current we draw increases. The right
multimeter and the o­scope show the output voltage and output waveform
respectively.

Step 5: Code!

(/file/F9L3L9EIPZPHDL3/)

Now that we have all the analog electronics figured out, we can look at
programming the system. To control the boost circuit, we have to apply a pulse
width modulated (PWM) signal to the MOSFET's gate pin. This simple means a
signal that goes high (5V) and then low (0V) at a set frequency. To control the
boost circuit's output voltage, we need to change how long the MOSFET is on or
off for. This is referred to as the duty cycle which you can learn more about from
SparkFun (https://learn.sparkfun.com/tutorials/pulse­width­modulation/duty­
cycle).

So lets start by defining our variables. This comes at the top of the sketch:
#include "TimerOne.h" //include the library we need to create the PWM signal

double duty = 512; //start the duty cycle halfway between 0 and 1024, aka 50% duty cycle

Now that we have our global variables defined, lets write what happens when
the sketch first runs:

void setup()
{
  Serial.begin(9600); //initialize the serial monitor for debugging
  pinMode(13, OUTPUT); //this is the pin that controls the MOSFET, its an output

This will allow us to us pin 13 for the signal controlling the MOSFET, and use
analog pins 5 and 4 for the feedback and potentiometer control respectively. It
also does the initial setup for the timer1 library. The timer1 library also requires a
function called 'callback':

void callback(){
  digitalWrite(10, digitalRead(10) ^ 1);
}

You don't need to understand this function. Just make sure to copy it into your
code (but outside any other function).

Now lets get to the fun part. The main loop, controlling the MOSFET:

void loop()
{
  pot = analogRead(A4); //get the position of the potentiometer
  setVoltage = map(pot,0,1024,118,205); //use the map function to get the value between
 11.8V and 20.5V, this allows some margin of error
This section of code reads in the potentiometer and the actual output voltage.
Based on this information, the Arduino either increases or decrease the duty
cycle signal going to the MOSFET. This will increase or decrease the output
voltage. This section of code is in the void loop so it can continuously check the
potentiometer value. The Arduino sketch code is attached.

 boost.ino (/files/orig/F2L/BCDY/IQ2O4GMV/F2LBCDYIQ2O4GMV.ino)

Step 6: Putting it All Together and Testing

(/file/FSXKQESIPZPHFG5/)
Disclaimer: Do not pull too much current from this device (draw less than
250mA). Be prepared to shut off power from the battery to the circuit and do not
touch any components with your bare hands.
Now that we have designed, simulated, and coded the project, we get to actually
build it!

Tips and Tricks while Building:
Use the electronics lab as a guide!
I didn't include the 9V regulator in the electronics lab but don't forget to
add that! The 12V battery line goes to the 9V regulator input, and the
output goes to the Vin pin of the Arduino.
Remember to use the power rails on the breadboard to your advantage. I
used the top positive rail as the 12V battery input and the bottom rail as the
boost circuit output.
Don't trim the leads of components until after testing. Resistors and other
components will have long leads. but leave them like this until you know
everything works.
Try to avoid having wires overlap too much.
Make sure the diode and electrolytic capacitors are pointed in the right
direction.
TEST AS YOU GO! When you put in a voltage divider, test that it divides the
voltage like you expect. It is a lot easier to troubleshoot each part individually.
Connect all grounds together.
Now that everything is connected, you have reached the exciting moment of
seeing if it all worked! It might not work the first time, but that's OK! Circuits and
electrical engineering takes many iterations. Almost no designer gets it right on
their first try!
When powering it on for the first time, use a power supply if you have one. Limit
the current to 3A. This will keep everything from blowing up if something was
connected wrong. Once everything is working using the power supply, you can
use the battery. I would highly recommend adding a switch in­between your
battery and the circuit. It makes it easier to turn the circuit on and off, as well as
making it safer. Once you get the circuit working with the battery, you are ready
to power your electronic projects!

Why are some of the components so big? Specifically the inductor and
capacitors are very large because they have to handle a lot of power (a couple
amps at 12V). This means they need to be beefier in order to not explode/break.
This is similar to why the power brick for your laptop is so big, its handling a lot
of power (and also converting from AC to DC).

 20160627_142344.mp4 (/files/orig/F47/5QQE/IPZPHFGO/F475QQEIPZPHFGO.mp4)

Step 7: Future Improvments
(/file/FDJKRHSIQ2O2PBC/)

You should now have a working, battery power supply! It is a great tool to use on
those projects that are in the 'field', away from outlets and wall­warts. You could
drive motors using variable voltage or power microcontrollers, logic circuits, LED
strings, analog circuits, and much more.

If you would like to take this project to the next step, consider creating a PCB
and/or 3D printing an enclosure. Tinkercad (https://www.tinkercad.com/)or
Fusion 360 (http://www.autodesk.com/products/fusion­360/overview)would be
great tools for this. Using the PCB Design Tool (https://circuits.io/pcb/)you can
turn a messy breadboard into a compact and reliable printed circuit board. 3D
printing would help protect the components and add a personal touch to your
device.
A power supply has some complicated concepts, but it is a great example of a
fun analog circuit. With a little determination and curiosity, you can have your
own battery power supply in no­time!

I More Comments

FEATURED CHANNELS

Woodworking Paper Kitchen Hacks Puzzles Space Ice Cream Homesteading 3D Printing Sewing


(/tag/type­ (/tag/type­ (/tag/type­ (/tag/type­ (/tag/type­ (/tag/type­ (/tag/type­ (/tag/type­ (/tag/type­
id/category­ id/category­ id/keyword­ id/category­ id/keyword­ id/keyword­ id/category­ id/category­ id/category­
workshop/channel­craft/channel­ kitchen%20hacks/?play/channel­ astronomy/? ice%20cream/? home/channel­ technology/channel­
craft/channel­
woodworking/) paper/) sort=FAVORITES) puzzles/) sort=FAVORITES)sort=FAVORITES)homesteading/) 3D­Printing/) sewing/)
Newsletter
Join 2 million + to receive instant
DIY inspiration in your inbox.

enter email I'm in!

Mobile
Download our apps!

Android » (https://play.google.com/store/apps/details?id=com.adsk.instructables)
iOS » (https://itunes.apple.com/app/instructables/id586765571)
Windows » (http://apps.microsoft.com/windows/en­us/app/7afc8194­c771­441a­9590­54250d6a8300)
About Us Find Us
Who We Are (/about/) Facebook (http://www.facebook.com/instructables)
Advertise (/advertise/) Youtube (http://www.youtube.com/user/instructablestv)
Contact (/about/contact.jsp) Twitter (http://www.twitter.com/instructables)
Jobs (/community/Positions­available­at­Instructables/)
Pinterest (http://www.pinterest.com/instructables)
Help (/id/how­to­write­a­great­instructable/)
Google+ (https://plus.google.com/+instructables)
Resources
For Teachers (/teachers/)
Artists in Residence (/air)
Gift Premium Account (/account/give?sourcea=footer)
Forums (/community/)
Answers (/tag/type­question/?sort=RECENT)
Sitemap (/sitemap/)

Terms of Service (http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |
Privacy Statement (http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) |
Legal Notices & Trademarks (http://usa.autodesk.com/legal­notices­trademarks/) | Mobile Site (http://www.instructables.com)
 (http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)
© 2016 Autodesk, Inc.

You might also like